-
UML 관계 종류Programming/패턴 2020. 9. 22. 13:55
UML에서 의존, 일반화, 실체화, 집합, 합성 관계를 구성하고 있다. 의존 관계 Class A (Car_A) 의 함수가 Class B (GPmp_B) 의 함수를 호출하거나 인자로 받는 등에 사용될 때, 집합 관계를 이룬다고 한다. public class Car_A { // ... public void Person_A(GPmp_B gp) { gp.charge(); } } public class GPmp_B { // ... public void charge() { // ... } } 연관 관계 클래스들이 연결되어 있고 한 클래스 ( Person_A ) 가 다른 클래스 ( Car_B ) 에서 제공하는 기능을 사용하는 상황일 때 표시. 의존 관계와 좀 비슷한 것 같지만, Person_A는 Car_B Car; ..
-
객체 생성 : 빌더 패턴 ( Builder Pattern )Programming/패턴 2020. 9. 22. 01:58
GOF의 디자인 패턴 중 빌더 패던에 관한 내용. 정의 복잡한 객체의 생성 과정과 표현 방법을 분리하여 동일한 생성 절차에서 서로 다른 표현 결과를 만들 수 있게 하는 패턴 구조 Builder : 추상 인터페이스를 정의 ConcreteBuilder : 인터페이스들을 구현하며 각 부품을 모아서 결과로 정의하고 관리한다. Director : 인터페이스를 사용하는 객체를 합성. Product : 복합적인 객체를 표현함. 예제코드 ( 위키참고 ) #include // Product.. class Pizza { private: std::string dough; std::string sauce; std::string topping; public: Pizza(); ~Pizza(); void SetDough(const..
-
데이터 구성 : Replace Array with ObjectProgramming/리팩토링 2020. 9. 10. 22:30
참고자료 https://refactoring.guru/replace-array-with-object Replace Array with Object Tired of reading? No wonder, it takes 7 hours to read all of the text we have here. Try our interactive course on refactoring. It offers a less tedious approach to learning new stuff. Let's see... refactoring.guru 정의 배열의 특정 요소가 다른 뜻을 가지고 있다면, 배열을 각각의 요소에 대한 필드를 가지는 객체로 바꾼다. 예시 String[] row = new String[3]; row[0] =..
-
데이터 구성 : Change Value to Reference, Change Reference to ValueProgramming/리팩토링 2020. 9. 7. 16:04
참고자료 https://refactoring.guru/change-value-to-reference Change Value to Reference Tired of reading? No wonder, it takes 7 hours to read all of the text we have here. Try our interactive course on refactoring. It offers a less tedious approach to learning new stuff. Let's see... refactoring.guru https://refactoring.guru/change-reference-to-value Change Reference to Value Tired of reading? No wond..
-
[PHP] 표준 권고 ( PSR )Programming/프로그래밍 2020. 9. 7. 01:05
- PSR-FIG 이것은 규칙, 규정안이 아니지만 사실상의 표준을 제정하는 것. 하지만, 개발자의 편안함을 위해 고안되었으며 코드의 가독성에 대해 얘기를 한다. - 오토로딩 PHP 프레임워크는 오토로딩을 통해 함께 작동한다. 모던 PHP의 컴포넌트와 포레임워크 대부분이 공통 오토로더를 준수한다. - 코드 스타일 ▶PSR - 0 : Autoloading Standard ( 사실상, 중단 ) autoloader 를 통해 클래스를 손쉽게 로딩할 수 있도록 하는 표준. PSR-4가 제정되면서 무효화. PSR-4는 PHP-5.4 이상에서 사용가능. ▶ PSR - 1 : Basic Coding Standard - 네임스페이스와 클래스는 오토로딩 표준 ( PSR-0, PSR-4 )를 따름. - PHP 파일은 BOM ..
-
데이터 구성 : Replace Data Value with ObjectProgramming/리팩토링 2020. 9. 7. 00:38
참고자료 https://refactoring.guru/replace-data-value-with-object Replace Data Value with Object Tired of reading? No wonder, it takes 7 hours to read all of the text we have here. Try our interactive course on refactoring. It offers a less tedious approach to learning new stuff. Let's see... refactoring.guru 정의 클래스의 필드에 정의된 변수가 데이터나 동작을 필요로 하는 것이라면 새로운 클래스를 만들어 변수나 동작들을 만든 후, 클래스의 객체를 원래 클래스에 배치를 한다..
-
데이터 구성 : Self Encapsulate FieldProgramming/리팩토링 2020. 9. 6. 21:15
참고자료 https://refactoring.guru/self-encapsulate-field Self Encapsulate Field Tired of reading? No wonder, it takes 7 hours to read all of the text we have here. Try our interactive course on refactoring. It offers a less tedious approach to learning new stuff. Let's see... refactoring.guru 정의 클래스의 필드에서 private에 직접 접근하는 방법이 문제가 될 수 있으니, get/set 함수를 만들어서 함수를 통한 필드에 접근을 할 수 있게 만드는 기법. 예시 class Range..
-
객체 간 기능 이동 : Introduce Foreign Method, Introduce Local ExtensionProgramming/리팩토링 2020. 9. 6. 20:20
참고자료 http://refactoring.guru/introduce-foreign-method Introduce Foreign Method Tired of reading? No wonder, it takes 7 hours to read all of the text we have here. Try our interactive course on refactoring. It offers a less tedious approach to learning new stuff. Let's see... refactoring.guru https://refactoring.guru/introduce-local-extension Introduce Local Extension Tired of reading? No wonder,..