- Inheritance is a core principle of OO programming.
- But we tend to overuse it.
- Often results in design and code that is inflexible.
Problems with Our Design
- We have code duplicated across classes.
- Hard to gain knowledge of all the ducks.
- Changes can affect other ducks.
- Runtime behavior changes are difficult.
What About Using Interfaces?
- Allow different classes to share similarities.
- Not all classes need to have the same behavior.
- Let us try moving duck behaviors into interfaces.
Implementing Ducks with Interfaces
- Solves part of the problem, but...
- Absolutely destroys code reuse.
- Becomes a maintenance nightmare.
- Does not allow for runtime changes in behaviors other than flying or quacking.
Design Principle #1
- Identify the aspects of your code that vary and separate them from what stays the same.
"Encapsulate What Varies"
- If some aspect of code is changing,
That's a sign you should pull it out and separate it.
- By separating out the parts of your code that vary
You can extend or alter them without affecting the rest of your code.
- This principle is fundamental to almost every design pattern.
Design Principle #2
- Program to an interface, not an implementation.
The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
- www.skilledtesting.com Erkan..
- The Braidy Tester
- Hans Schaefer's home page
- Software Test & Performance..
- Professional Tester Magazine
- Pairwise Testing
- Methods & Tools - Providing..
- Model-Based Testing Home Page
- Dr. Dobb's Portal
- Jeff Offutt (Professor of So..
- Jeff Tian, Ph.D., P.E., Asso..
- Specialist Group in Software..
- Software QA/Test Resource Ce..
- AMERICAN SOCIETY FOR QUALITY
- Software Testing and Quality..
- Association for Software Tes..
- 다음 일본어 번역
- 네이버 일본어 번역
- 고재팬 일본어 번역
- The Software Engineering Res..
- QA Testing and Test Tools co..
- Information for people with..
- Testing Blog
- Bret Pettichord
- Tester Center
- I. M. Testy
- Glossary and Technical FAQs
- Software Testing Mentor
- Martin Fowler's Bliki
- Game Developers Blog
- nihitk's blog
- The Test Management Guide
- Testing Foundations
- Grove Consultants
- 홍환민 페이지
- Free Video Tutorials about S..
- Sustainable Development
- 해리 로빈슨의 모델 기반 테스..
- 테스팅 써커스
- Home - Erik van Veenendaal
- URL metrics
- 소프트웨어 엔지니어링
- 소프트웨어 개발
- software testing
- 소프트웨어 테스트
- Software Engineering
- 소프트웨어 관리