What is Good Design:
- Elegant
- Simple
- Robust
- Flexible
- Appropriate
Its all about Art and Science
Where To Start???
- Requirements and Use Cases
- Identify Nouns and Verbs: Nouns(Costumer) Verbs (LogIn)
Wine, Restaurants, Regions
Design Principles
- Single Responsibility Principle (Do one thing, but do it well)
- Dry (Dont repeat your self)
- Open / Closed (open for extension but closed for modification)
- Tell, Dont Ask
- Law of Demeter (employee.pay())
- Design to Interfaces
- Encapsulation (Do in cfc), data, type, reveal by need
- Loose Coupling / Connascence (Objects should not depends on a lot of other objects, keep dependencies small)
- Interface Coupling (user.addUser() )
- Inheritance Coupling (price = super.price * discount)
- Cohesion
- Class Reference Set (You have to know how many objects depends of that specific object)
- Testability
- Is there Such a Thing? Very Difficult
www.briankotek.com/blog
www.alagad.com
Search for Calisthenics (Parece ser bom)
Nenhum comentário:
Postar um comentário