A discussion of how to do Computer Science well, particularly writing code and architecting program solutions.
Showing posts with label elegance. Show all posts
Showing posts with label elegance. Show all posts
Friday, April 21, 2017
Repost: What Makes a Program Elegant?
In a recent issue of the Communications of the ACM, there was a short article titled, What Makes a Program Elegant? I found it an interesting discussion that has summarized well the characteristics in elegant programming: minimality, accomplishment, modesty, and revelation. Revelation is one that I had not considered before, but I think it is most important of all. There are some code sequences that I have written, which the elegance has rested most of all on its revelation. Using and showing some aspect of computers and programming that I have never seen before, or revealing that there is a modest way to accomplish something new or differently.
Thursday, December 29, 2016
Book Review: The Art of Readable Code
I really enjoyed reading The Art of Readable Code. I always enjoy reading books on style, both English writing as well as source code. The earlier chapters were a greater highlight to me, as they focused on the basics of style and particularly were demonstrated through languages with which I am familiar. Some of the later chapters instead were examples particular to languages that I do not use, such as illustrating style pitfalls with JavaScript. The book also had value in showing several approaches and continuing to refactor the code to better meet style and readability.
While the topic is style, this is really more about fundamentally good practices, which may be implemented in one of several ways (e.g., where to put braces, camel case, etc) that is termed style. Between this and the examples within the text, I want to start requiring it of students. I want them to read and see why style actually matters. Or maybe we will just have to wait until they experience why it matters and suffer for it.
While the topic is style, this is really more about fundamentally good practices, which may be implemented in one of several ways (e.g., where to put braces, camel case, etc) that is termed style. Between this and the examples within the text, I want to start requiring it of students. I want them to read and see why style actually matters. Or maybe we will just have to wait until they experience why it matters and suffer for it.
Monday, January 28, 2013
Repost: When Beauty is Not Truth
While it was not a field discussed in the article, When Beauty Is Not Truth, nonetheless I wonder about the focus I put on elegance in programming (starting with the name of the blog). So let's consider a couple of quick things about Computer Science and the beauty of the code. I should add that the article discusses a rough equivalence between beauty, elegance, and simplicity.
First, beautiful code is not always correct.
Second, beautiful code, by virtue of its simplicity, is less likely to have bugs.
Third, beautiful code is more readable, which facilitates comprehension.
(Now back to preparing the lecture for today's class)
First, beautiful code is not always correct.
Second, beautiful code, by virtue of its simplicity, is less likely to have bugs.
Third, beautiful code is more readable, which facilitates comprehension.
(Now back to preparing the lecture for today's class)
Subscribe to:
Posts (Atom)