본문 바로가기

SW 공부41

[디자인패턴] Iterator pattern (반복자 패턴) Purpose of Iterator Pattern (반복자 패턴의 목적) aka) Cursor - Allows for access to the elements of an aggregate object without allowing access to its underlying representation. - 외부에 노출 없이, 자료형 관계없이, collection에서 객체를 꺼낼 때 사용 Design Principle (디자인원칙) - Single Responsibility Principle (단일 책임의 원칙) - A class should have only one reason to change * Aggregate and Iteration – two different responsibilities * .. 2022. 8. 28.
[디자인패턴] Template method pattern (템플릿 메소드 패턴) Purpose of Template method Pattern (템플릿 메소드 패턴의 목적) - Identifies the framework of an algorithm, allowing implementing classes to define the actual behavior. - 실제 동작을 정의하기 위해 클래스를 구현할 수 있도록 알고리즘의 프레임워크 구성하는 데 사용 Design Principle (디자인원칙) - Hollywood Principle : Don't call us, we'll call you - High level component --call--> low-level component → "프레임워크(framework)에서 흔히 적용되는 설계원칙으로, 저수준(low-level) 구성.. 2022. 8. 28.
[디자인패턴] Observer Pattern(옵저버 패턴) Purpose of Observer Pattern ( 옵저버 패턴의 목적) aka) Publish / Subscribe model - Lets one or more objects be notified of state changes in other objects within the system. - 하나 이상의 개체에 시스템 내의 다른 개체의 상태 변경을 알리기 위해서 Design Principle (디자인원칙) - loose coupling (서로 거의 모름) Observer Pattern (옵저버 패턴) - The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, a.. 2022. 8. 27.
[디자인패턴] Strategy Pattern(전략패턴) Purpose of Strategy Pattern (전략패턴의 목적) - Defines a set of encapsulated algorithms that can be swapped to carry out a specific behavior. - 특정 동작을 수행하기 위해 스왑 할 수 있는 캡슐화된 알고리즘 집합을 정의 Design Principle (디자인원칙) ① Encapsulate what varies : 변화하는 부분을 분리해서 캡슐화 ② Program to an interface, not an implementation : variation을 커버할 수 있는 인터페이스를 만듦 → runtime에 concrete implemantation을 assign 해서 사용! ③ Favor composit.. 2022. 8. 27.
GRASP (GENERAL RESPONSIBILITY ASSIGNMENT SOFTWARE PATTERNS) GRASP Principles General Responsibility Assignment Software Patterns - Craig Larman의 9가지 원칙 - will guide you how to assign responsibilities (객체들간의 계약 - 알아야 하는 것 /해야 하는 것) to collaborating objects - 어떤 책임을 지게하나,'어떻게?'의 답을 제공하는 설계 원칙 ① Creator Pattern - 여러 class 후보 중, 누가 create 할 것인가! - prefer “B contains or aggregates A” (A집합의 형태) - prefer B records A, B closely uses A, B has the initializing dat.. 2022. 8. 24.
SOLID PRINCIPLES Hierarchy of Pattern Knowledge 패턴 지식의 계층화 - Design Pattern은 OO Principle (설계 원칙을 따른 것)이고, 그 OO Basic(기본) 개념이 아래에 있다. 예시) Design smells - various signs and symptoms of bad design (디자인 불량 징후 및 증상) - Rigidity(경직성), Fragility(취약성), Immobility(부동성), Viscosity(점착성), Needless Complexity (불필요한 복잡성), Needless Repetition (불필요한 반복), Opacity(불투명성) - Design smells are resulted from mismanaged dependencies (s.. 2022. 8. 23.
OBJECT-ORIENTED PARADIGM Object-Oriented Paradigm 객체 지향 패러다임 Class = ADT + Inheritance + Polymorphis Abstract Data Type (ADT) - Encapsulation of data and related operations into a single syntactic unit - 하나의 문법적 요소 안에 data나 관련 작업을 캡슐화 Inheritance - 상속 - When class Y inherits from class X, We can use the instance of Y wherever the instance of type X is expected - 클래스 Y가 클래스 X에서 상속될 때, 우리는 type X의 인스턴스가 예상되는 모든 곳에서 Y의 인스턴.. 2022. 8. 23.
디자인패턴 공부를 시작하며 /GoF 디자인패턴 What is pattern? 패턴이란 무엇인가? - "A solution to a problem in a context” - "문맥상의 문제에 대한 해결책" Why do we use patterns? 우리는 왜 패턴을 사용하는가? - Designing reusable object-oriented software - 재사용 가능한 객체 지향 소프트웨어 설계하기 위해 - Communication language - 본인이 전달하고자 하는 내용을 간결하게 전달하는 언어적 기능 Category of GoF Patterns - Gangof 4의 23가지 패턴은 3가지 범주로 분류 Creational (생성) Address problems of creating an object in a flexible way S.. 2022. 8. 23.
[List 자료구조] Array List, Linked List List : 순서를 가진 데이터의 집합을 가리키는 추상자료형 (abstract data type) 1) List의 특성 1. 동일한 데이터를 가지고 있어도 상관 없음 2. 구현 방법에 따라 크게 두 가지로 나뉨 * 순차 List : 배열을 기반으로 구현된 List * 연결 List : 메모리의 동적할당을 기반으로 구현된 List 2) List의 주요 함수 addtoFirst() : List의 앞쪽에 원소를 추가하는 연산 addtoLast() : List의 뒤쪽에 원소를 추가하는 연산 add() : List의 특정 위치에 원소를 추가하는 연산 delete() : List의 특정 위치에 원소를 삭제하는 연산 get() : List의 특정 위치에 있는 원소를 리턴하는 연산 3) 순차 List (Array Li.. 2021. 4. 23.