clean code

programming concepts

Curly's Law: Do One Thing

In Outliving the Great Variable Shortage, Tim Ottinger invokes Curly's Law: A variable should mean one thing, and one thing only. It should not mean one thing in one circumstance, and carry a different value from a different domain some other time. It should not mean two things

By Jeff Atwood ·
Comments

code quality

Code Smaller

Unless you've been living under a rock for the last few years, you've probably heard about the game Katamari Damacy. The gameplay consists of little more than rolling stuff up into an ever-increasing ball of stuff. That's literally all you do. You start by

By Jeff Atwood ·
Comments

clean code

Pretty Code, Ugly Code

Christopher Seiwald's Seven Pillars of Pretty Code [http://www.perforce.com/perforce/papers/prettycode.html] argues that code that looks good, works good: 1. Code changes should blend in with the original style.It should not be possible to discern previous changes to a file without seeing the

By Jeff Atwood ·
Comments

programming practices

Programmers and Chefs

From an audio interview with Ron Jeffries: The reason the kitchen is a mess is not because the kitchen is poorly designed, it's because we didn't do the dishes after every meal. Michael Feathers recently wrote an eerily similar entry about the professional chef's

By Jeff Atwood ·
Comments

code refactoring

Flattening Arrow Code

I often encounter code like this: if (rowCount > rowIdx) { if (drc[rowIdx].Table.Columns.Contains("avalId")) { do { if (Attributes[attrVal.AttributeClassId] == null) { // do stuff } else { if (!(Attributes[attrVal.AttributeClassId] is ArrayList)) { // do stuff } else { if (!isChecking) {

By Jeff Atwood ·
Comments

software development concepts

The Broken Window Theory

In a previous entry [https://blog.codinghorror.com/pragmatic-programming/], I touched on the broken window theory. You might be familiar with the Pragmatic Progammers' take on this [http://www.artima.com/intv/fixit.html]: > Don't leave "broken windows" (bad designs, wrong decisions, or poor

By Jeff Atwood ·
Comments