Neal ford also states, that code should be written in such a way, that comments are not needed.
I translate this to "code should be as clear and simple as it can". But this only obviates comments that explain WHAT the code does. The more valuable comments are about WHY the code does what it does;
why did the developer choose this algorithm over that one.
And this kind of comment IMHO should not be invalidated by refactoring. Refactoring (as I understand it) only changes notation without changing visible behaviour. Thus, the design decisions should not be changed by refactoring.
Of course, if the design decisions change, the comment needs updates. But the alternative is, to NOT record the design decision.
plauggBlog
2008-11-08
Whats the goal of Literate Programming?
Neal Ford posted an article on Meme Agora, where he postulated, that Literate Programming pursued the goal of self-documenting code, in the sense that the code IS the documentation.
Literate Programming as I understood the concept is NOT about avoiding documentation. It is about putting documentation FIRST and code second, because making code readable for humans is the more difficult and more important thing.
It should be possible to structure your program in such a way, that a narrative appears and that the program is presented to a reader in the way that is easiest to understand. This should not be limited by the available means of the programming language.
Obviously this is more important when writing software in languages that impose structure (e.g. "declare all variables at the top of your function") than in languages that allow more freedom.
Also it is a more document-oriented approach, where it is assumed, that the narrative is created by one authorative voice and not the collaborative fashion in which programs are created nowadays.
Literate Programming as I understood the concept is NOT about avoiding documentation. It is about putting documentation FIRST and code second, because making code readable for humans is the more difficult and more important thing.
It should be possible to structure your program in such a way, that a narrative appears and that the program is presented to a reader in the way that is easiest to understand. This should not be limited by the available means of the programming language.
Obviously this is more important when writing software in languages that impose structure (e.g. "declare all variables at the top of your function") than in languages that allow more freedom.
Also it is a more document-oriented approach, where it is assumed, that the narrative is created by one authorative voice and not the collaborative fashion in which programs are created nowadays.
2008-05-12
QuickLook trouble -- a.k.a. Finder keeps crashing
Today I tried to install an update for BibDesk and nearly succeeded. Then Finder.app and Dock.app startet crashed, restartet, tried again, whatever they did wrong and -- crashed again.
As it is no fun to work with a Mac without Dock and Finder, which, to add insult to injury, steals your focus every 3 seconds to present you a near useless crash report, I began googling for help.
How?
With the ever-helpful seperate admin account on the machine.
And what did I find?
Reports about corrupt metadata attached by adobe tools to pictures. As Quicklook had a prominent place in the stack traces, this seemed right. But I didn't use any of the mentioned products (CS3,...).
Then I remembered qlmanage, the command line tool to inspect quick look plugin resolution. And behold! For my user account, quick look asked the half-installed bibdesk quick look plugin if it would like to provide a preview of jpgs. The plugin then crashes hard and takes quick look server and the asking application (Finder, Dock,...) down too. Hmmpf!
After removing the broken Bibdesk.app and "qlmanage -r" to reset the quick look generator list, everything works again.
Phew.
My next options would have been re-installing the combo updater for 10.5.2. and, if that failed, reinstall Leopard. Not a welcome thought.
2008-04-21
Font Selector Crash solved
The last weeks I lost some hours of work in Keynote to a strange crash in the font selector (Cmd-t). Clicking on the "Favorites" font collection relieably caused the crash of Keynote.app (08). The crash was also reproducible in Pages and Textedit.
Some trial and error lead me to the following solution: removing
Some trial and error lead me to the following solution: removing
/Library/FontCollections/com.apple.Favorites.collectionand restarting the application made Keynote like fonts again.
2008-02-28
2007-06-04
Debian Wunschliste
Dinge, bei denen ich nicht verstehe, warum sie nicht mit base-install kommen:
- Userverwaltungstools die über adduser/usermod hinausgehen. das fängt bei tools, die /etc/shadow lesen können an.
- etwas, womit ich dem dhcp-server seinen Status entlocken kann, das lesbarer ist als dhcp.leases. omshell ist ein schlechter witz.
2007-02-02
expect
The command expect is a useful tool to script otherwise nonscriptable unix tools, e.g. passwd:
#!/usr/bin/expect -f
### call with $username $passwd as arguments
set password [lindex $argv 1]
spawn /usr/bin/passwd [lindex $argv 0]
expect "*password:"
send "$password\r"
expect "*password:"
send "$password\r"
expect eof
Abonnieren
Posts (Atom)