Building Beautiful Apps from Ugly Code
Programming in the 21st Century - James Hague - September 08, 2011I wish I could entirely blame my computer science degree for undermining my sense of aesthetics, but I can’t. Much of it was self-inflicted from being too immersed in programming and technology for its own sake, and it took me a long time to recover.
There’s a tremendous emphasis on elegance and beauty in highbrow coding circles. A sort implemented in three lines of Haskell. A startlingly readable controller for a washing machine in half a dozen lines of Forth. Any example from Structure and Interpretation of Computer Programs. It’s difficult to read books, follow blogs, take classes, and not start developing an eye for elegant code.
All those examples of beauty and elegance tend to be small. The smallness—the conciseness—is much of the elegance. If you’ve ever implemented a sorting algorithm in C, then you likely had three lines of code just to swap values. Three lines for the entire sort is beautifully concise.
Except that beauty rarely scales.
Pick any program outside of the homework range, any program of 200+ lines, and it’s not going to meet a standard of elegance. There are special cases and hacks and convoluted spots where the code might be okay except that the spec calls for things which are at odds with writing code that crackles with craftsmanship. There are global variable updates and too many parameters are passed around. Bulky functions because things can’t be reduced to one or two clean possibilities. Lines of code wasted translating between types. Odd-looking flag tests needed to fix reported bugs.
Small, elegant building blocks are used to construct imperfect, even ugly, programs. And yet those imperfect, ugly programs may actually be beautiful applications.
The implications of that are worth thinking about. Functional programming zealots insist upon the complete avoidance of destructive updates, yet there’s a curious lack of concrete examples of programs which meet that standard of purity. Even if there were, the purely functional style does not any in way translate to the result being a stunningly powerful and easy to use application. There’s no cause and effect. And if there is a stunningly powerful and easy to use application, does that mean the code that runs the whole thing is a paragon of beauty? Of course not.
The only sane solution is to focus on the end application first. Get the user to experience the beauty of it and be happy. Don’t compromise that because, behind the scenes, the code to draw ovals is more elegant than the code to draw rounded rectangles.
(If you liked this, you might enjoy Write Code Like You Just Learned How to Program.)
Categories: Blogs Programming in the 21st Century
Comments
I would say that beauty *does* scale, just not at the lines-of-code level. Look at architechtures, frameworks, workflows, or protocols, and you’ll see some that are elegant and beautifull.
Appreciating the beauty of something is not O(1). The more complicated an objects, the more time needed to realize the full beauty/uglyness of it.
Posted by moltonel on 09 Sep 2011 at 09:00Hey! I simply want to give a huge thumbs up for the good information you’ve gotten here on this post. I will probably be coming again to your blog for extra soon.
ラルフローレン ベビー服
I have been reading blogs on this subject for a few hours now and your content is the most informed I have read thus far. Thanks for putting this information in one place.
<a >essay services reviews</a>
I have been reading blogs on this subject for a few hours now and your content is the most informed I have read thus far. Thanks for putting this information in essay services reviews
one place.
I completely agree with you. I really like this article. It contains a lot of useful information. I can set up my new idea from this post.cna exams
Posted by vindiesel on 15 Jan 2012 at 19:48Thanks for sharing this. I really like this allocation due to some good information about building beautiful apps from ugly code. Thanks mate and keep it up.
Posted by Adam Ghilchritst on 05 Apr 2012 at 05:01I just wanted to comment your blog and say that I really enjoyed reading your blog post here. It was very informative. Keep it up and I’ll be back to read more soon.
Posted by Alex martin on 06 Apr 2012 at 06:03Excellent post. I want to thank you for this informative read. I really appreciate you sharing this great post. Keep it up!
dancing with stars contestants
I have started to clean up my coding skills after I’ve started working on a cloud protection application that involved other programmers too. I thought that my code will also be reviewed by my fellow programmers and I wanted to make it as clean and easy to follow as possible. This kind of thinking will surely help me get more organized and more productive in the future.
Posted by DenFletcher on 04 May 2012 at 10:59
Add comment
Erlang on Twitter
» HornedKavu (Max Riveiro): RT @shwars: Вчера в докладе career.ru на #itedu были озвучены новые востреб.профессии на IT-рынке: Haskell-, Lisp- и Erlang-программист!
» phyrexianengine (Vasily K.): RT @shwars: Вчера в докладе career.ru на #itedu были озвучены новые востреб.профессии на IT-рынке: Haskell-, Lisp- и Erlang-программист!
» Erlang_ABNIC (Erlangga .A): @cjerikho829 selamat shooting ♈o kak.. Nitip salam buat kak @Bellaudya829.. ☺ Semangat (งˆヮˆ)ง
» dessyrosalia (♡pesek mancung♥ ): Erlang ke rumahku donk kangen nih
» si_erlang (Erlangga Adhitya): 75% dalane jahanam
» GeekDani (Dani Kim): @charsyam 그렇군용. :-) 여긴 서늘한데. 크크. Erlang Meetup 준비는 잘 하시나요. ㅋㅋ
» syahlafatimahA (LalaTik(ʃ⌣ƪ) ): Waaa?! Si erlang suka cherrybelle(?) wkwkwkwk ngakak aih xD
» yosukehara (Yosuke Hara): I’ll be a simple test for benchmarking JSX and Jiffy together. #erlang
» Debbyvheumen (Debby van Heumen): @elisaaa15 @kleingeld_ haha okee succes :) blijven jullie erlang
» ovatsus (Gustavo Guerra): RT @martintrojer: Just *blogged “Distributed Actors in Clojure” on http://t.co/WcKBpNBR #Clojure #Akka #Erlang #in
Statistics
Number of aggregated posts: 10498
Number of comments: 2115
Most recent article: May 15, 2012
Latest comments
» cheap soccer jerseys on Memory Models in Erlang vs Java: Nice discussion here,you are doing a great job. i was looking for this information. i found it on your page…
» mandesejohn on Couchbase Meetup at new HQ: Thanks for sharing experience. It should be really a great post. It should be knowledgeable and informative. Keep it up. flower delivery columbus ohio
» vermaseo on Scale means Skills: I’m surprised people are still commenting about this. George has been moved on to bigger and better things with the president for awhile now.ledikanten