Linked by Thom Holwerda on Tue 15th Jan 2013 21:24 UTC
General Development "I was really excited to write this article, because it gave me an excuse to really think about what beautiful code is. I still don't think I know, and maybe it's entirely subjective. I do think the two biggest things, for me at least, are stylistic indenting and maximum const-ness. A lot of the stylistic choices are definitely my personal preferences, and I'm sure other programmers will have different opinions. I think the choice of what style to use is up to whoever has to read and write the code, but I certainly think it's something worth thinking about. I would suggest everyone look at the Doom 3 source code because I think it exemplifies beautiful code, as a complete package: from system design down to how to tab space the characters." John Carmack himself replies in the comments.
Thread beginning with comment 549388
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[9]: Good article
by Alfman on Sat 19th Jan 2013 05:50 UTC in reply to "RE[8]: Good article"
Alfman
Member since:
2011-01-28

henderson101,

It might be a matter of preference. I often find that I don't like the way inheritance is used and strongly prefer interfaces myself. This is one reason I like .net over C++. The "IS A" relationship and "HAS A" relationships often tread very thin lines and with the exception of polymorphism the differences become syntactic rather than expressive.

Reply Parent Score: 2

RE[10]: Good article
by henderson101 on Sat 19th Jan 2013 21:25 in reply to "RE[9]: Good article"
henderson101 Member since:
2006-05-30

Yeah, inheritance doen't soleve every problem. But it has its applications. In the case where the same boiler plate code is almost cut and pasted in to multiple classes with no variation, it makes a lot more sense to create a base class and inherit tose characteristics. Don't get me wrong, I don't advocate inheritance over sense ("inheritance madness" as a Turkish co-worked used to call in back in the '90's), but I also think it is important to use all the tools you have effectively, not overly complicate or convolute your code and leave the least margin or error for future maintainability. Cut and paste flat hierarchies are prone to feature disparity when one developer changes an aspect in some but not all classes and then introduces unexpected behaviours. I'd rather see a helper class with the base implementation and then the use of the adapter or mediator pattern with full encapsulation be used than absolute cut and paste.

Reply Parent Score: 2