FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Events
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
March 26, 2003
Understanding First Principles

Rosalyn Lum
Advocates of Emergent Design sing the praises of cohesion, coupling, focus and redundancy.
Untitled Document

Understanding First Principles

Advocates of Emergent Design sing the praises of cohesion, coupling, focus and redundancy.

By Rosalyn Lum
March 26, 2003

“If you have a hammer and a screwdriver in your toolbox, the question is not what tool you should use, but what problem you want to solve,” remarked Net Objectives CEO Alan Shalloway in his Monday morning tutorial, “Emergent Design: Refactoring and Design Patterns For Agile Development,” at SD West 2003 in Santa Clara, Calif. Shalloway and his co-presenter Scott Bain sought to answer the question: What does it take to design good software? Both presenters advocate the Emergent Design approach, based on agile principles: Understanding the problem as you’re trying to solve it, requiring developers to embrace, rather than resist change. According to Shalloway, “You have to step back and see things that neither you nor your customer will ever think of, and the ability to think in patterns will help.”

To do this, sufficient but not excessive methodology must be in place—an agile approach allows developers to respond to the changes in the project. Shalloway outlined agile principles, explaining that though an agile approach won’t necessarily truncate development time, it will give the customer what he wants: “Agility creates more work (more tests), but saves time later in finding errors in your system,” he explained.

Shalloway then enumerated the “first principles” of good software design:

  • Cohesion: The degree of relation of the operations in a class. The stronger the cohesion, the clearer your code.
  • Coupling: The strength of connection of two routines. In general, loose coupling allows objects to be responsible for themselves.
  • Focus: Related concepts should be organized in an understandable way, so that you have one place to look for things.
  • Redundancy: There should be none.

    Shalloway admitted that these ideals are reminiscent of the analyst’s advice to “buy low and sell high,” so he used the rest of the session to describe methods of pinning down abstractions into practice with unit testing, along with refactoring and coding standards.

    Why test before coding? Class testing, Shalloway noted, is a demonstration of knowledge that confirms you’re on the right track. Testing success largely depends on how well the first principles are implemented: The test-change-test-again methodology helps to re-enforce refactoring tenets (cleaning up bad code and accommodating changing requirements). Other vital practices aim at eliminating redundancy; employing exception handling, commonality and variability; identifying and encapsulating code variance; and promoting composition over inheritance. Finally, Shalloway added, pattern-oriented development allows developers to ignore the details while promoting proper interfaces to classes.

    TOP 5 ARTICLES
    No Top Articles.



  • MICROSITES
    FEATURED TOPIC

    ADDITIONAL TOPICS

    INFO-LINK