13.07.2015 Views

Simplicity, Clarity, Maintainability Abstraction Decomposition

Simplicity, Clarity, Maintainability Abstraction Decomposition

Simplicity, Clarity, Maintainability Abstraction Decomposition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Good Algorithm and Data Structure SelectionUsing the principles learned in CS 235 and 312 to select appropriate algorithms and data structures isessential to runtime efficiency. No amount of abstraction, decomposition, etc. will compensate for poorchoices in this area.Don’t Repeat Yourself / Avoid Code DuplicationPatterns: Template Method, Builder, VisitorDesign Smells: Duplicated Code, Switch Statements, Parallel Inheritance HierarchiesSingle Responsibility Principle / Cohesion / Separation of ConcernsEvery class and method should have a single responsibility. A class should represent one well-definedconcept, and only contain functionality that is highly-related to that concept. A method should do onething and do it well. Classes and methods should have good names that describe their oneresponsibility.Separate dissimilar concepts in your code. This allows you to change one without affecting the other.Patterns: Visitor, Builder, DecoratorDesign Smells: Divergent ChangeIsolated Change PrincipleIdeally, the implementation of a responsibility should be isolated to a single place in the code. This way,if something about a responsibility changes, there will be only one place in the code that needs to bechanged.Patterns: Template Method, Builder, Visitor, DAODesign Smells: Shotgun SurgeryOpen-Closed PrincipleSoftware entities should be open for extension, but closed for modificationComposition: Depend on abstractions, not on concretionsInheritance: Override polymorphic methodsPatterns: Strategy, Plug-InPatterns: Template Method, Factory Method

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!