Skookum Digital Work’s Director of Engineering, Eric LaForce, walks us through the biggest missteps software developers make when creating basic code. Software design patterns can help good code become great, or descend into chaos.
There are two principles that can make or break a software design. According to Eric, it comes down to Anti-Patterns and Patterns, the good, the bad, and the ugly of software coding. Anti-Patterns are the all too common processes that developers should be avoiding at all costs, but don’t.
The Proof is in the Patterns
Anti-Patterns (What Not to Do)
• Big Ball of Mud - Systems that lack perceivable architecture. (Things are what they are and there’s nothing much to be done about it.)
• God Objects – An object that knows and does everything. The object has so much system functionality riding on it, the slightest change will crash the system.
• Inner Platform Effect – When developers decide that their end users what all the customization that they are enjoying as they build the software, essentially re-creating the platform within the platform.
• Interface Bloat – The interface needs to be broken up into smaller chunks in order to be more manageable. An interface can have too many functions, keep dividing the functions until they’re manageable.
• Object Orgy – Objects are insufficiently encapsulated, so all the objects are fading into one another. This is the main anti-pattern that creates the Big Ball of Mud
Patterns (How to Save Yourself)
• Chain of Responsibility – Creating this ensures that all items are properly encapsulated and retain a single responsibility. Commands are interpreted and sent down the chain.
• Mediator Patterns – Just like a person who mediates between two conversations, a mediator pattern links two pieces of code through a dependency mediator. This allows you to make changes in logic directly from the mediator code.
• Command Pattern – Encapsulates a single action with a piece of code. If thoughts are organized into commands, the system knows to do x, then y and can cue up actions to perform complex commands.
• Strategy Pattern – These are used commonly in math-based applications to separate individual algorithms for testing against single data sets. Essentially, this divides the algorithms so that there’s no overlap in the code and each can be selected and compared to the data set separately.
If You Do Things Right... No One Knows You did Anything
Eric’s basic building blocks of code focus on good starting points to keep every piece of code separate, compartmentalized, and specialized. By creating an incredibly stable foundation using the Patterns principles, Eric suggests you can create code that will last for years and stand up to countless iterations.