Final Part A Flashcards
First 6 components of well-documented design pattern
- pattern name
- intent
- other names
- motivation
- applicability
- structure
Second 7 components of well-documented design pattern
- participants
- collaboration
- consequences
- implementation
- sample code
- known uses
- related patterns
definition of design pattern
a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into source or machine code. It is a description or template for how to solve a problem that can be used in many different situations. Patterns are formalized best practices that the programmer can use to solve common problems when designing an application or system. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved.
What are creational design patterns?
pattern that deal with object creation mechanisms
What are structural design patterns?
patterns that ease design by identifying ways to realize relationships among entities
What is a behavioral design patterns?
design patterns that identify common communication patterns among objects
what are data clumps
when different parts of the code contain identical groups of variables
what is primitive obsession
use of primitives instead of objects
bad smell: switch statements
overly complex switch statements
bad smell: temporary field
a field that gets its values only under circumstances and is otherwise empty
bad smell: refused bequest
a subclass only uses some of the methods from its parent
bad smell: alternative classes with different interfaces
two classes perform identical functions but have different method names
bad smell: divergent change
when you change a class you have to make changes to many unrelated methods
bad smell: shotgun surgery
making any modifications requires that you make many small changes to many different classes
bad smell: parallel inheritance hierarchies
whenever you create a subclass for a class, you find yourself needing to create a subclass for another class