Judging architecture by ‘if’ statements required for a new feature
I was doing a code review today on a feature added to some poorly-architected system, and compared it to the code required for features added to well-architected systems. I suspect the quality of a system can be determined by how many ‘if’ statements are required to add a new feature. Poorly architected systems have the peculiar attribute that adding features is often a matter of littering or adjusting ‘if’ statements through the system, often with a class or function or two added somewhere. Well architected systems can normally see features added by scaling “horizontally”- creating new classes or functions, passing those ‘into’ the system, without any actual adjustments to the system code itself. Furthermore I usually find well architected systems easier to refactor, so places that would require an ‘if’ statement to be added or changed, can be refactored to avoid or remove the ‘if’ statement, often making the core of the system itself simpler overall.