본문 바로가기
Computer Science

Design Pattern (1)

by OKOK 2021. 7. 28.

Hierachy of Pattern Kenowledge

  • Design Pattern
    - Strategy pattern : defines a family of algorithms, encapsulates each one, and makes them interchangeeable. Strategy lets the algorithm vary independetly from clients using it.
  • OP Principles
    - Enacapsulate what varies
    - Favor composition over inheirtance
    - Program to interface, not implementations
  • OO Basics
    - Abstraction, Encapsulation, Polymorphism, Inheritance

 

Abstraction

  • Hiding details
    - for the purpose of ismplifying and managing the design of complex software.
  • Allows to separate categories and concepts related to problems frm specifi c instances of implementation

 

Information hiding and Encapsulation

  • Design principles for hiding internal design decisions related to the selected algorithm and data structures of a module from the outside world.
    - the internal design decisions are most likely to change
    - Thus, reduce the side effects of any future maintenance or modification of the design and hence minimizing the effect on the other modules in the design.
  • Information hiding : Encapsulation = Principle : Technique
    Encapsulation in Template Method Pattern

 

 

Separation of Concerns (SoC)

  • Design principle for separating a computer program into distinct sections, such that each esction addresses a separate concern.
  • A concern is a set of information that affects the code of a computer program.
  • Can be traced back to "divide and conquer"
  • A program that embodies SoC well is called modular.
  • Modularity, and hence separation of concerns, is achived by encapsulating information inside a section of code that has a well-defined interface.

 

Interfaces

  • Interfaces are the points of accesses through which modules or systems communicate.
  • Each abstraction should possess a well defined interface clearly describing the expected inputs to and outputs from the abstraction.
  • If the objects are fully encapsulated then the interface will describe the only way in which obejcts may be accessed by other objects.

 

Modularity

  • Goal of design
    - partition the system into moudles and assign reponsibility among the components.
  • Modularity reduces the toal complexity a programmer has to deal with at any one time.

 

 

Measuring Modularity

  • Coupling is a measure of the dependencies between modules.
  • Cohesion is ameasure of how strongly the elements in a module are  related.
  • Strong  cohesion will reduce relations between modules.

'Computer Science' 카테고리의 다른 글

Design Pattern - Strategy Pattern  (0) 2021.07.29
Design Pattern (2)  (0) 2021.07.28
Object-Oriented Analysis Design (7)  (0) 2021.07.28
Object-Oriented Analysis Design (6)  (0) 2021.07.27
Object-Oriented Analysis Design (5) 2030. Analyze  (0) 2021.07.27

댓글