Fantastic Learning Resources
matklad.github.io
matklad.github.io
* https://danluu.com/programming-books/
* https://blog.codinghorror.com/recommended-reading-for-develo...
I collect resources for Python, Linux, Vim, etc. See https://learnbyexample.github.io/py_resources/ and https://learnbyexample.github.io/curated_resources/
I'm currently revising my awk book (expect to release by end of this month). You can check out the interactive TUI app (https://github.com/learnbyexample/TUI-apps/tree/main/AwkExer...) that I released recently.
> As mentioned before, I have several projects in my todo list. The next one I want to try is an app for interactive exercises for my ebooks.
From your textual TUI post, which I recently read as well haha
Dumb question, what are invariants? I've been writing code for about 15 years and I haven't heard this term.
The term that you want to Google or ask ChatGPT is "Design By Contract". An invariant is something that is true during the lifecycle of a class, function, loop, service, system, etc. Invariants, preconditions, and postconditions are the three primary constructs in DbC.
https://en.wikipedia.org/wiki/Invariant_(mathematics)#Invari...
Invariants in our code or design can help narrow down this space of possible states by ensuring that certain combinations are impossible.
For instance, assume I have an object that contains an array of integers and a boolean called `hasNegatives` which should be true if and only if the array contains at least one negative integer. If the boolean can be updated or set independent of the array, then the object can't really guarantee that the array and `hasNegatives` will always be "in sync" so to speak.
If your code promises to maintain that invariant (by, for instance, making `hasNegatives` read only and privately updating it when the setter for the array is called to match what's inside the array) then when using this object or seeing an instance of it elsewhere in the code you can happily use it with confidence knowing that the field is always correct with respect to the array within.
Obviously, this is a simplified example, but when applied to an object with many fields, knowing that only certain valid combinations are possible can radically simplify the rest of your code that interacts with that object.
A good example is:
// Invariant: x[i-1] < target, x[j] >= target.
In the golang implementation of binary search:
https://github.com/golang/go/blob/master/src/slices/sort.go#...
[0] https://deitel.com/c-how-to-program-8-e/
[1] https://en.wikipedia.org/wiki/Code:_The_Hidden_Language_of_C...
no?
And honestly given the interest in topics unrelated to programming, I don’t think it’s implied at all so agree on the specification
will def look more into Ted Kaminski's blog.
any advice on how deep should I go?
https://browse-prod-us-east-1.pmc.pearsonprd.tech/en-us/subj...