Tuesday 6 April 2010

Emergent Design - These few simple rules, applied locally, can help a high quality global design to emerge.

In a posting on the Agile Modeling mailing list, Alan Shalloway of Net Objectives, proposed some rules on well designed code:

  1. Runs all the tests
  2. Follows once and only once rule
    (which I believe means “contains no duplicate code”)
  3. Has high cohesion (clarity)
  4. Has loose coupling

Alan comments:

“If you look at design patterns, you can see that most of them follow these rules. High cohesion and loose coupling can often be achieved by decomposing your problem domain with the distinctions of commonality / variability analysis. That is, find how things are similar and then find out how they are different.

“The other thing I like about this set of rules is that they are easy to teach and understand. Cohesion has to do with clarity. Method cohesion means a method is focused on one purpose. Class cohesion means all of the methods in a class are focused on one larger purpose.”

Posted via web from fasanya's posterous

No comments: