Patterns in the code

Business woman placing square pegs in round holes.
Design patterns are often like a square peg in a round hole.

I spend a great deal of time reading other people's code.  It is part of my day job as a Scrum Master.  It is also what I do as the president of E3 systems.  It is a tedious task sometimes, but I recommend it to every developer working today.  This week on the blog, I want to discuss code patterns and why they are essential for any developer.

There are countless critics and competing schools of literary thought in the world of literature.  Fortunately, the world of computer science does not have that problem.  The most crucial standard for software is that it works and meets customers' needs.  This is changing as software becomes more complex and it has become more critical to the operation of the business.  Standards cropped up thanks to this new reality and I think it has been a good thing for the industry.

In many respects, developers are like painters; they are creative, temperamental, and a little crazy.  Ask two developers to write the same software with the exact requirements, you will get code that is written very differently.  Multiply this by several hundred developers over three continents, and you have a recipe for disaster.

Most coding standards are common sense.  I like the standards from Microsoft regarding C#.  However, I am starting to see some troubling trends.  First, the Gang of Four, design patterns for Java are being used as a cudgel to punish self-taught developers.  These design patterns have been taught in computer science classes for the last ten years, and the original book on the subject came out in 1994.  Today, those patterns are used in numerous development languages.  A good developer with an understanding of object-oriented development doesn't need to use these patterns, but some architects and a sizable minority think they should be the necessary grammar of development.

I'm afraid I have to disagree with this position.  Gang of Four design patterns are a development style, not the last word on the subject.  To borrow from my friends in English and Communications theory, the Gang of Four represents a dialect of coding rather than grammar.  Just like the formal language of a courtroom differs from the informal tome construction workers use on the job site.  There is a time and place for both, and slavish devotion to design patterns make about as much sense as using a hammer to drive a wood screw.

Software developers often say that they are artists, but in the real world, they are often being used like animators, helping create large and complicated pieces of work with an almost infinite number of moving parts.  The Gang of Four design patterns are helpful. Still, they are being misused by a minority in the development community to judge the ability of other developers who do not understand these processes.

I am much more open to the SOLID programming approach , which creates general guidelines for flexible code.  These guidelines make design patterns possible but not necessary.  Using SOLID makes you more likely to write cleaner and easier-to-use code.  Furthermore, this approach instills good habits in self-taught and classically trained developers.

A developer is his own worst critic.  I know that I look at code I worked on three years ago and cringe at my lack of technique.  I think I am a better developer than when I started fifteen years ago.  I may not use design patterns, but I believe that I can create satisfying customer solutions.  In the end, that was why I wanted to be a programmer in the first place.

Until next time.

Edward J Wisniowski

Edward J Wisniowski

Ed Wisniowski is a software development veteran. He specializes in improving organization product ownership, helping developers become better artisans, and attempting to scale agile in organizations.
Sugar Grove, IL