Lispian Random meanderings on whatever catches my fancy

Lasagna Code

Anyone who claims to be even remotely versed in computer science knows what “spaghetti code” is. That type of code still sadly exists. But today we also have, for lack of a better term — and sticking to the pasta metaphor — “lasagna code”.

Lasagna Code is layer upon layer of abstractions, objects and other meaningless misdirections that result in bloated, hard to maintain code all in the name of “clarity”. It drives me nuts to see how badly some code today is. And then you come across how small Turbo Pascal v3 was, and after comprehending it was a full-blown Pascal compiler, one wonders why applications and compilers today are all so massive.

Turbo Pascal v3 was less than 40k. That’s right, 40 thousand bytes. Try to get anything useful today in that small a footprint. Most people can’t even compile “Hello World” in less than a few megabytes courtesy of our object-oriented obsessed programming styles which seem to demand “lines of code” over clarity and “abstractions and objects” over simplicity and elegance.

Back when I was starting out in computer science I thought by today we’d be writing a few lines of code to accomplish much. Instead, we write hundreds of thousands of lines of code to accomplish little. It’s so sad it’s enough to make one cry, or just throw your hands in the air in disgust and walk away.

There are bright spots. There are people out there that code small and beautifully. But they’re becoming rarer, especially when someone who seemed to have thrived on writing elegant, small, beautiful code recently passed away. Dennis Ritchie understood you could write small programs that did a lot. He comprehended that the algorithm is at the core of what you’re trying to accomplish. Create something beautiful and well thought out and people will examine it forever, such as Thompson’s version of Regular Expressions!

Maybe it’s just my age and curmudgeonly nature shining through, but it pains me to write code for many systems. It’s just so ugly, so poorly thought out. There are bright spots, but they’re rarer by the year. No wonder so many kids decide not to go into computer science. Where it was once applied mathematics with all its intrinsic beauty it’s now been reduced to slapping at the keyboard, entering thousands of lines hoping the compiler will allow your code to compile. Where’s the elegance that was Lisp or Smalltalk or APL? Hell, even Fortran was more elegant than a lot of the crap programming languages being touted today. Why hasn’t someone gone back to Algol and pushed that forward.

As I mentioned to my kids the other day, it’s sad when one of the best programming languages remains C. Sure, there are some beautiful small languages out there that do niche work, but mainstream? Nothing. It’s just a catastrophe. Something like Python may have been great if they’d not embedded an object model into its guts. Sigh.

November 2011
« Oct   Dec »