Politics, Weather, Photography, and the Dog
Wednesday 15 June 2011

Andrew Binstock, editor of Dr. Dobb's, has a pair of editorials in praise of and instruction to create small classes:

High levels of complexity, generally measured with the suboptimal cyclomatic complexity measure (CCR), is what the agile folks correctly term a "code smell." Intricate code doesn't smell right. According to numerous studies, it generally contains a higher number of defects and it's hard — sometimes impossible — to maintain. ...

My question, though, is how to avoid creating complexity in the first place? This topic too has been richly mined by agile trainers, who offer the same basic advice: Follow the Open-Closed principle, obey the Hollywood principle, use the full panoply of design patterns, and so on. All of this is good advice; but ultimately, it doesn't cut it. ...

...[Y]ou need another measure, one which I've found to be extraordinarily effective in reducing initial complexity and greatly expanding testability: class size. Small classes are much easier to understand and to test.

In Part 2, in which Binstock responded to people who had written him about the first editorial:

Coding classes as diminutive as 60 lines struck other correspondents as simply too much of a constraint and not worth the effort.

But it's precisely the discipline that this number of lines imposes that creates the very clarity that's so desirable in the resulting code. The belief expressed in other letters that this discipline could not be consistently maintained suggests that the standard techniques for keeping classes small are not as widely known as I would have expected.

Both editorials make excellent points. Every developer should read them.

Wednesday 15 June 2011 15:10:42 CDT (UTC-05:00)  | Comments [0] | Software#
Comments are closed.
Search
On this page....
Countdowns
The Daily Parker +2775d 00h 20m
Parker's 7th birthday +3d 11h 06m
To West Coast 9d 02h 43m
My next birthday 77d 05h 21m
Categories
Aviation (245) Baseball (92) Biking (26) Chicago (684) Cubs (150) Duke (130) Geography (263) Jokes (98) Kitchen Sink (502) London (4) Parker (171) Daily (203) Photography (124) Politics (296) US (906) World (185) Raleigh (18) Religion (55) San Francisco (67) Software (165) Blogs (48) Business (161) Cloud (52) Cool links (110) Security (75) Travel (68) Weather (575) Astronomy (66) Windows Azure (26) Work (14) Writing (2)
Links
Archive
<June 2013>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
Full archive
Blogroll
About
David Braverman and Parker
David Braverman is a software developer in Chicago, and the creator of Weather Now. Parker is the most adorable dog on the planet, 80% of the time.
Legal
All content Copyright ©2013 David Braverman.
Creative Commons License
The Daily Parker by David Braverman is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License, excluding photographs, which may not be republished unless otherwise noted.
Admin Login
Sign In