TheJach.com

Jach's personal blog

(Largely containing a mind-dump to myselves: past, present, and future)
Current favorite quote: "Supposedly smart people are weirdly ignorant of Bayes' Rule." William B Vogt, 2010

"I can understand what each line is doing"

This is typically said of a "simple" language such as C (and sometimes, lately, Go) because the abstraction layer between the hardware and the language is light. If nothing else, you can figure out what's going on at the hardware level if you really want to. (And in Go you don't have to "worry" about the possibility of a macro.) This might help you reason about performance, or understand a disassembled binary, or just as an excuse not to use C++.

A typically response might be "Oh really? What does the line with fnord(i); do?" The correct answer is "It finds the variable i using lexical scoping rules, puts a copy of it in a free register (or pushes it on the stack), and jumps to the location of the fnord function which may or may not use the i value in the register or on the stack, may or may not do something else, and may or may not alter the machine instruction pointer to avoid returning to the jump location like a normal function would."

Okay, but what does the piece of code do? As a programmer reading C code, almost all of my time is spent trying to understand that. Better rephrased, what goal does the piece of code accomplish? I don't tend to care what the machine itself is doing, except in very specific circumstances like optimization and hardware programming.

See Full Post and Comments

1000 Lines

For today's installment of arbitrary thresholds, I bring you this one: before you can even consider yourself a novice in a programming language, capable of doing something useful and capable of offering critique for or against it, you need to have programmed at least 1000 lines of code in that language. If this seems obvious to you, with perhaps uncertainty of whether it's 1000 or 800 or 2000, feel free to quit reading. The rest of the post is devoted to bringing up a few possible objections and hand-waving them away because they don't matter.

First up: lines of code is a horrible metric! Yes, for measuring programmer productivity. But for determining whether you're a n00b or not, I don't think so. If you discover a way to shave off 300 lines of verbose code, replacing it with 10 lines, assume an expert in the language would have seen that immediately. In any case, you win 310 lines in your goal to 1000.

Next up: all programming languages are not equal, what might take 1000 lines of Java might only take 30 lines of Lisp. This is true, and that's why Java is the Enterprise Standard and Lisp is not. It's easier to become a novice in Java than it is for Lisp, regardless of prior programming background. A Lisp "hello world" gives you 1 line in your quest, Java's gives you 5.

See Full Post and Comments