27 January 2015

Other people’s code

Programmers dread reading code written by another programmer. Why is it so hard to read other people’s code? I don’t know, but here are some thoughts.

In C, it is because of the limited ability to express abstractions. Code of any complexity tends towards using function pointers and macros and other techniques that obscure things.

In some languages, like Perl, it is because everyone uses a different subset of the language. In the extreme case, this can also mean completely different styles of programming in the same language.

With some languages, like Scheme, it is because the ability to build powerful abstractions means that code of any complexity essentially becomes another language embedded in the original. To understand the code, you have to learn this new, project-specific language.

No comments: