Lesson 6 Flashcards
“Design is not just how it
looks and feels like.
Design is how it works”
Steve Jobs
Design is the ______ of an experience.
creation
It’s also the _______ of the said creation and how well it’s
organized.
process
On top of that, design is the _____, i.e. the things we see,
hear, and feel.
result
There is no definite meaning for design, but to summarize
it, Design is a ______________ in such a way as
best to ___________________
plan for arranging elements, accomplish a particular purpose
are typical solutions to
commonly occurring problems in software
design.
Design patterns
They are like _____________ that you
can customize to solve a recurring design
problem in your code.
pre-made blueprints
The pattern is not a specific piece of code,
but a __________ for solving a
particular problem.
general concept
_________ is a cooking recipe, where each
step is required to achieve a goal.
Algorithm
always defines a clear
set of actions that can achieve some goal,
Algorithm
is a more high-level description of a
solution.
pattern
Design pattern is a _______, where the
results are visible, but the implementation is
up to you.
blueprint
of the pattern briefly describes both the problem and
the solution.
Intent
further explains the problem and the solution the
pattern makes possible.
Motivation
of classes shows each part of the pattern and how
they are related.
Structure
in one of the popular programming languages
makes it easier to grasp the idea behind the pattern.
Code example
The most universal and high-level patterns are
_______________. Developers can
implement these patterns in virtually any
language.
architectural patterns
The most basic and low-level patterns are
often called ______. They usually apply only to
a single programming language.
idioms
provide object creation mechanisms that
increase flexibility and reuse of existing code.
Creational patterns
explain how to assemble objects and classes into
larger structures, while keeping the structures flexible and efficient.
Structural patterns
take care of effective communication and the
assignment of responsibilities between objects
Behavioral patterns
aren’t obscure, sophisticated concepts—quite
the opposite.
Design patterns
are typical solutions to common problems in object-
oriented design.
Patterns
The concept of patterns was first described by
Christopher Alexander in A Pattern Language:
Towns, Buildings, Construction.
The book describes a ________________. The units of this
language are patterns.
“language” for designing
the urban environment
The idea was picked up by four authors:
Erich
Gamma, John Vlissides, Ralph Johnson, and
Richard Helm
In 1995, they published _______________________, in which
they applied the concept of design patterns to
programming.
Design Patterns: Elements
of Reusable Object-Oriented Software
Due to its lengthy name, people started to call it
________________ which was soon
shortened to simply __________.
“the book by the gang of four” “the GOF book”.
Design patterns are a toolkit of _____________ solutions to
common problems in software design.
tried and tested
SOLID is a mnemonic for _____________ intended to make
software designs more understandable, flexible and maintainable.
five design principles
___________ introduced them in the book Agile Software
Development, Principles, Patterns, and Practices
Robert Martin
Using these principles mindlessly __________________.
The cost of applying these principles into a program’s architecture
can cause more harm than good.
A class should have just one reason to change.
Try to make every class responsible for a single part of the
functionality provided by the software, and make that
responsibility entirely encapsulated by (or hidden within) the
class.
The main goal of this principle is reducing complexity
The real problems emerge when your program constantly
grows and changes. At some point classes become so big that
you can no longer remember their details.
Single Responsibility Principle
Classes should be open for extension but closed for
modification.
The main idea of this principle is to keep existing code
from breaking when implementing new features.
A class is open if you can extend it, produce a subclass
and do whatever you want with it—add new methods
or fields, override base behavior, etc.
A class is closed (or complete) if it’s 100% ready to be
used by other classes—its interface is clearly defined
and won’t be changed in the future.
Open/Closed Principle
When extending a class, remember that you should be able to
pass objects of the subclass in place of objects of the parent class
without breaking the client code.
This principle is named by Barbara Liskov, who defined it in 1987 in
her work Data abstraction and hierarchy
Liskov Substitution Principle
Clients shouldn’t be forced to depend on
methods they do not use.
Try to make your interfaces narrow enough
that client classes don’t have to implement
behaviors they don’t need.
Interface Segregation Principle
● High-level classes shouldn’t depend on low-level classes. Both
should depend on abstractions.
● Abstractions shouldn’t depend on details. Details should
depend on abstractions.
Dependency Inversion Principle
implement basic operations
such as working with a disk, transferring data over
a network, connecting to a database, etc.
Low-level classes
contain complex business logic
that directs low-level classes to do something.
High-level classes