English
[1Day-1CS] Factory Pattern, Strategy Pattern, and Observer Pattern

[1Day-1CS] Factory Pattern, Strategy Pattern, and Observer Pattern

A Brief Summary of the Singleton Pattern, Factory Pattern, Strategy Pattern, and Observer Pattern

Factory Pattern

  • A pattern that abstracts the object creation process from the code that uses the objects

  • The superclass determines the essential framework

  • The subclass determines the specific details of object creation

Characteristics and Advantages of the Factory Pattern

Achieves loose coupling through class separation Ensures flexibility in the superclass and improves maintainability

Strategy Pattern

  • Do not modify the object directly if you do not want to change its behavior

  • Designed to allow replacement by changing the encapsulated algorithm corresponding to the strategy within the context

Context

  • Refers to the relevant information required for a developer to complete a task

  • There exists a mandatory context essential for an action to occur, as well as an optional context for the effective execution of the action.

Observer Pattern

  • A subject observes state changes in a specific object

  • When a state change occurs, the subject notifies observers of the change via methods, etc.

  • Sometimes built based on mutable objects rather than separating the subject and the object

  • Also utilized in the MVC pattern

댓글 작성

게시글에 대한 의견을 남겨 주세요.

댓글 0