Structuredness is a code and interface quality that reflects the proportion between the information that constitutes the code or the interface governed by some style rules, conventions (including naming conventions), design and programming patterns, and the unique information.
Structuredness, as defined in the Software Design project, should not be confused with McCabe's structuredness.
Relations to other qualities[edit | edit source]
Higher structuredness is not necessarily better for the ultimate software quality, as exemplified by satiric projects such as FizzBuzz Enterprise Edition. However, unnecessary unstructuredness, or inconsistency, makes the code or the interface more complex and its learning curve steeper which makes code harder to navigate and read.
It may be easier to spot clerical errors in highly structured code than in the code which is equivalent in size, but is chaotically organized because the developer can follow the visual pattern of the structured code without much mental effort and focus only on the business logic details. Maintaining the structure also helps to reduce the size of change sets in the revision control system because the structure itself typically won't be changed often. While reviewers find bugs in smaller changes sets more effectively.
Relevant practices[edit | edit source]
- Always use the same way to do a thing
- Arrange parameters in a consistent order
- Call function's return variable "result"
- Minimize the diff between implementations of a strategy
- Object access chains: either always or never encapsulating them.
References[edit | edit source]
- FizzBuzz Enterprise Edition
- Boswell, Dustin; Foucher, Trevor (2011). The Art of Readable Code. ISBN 978-0596802295. Chapter 4, "Why Do Aestetics Matter?" section
- Best Kept Secrets of Peer Code Review. 2013. p. 79. ISBN 978-1599160672. https://static1.smartbear.co/smartbear/media/pdfs/best-kept-secrets-of-peer-code-review_redirected.pdf. "Defect Density Analysis" section