2007-08-01

2007-07-16

Words to code by

More generally, complicated code is a sign that you don't understand your program well enough to make it simple.Code Complete, Second Edition

I don't think I've ever seen a better, more succinct rule of thumb for programmers. If you ever find yourself looking at a chunk of code and wondering what it does, you should ask yourself if there is any possible way to simplify it. Almost every time I've ever had a feeling that a block of code is too complicated but left it as is (for whatever reason), I've regretted that decision later.

P.S. I haven't forgotten about the updates I promised in The Education of a Programmer, but it turns out that writing a post that does justice to the source material is non-trivial. I've spent at least three times as much time writing and erasing and rewriting the first update as I did on the reading/exercises I was going to post about.

Back to flipping out...

2007-06-13

Why Ninja Always Beat Samurai

Ninja don't have an alias for seppuku.

Back to flipping out....

2007-06-10

G-Client and Special Sauce

I'm posting this from the friendly confines of G-Client, a suite of emacs clients for accessing Google Services. It's quite nifty, although you should pay attention to the comments if you are using it independently of its parent project, emacspeak; there is a gotcha with the stand-alone package, although I hear it has been resolved with the latest in svn.

Actually, ignore that last paragraph. I wrote this post 4 times in G-Client, and never once managed to post it successfully. Once, I made the mistake of saving a draft version, and emacs switched modes on me. The other three times, I finished writing and used C-c C-c to (supposedly) submit the post for publication, but emacs seemed to just spin out into infinity or something. So combining the fact that the distributed tarball didn't work out of the box with the fact that even after I fixed that problem the editing and submission process is flaky, I can't recommend G-Client to anyone right now. The idea is fascinating, though, so I'll continue to follow developments, and if it does work out, I'll be sure to let you know. Until then, it looks like it's back to FF + It's All Text! for now.

Back to flipping out...

2007-06-04

The Education of a Programmer

In a previous post, Picking Your Next Programming Language, I discussed my plans to begin learning a new programming language. Now it's time for the big reveal: Scheme.

I picked Scheme for a variety of reasons: I don't know any functional languages, I don't know any LISP dialects, etc. By far the most important reason, though, is that it is the language used in SICP, and that's the textbook for CS 6.001 - Structure and Interpretation of Computer Programs at MIT. I'll be posting periodic progress updates and interesting tidbits as I work through the material available through the incredible OCW program.

Since there is more to being a programmer than the computer languages you know, I'll also be working through the course material for 21F.101 / 21F.151 Chinese I. If I can figure out how to make Blogger work with Chinese characters, I'll post progress updates as I work through this class as well.

Back to flipping out...

2007-05-31

Picking Your Next Programming Language

A lot of smart developers swear by The Pragmatic Programmer, especially its advice to learn one new programming language per year. I've been planning to learn a new language for quite a while now, so I've decided to stop planning and start doing. The first step was to make a shortlist of languages I'd be interested in learning.

To build the list, I took a lot of inspiration from The Shape of Your Mind. I modified his list with some languages I've seen mentioned on the various blogs I read, and voila! Here's my list (in no particular order):

Language Comparison
Language Paradigm Typing Discipline Description
Scheme Functional Strong, dynamic one of the two main dialects of LISP; minimalist; used by SICP
Forth Concatenative (uses RPN) Typeless One of, if not the, original concatenative programming languages; known for its performance and simple parsing; reflective; Used by Open Firmware; standardized by ANSI
Factor Concatenative Strong, dynamic One of the core designers is Slava Pestov; it is currently undergoing active development, with a 1.0 release expected this year
Haskell Pure functional Static, strong, inferred lazy evaluation; monads; type classes; Haskell is pretty far out of the (ALGOL-based) mainstream, but there are a lot of resources available online to get you started.
Erlang Concurrent, functional Dynamic, strong Developed at Ericsson to support distributed, fault-tolerant, soft-real-time, non-stop applications; supports hot-swapping; actually encompasses the language and the runtime system;Follows the Actor Model for concurrency; the sequential subset of the language is functional
Python Multiparadigm: object-oriented, imperative, aspect-oriented, functional Strong, dynamic Popular "scripting" language with support for easy calls out to C; whitespace matters; list comprehensions; used extensively by Google and forms the basis of the Gentoo package management system, portage
Qi Functional optional strong, static enforced by Turing-equivalent type checker a totally badass name; built on top of LISP, so you can use all the features of LISP; aims at being a modern LISP, adding features such as optional static type-checking, partial application, pattern matching, etc.
Prolog Logic programming only type is "term" A logic programming language primarily associated with AI and computational linguistics; declarative.
Oz Multipardigm: logic, functional, imperative, object-oriented, constraint, distributed, concurrent ??? Strongly influenced by Prolog; Provides both lazy and eager evaluation; Particularly strong in the areas of distributed programming and constraint programming; primarily implemented in the Mozart Programming System
Smalltalk Pure object-oriented Strong, dynamic reflective; "code browser" environment; uses message passing and a class-based object-oriented system; influenced the design of most of the later object-oriented languages (Objective-C, Java, Python, Ruby, et al)
Clean Pure functional Uniqueness typing system Pure functional language uses its uniqueness typing system to avoid monads; list comprehensions; Clean IDE
Eiffel Object-oriented Strong, static Somewhat unique in its focus on and support for Design By Contract
Ruby Object-oriented Strong, dynamic While the language design is object-oriented (everything is an object), it supports multiple paradigms and lends itself to metaprogramming; incredible momentum; language used by Ruby on Rails; currently has very Perl-esque syntax, but that is rumored to be going away; current implementation is extremely slow, but improving performance is a high priority; lacks native Unicode support, though that is also targeted for improvement
Perl Multiparadigm Dynamic Extremely polarizing language; regexes are a prominent feature; it's module system, CPAN, is widely regarded as the standard by which other module systems should be judged; once widely criticized for poor quality of code written in it, that reputation has begun to recede, especially with the arrival of Perl 5.
C Imperative Weak, static Designed for systems implementation and machine independence; has been described as portable assembly
Objective-C Object-oriented Strong; a mixture of static and dynamic object-oriented; merger of Smalltalk and C; widely used by Apple; a mixture of static and dynamic, strong typing

Stay tuned to find out which language I picked.

P.S. Please comment with any improvements or suggestions about the information in the table above; since they are on my list of languages to learn, by definition I don't know much about them, so it's entirely likely I mischaracterized them. If I've wronged your favorite language, please let me know politely.

Back to flipping out...

Speaking of Debugging...

I've been struggling at the office lately with some XSL that is apparently trickier than it looks. Of course, as soon as I finished debugging (poorly) my problem, I see this article over at dW. I'd say Aargh! if it didn't remind me of those filthy pirates.

Back to flipping out...

2007-05-21

What is a programmer's purpose in life?

To flip out and write code! (and sometimes to debug that code).

Back to flipping out...