"Programming in the XXI century" by James Hague
Kind notes/highlights on Programming in the XXI century
¶TODO page 113 | Location 1725-1727 | Thursday, March 8, 2018 9:06:03 PM programming
Problems are debugged at the hardware level, with data breakpoints and trapped CPU exceptions and protected memory pages (this is how debuggers work).
¶TODO page 127 | Location 1944-1947 | Friday, March 9, 2018 10:57:24 PM programming
your finger inside a global array somewhere, causing a week's worth of debugging. In fact, it looks exactly the same as the purely functional version from the caller's point of view. Perhaps the sweeping negativity about destructive updates is misplaced.
¶DONE [B] page 441 | Location 6754-6757 | Sunday, March 18, 2018 5:58:14 AM programming
Programming Modern Systems Like It Was 1984 Imagine you were a professional programmer in 1984, then you went to sleep and woke up 30 years later. How would your development habits be changed by the ubiquitous, consumer-level supercomputers of 2014?
¶DONE [C] Trapped! Inside a Recursive Data Structure programming
Whenever the head of the list is a list itself, the tail is pushed onto Stack so it can be continued with later, and the list is processed. When there's no more input, check to see if Stack has any data on it.
¶ kinda like BFS programming
¶DONE [C] Follow-up to "Admitting that Functional Programming Can Be Awkward" programming
For a bouncing ball or spinning cube, yes, that's easy. But is there a closed-form solution for a game where entities can collide with each other and react to what the player is doing?
¶DONE [C] Monday, March 12, 2018 2:51:56 AM | This Isn't Another Quick Dismissal of Visual Programming programming
Not too surprisingly, this is a subject that brings on the defensiveness. It's greeted with diatribes about "real" programming and how drawing lines to connect components is too limiting and links to articles about the glory of raw text files. At one time I would have agreed, but more and more it's starting to smack of nostalgic "that's how it's always been done"-ness. In Microsoft's old QBasic, programs
¶DONE [C] page 301 | Location 4604-4605 | Tuesday, March 13, 2018 2:20:54 AM programming
Linked lists are a worst case, potentially jumping to a new cache line for each element. That's damning evidence against languages like Haskell, Clojure, and Erlang. Yet some
¶DONE [C] page 371 | Location 5687-5689 | Wednesday, March 14, 2018 7:12:55 AM programming
Once you've learned a small subset of a language like Python--variables, functions, control flow, arrays, and dictionaries--then features are no longer the issue. Sure, you won't know all the software engineery stuff like exceptions and micromanagement of variable and function scopes, but it's more important to learn how to turn thoughts into code before there's any mention of engineering.
¶DONE [C] page 452 | Location 6918-6919 | Monday, March 19, 2018 9:53:25 PM programming
Internal class methods are similar. If they're not in the tutorial, examples, or reference, you don't even know they exist.
¶DONE [D] Macho Programming programming
What struck me about this argument, besides that people actually argue about such things, is how many other respected activities don't have anywhere near the same level of paranoia about protection from mistakes. On the guitar--or any musical instrument--you can play any note at any time, even if it's out of key or, more fundamentally, not played correctly (wrong finger placement or pressure or accidentally muting the string). And people play instruments live, in-concert in front of thousands of people this way, knowing that the solo is improvised in Dorian E, and there's no physical barrier preventing a finger from hitting notes that aren't in that mode. The same goes for sculpting, or painting, or carpentry...almost anything that requires skill.
¶DONE [D] page 462 | Location 7081-7083 | Tuesday, March 27, 2018 5:16:36 AM programming
In the interest of time, I'll offer this for-experts-only spec for "What can you put in a refrigerator?": Anything that fits into a refrigerator.
¶DONE page 71 | Location 1085-1089 | Wednesday, March 7, 2018 10:27:18 PM programming
One of my favorite non-alphanumeric characters for function names is "?". Why say is_uppercase (or IsUppercase or isUppercase) when you can use the more straightforward Uppercase? instead? That's standard practice in Scheme and Forth, and I'm surprised it hasn't caught on in all new languages.
¶ yep, also in Agda or lisps. Same for dashes, underscores look a bit awkward (e.g. uppercase-p
) programming
¶DONE page 72 | Location 1099-1105 | Wednesday, March 7, 2018 10:28:00 PM programming
in (open-file), to indicate that a word is low-level and for internal use only. And then there are clever uses of characters in Forth that make related words look related, like this: open{ write-byte write-string etc. }close The brace is part of both open{ and }close. There no reason the braces couldn't be dropped completely, but they provide a visual cue about scope.
¶DONE page 120 | Location 1832-1834 | Friday, March 9, 2018 10:50:33 PM programming
On Being Sufficiently Smart I'm proud to have created the wiki page for the phrase sufficiently smart compiler back in 2003 or 2004.
¶DONE page 135 | Location 2068-2071 | Sunday, March 11, 2018 12:14:43 AM programming
Borland's other languages with "Turbo" in the name--like Turbo C--weren't even remotely close to the compilation speeds of Turbo Pascal. Even Turbo Assembler was slower, thanks in part to the usual step of having to run a linker. So what made Turbo Pascal so fast? Real modules. A
¶interesting, turbo pascal came up with the modules? programming
¶DONE page 136 | Location 2071-2073 | Sunday, March 11, 2018 12:14:54 AM programming
large percentage of time in C compilers is spent reading and parsing header files. Even a short school assignment may pull in tens of thousands of lines of headers. That's why most C compilers support precompiled headers, though they're often touchy and take effort to set-up.
¶DONE page 137 | Location 2086-2088 | Sunday, March 11, 2018 12:16:21 AM programming
Yes, there was a drawback to instantaneous compile times. Fewer optimizations were done, and almost always the resultant code was slower than the C equivalent. But it didn't matter. Removing the gap between the steps of writing and running code was worth more than some amount of additional runtime performance.
¶DONE page 179 | Location 2732-2738 | Sunday, March 11, 2018 8:50:38 PM programming
Erlang takes this further by having a separate block of memory for each process, so when the block gets full only that particular block needs to be garbage collected. If it's a 64K block, it takes microseconds to collect, as compared to potentially traversing a heap containing the hundreds of megabytes of data in the full running system. Disallowing destructive updates allows some nice optimizations in the garbage collector, because pointers are guaranteed to reference older objects (this is sometimes called a "unidirectional heap"). Together these are much simpler than building a real-time garbage collector that can survive under the pressure of giant heaps.
¶DONE page 186 | Location 2845-2847 | Sunday, March 11, 2018 8:59:25 PM programming
Not all tutorials are this way. Paradigms of Artificial Intelligence Programming is a survey of classic AI programs mixed together with enough details about Lisp to understand them.
¶DONE page 396 | Location 6062-6066 | Thursday, March 15, 2018 4:55:04 AM programming
On most systems, this little C program will soak up all available memory: while (1) { malloc(0); } so the answer is not the obvious "zero." But before getting into malloc(0), let's look at the simpler case of malloc(1).
¶DONE page 432 | Location 6618-6624 | Sunday, March 18, 2018 5:42:29 AM programming
There's another option, too: you could give up. You can stop making things and become a commentator, letting everyone know how messed-up software development is. You can become a philosopher and talk about abstract, big picture views of perfection without ever shipping a product based on those ideals. You can become an advocate for the good and a harsh critic of the bad. But though you might think you're providing a beacon of sanity and hope, you're slowly losing touch with concrete thought processes and skills you need to be a developer. Meanwhile, other people in their pre-epiphany states are using those exact same technologies that you know are broken, and despite everything you do to convince them that this can't possibly work...they're successful.