Inspect and Adapt

#5 Design Patterns: What's Their Connection to Fundamental Design Principles?


Listen Later

Construx Principal Consultant Steve Tockey and Mark Griffin discuss design patterns in a unique way by emphasizing the importance of understanding fundamental design principles when you’re using patterns.

Of the top five reasons that software projects get into trouble, the most significant issue that is directly under the control of software developers is the complexity in the code base. Both industry data and Steve’s own engagement-derived data over 20 years of software consulting support this. As Steve McConnell has argued, the prime directive of the software professional is to manage complexity.

Steve and Mark dive into specific kinds of code complexity—such as cyclomatic complexity, depth of decision nesting, fan out, and number of parameters—and describe the fundamental design principle related to complexity: minimize overall complexity by balancing local and global complexity. Without measuring complexity in your code base, you can’t actually effectively control it. By measuring it, you can achieve the balance of complexities that most significantly decreases your code’s overall complexity.

Steve and Mark continue by listing the fundamental design principles Steve covers in his design patterns training so as to begin to address a key question: Why is understanding the fundamental design principles important if you’re using design patterns? The list of principles applies across a broader spectrum of software creation than the SOLID principles do. Steve’s list causes you to pay attention to software attributes that you wouldn’t pay attention to if you were using only the SOLID principles.

Steve argues that you can’t deeply understand what a pattern is up to unless you understand why the pattern looks the way it does. Each software pattern is primarily driven by a fundamental design principle and can be influenced by other fundamental design principles. For example, the Strategy pattern is primarily driven by the encapsulation principle and is influenced by Liskov substitutability and cohesion and coupling. Understanding the connections between design patterns and design principles vastly deepens your understanding of the patterns and their applicability.

The episode ends with a thorough discussion of another fundamental design principle: encapsulation, which is achieved only via Design by Contract. The difference between code syntax and code semantics enters the discussion to help explain how code contracts operate. You have to get beyond syntax to achieve higher quality code with fewer defects, which are semantic inconsistencies. Compilers are ruthless masters of syntax but can’t help with code semantics.

Links to Steve Tockey’s books:

How to Engineer Software: A Model-Based Approach (Wiley-IEEE Computer Society Press, 2019)

Return on Software: Maximizing the Return on Your Software Investment (Addison-Wesley Professional, 2004) 

...more
View all episodesView all episodes
Download on the App Store

Inspect and AdaptBy Construx

  • 5
  • 5
  • 5
  • 5
  • 5

5

10 ratings


More shows like Inspect and Adapt

View all
Software Engineering Radio - the podcast for professional software developers by se-radio@computer.org

Software Engineering Radio - the podcast for professional software developers

272 Listeners

This American Life by This American Life

This American Life

90,549 Listeners

Freakonomics Radio by Freakonomics Radio + Stitcher

Freakonomics Radio

31,914 Listeners

Revisionist History by Pushkin Industries

Revisionist History

59,439 Listeners

The Daily by The New York Times

The Daily

111,049 Listeners

Up First from NPR by NPR

Up First from NPR

55,933 Listeners

Thoughts on the Market by Morgan Stanley

Thoughts on the Market

1,272 Listeners

SmartLess by Jason Bateman, Sean Hayes, Will Arnett

SmartLess

57,900 Listeners

The Weekly Show with Jon Stewart by Comedy Central

The Weekly Show with Jon Stewart

10,259 Listeners