SlideShare a Scribd company logo
1 of 12
Download to read offline
헤드 퍼스트 OOA&D 스터디
이데아 게임즈 손진화
부록 i: 남은 것들
IS-A와 HAS-A
IS-A : 상속
창은 무기이다
HAS-A : 구성 혹은 집합
유닛은 무기를 가지고 있다
IS-A와 HAS-A
IS-A 관계가 적용될 때보다는,
한 객체가 다른 객체처럼 행동할 때
상속을 사용하세요
?
유스케이스 형식
유스케이스에 필요한 내용이 다 들어가 있다면
양식은 좀 달라도 됩니다
액터
시스템을 사용하는 외부의 존재이며 사람, 시스템, 장치가 될 수 있다
시작 조건
유스케이스의 첫번째 단계
목표
유스케이스는 항상 목표를 가지고 있어야 한다
주 경로
모든 일이 순조롭게 진행되는 시나리오
대체 경로
예외 발생 시나리오
안티 패턴
디자인 패턴
특정 타입의 문제들에 대한 입증된 해결책으로, 우리의 애플리케이션을
좀 더 이해하기 쉽고, 좀 더 유지보수 하기 쉽고, 좀 더 유연하게 구조화
하는데 도움이 됩니다
안티 패턴
문제들에 대해 빈번히 발생하는 잘못된 해결책입니다
관리자나 프로그래머가 특정 타입의 문제에 대해 지식과 경험이
부족하거나 혹은 완벽한 패턴을 잘못된 상황에 적용할 때
발생하게 됩니다
https://en.wikipedia.org/wiki/Anti-pattern#Software_engineering
CRC 카드
Class, Responsibility, Collaborator
클래스의 책임과 다른 클래스와의 협력 여부를
파악하는데 사용합니다
CRC 카드를 잘 사용하면 SRP를 구현하는데 도움이 됩니다
매트릭 Metrics
소프트웨어의 코드나 개발 프로세스를 수치화 하여 나타내는 방법
시스템 전체에 점수를 매길 순 없지만 특정 부분이 잘 되었는지
파악하는데 도움이 됩니다
Ex 결함 밀도 (1000 줄 당)
코드에서 발견된 에러의 수 / (전체 라인 수 / 1000)
Ex 추상 메트릭
A = Na / Nc
Na:특정 패키지나 모듈 내에서 추상 클래스의 개수
Nc:같은 패키지나 모듈 내에서 클래스 전체의 개수
시퀀스 다이어그램
액터와 시스템
사이에 일어나는
상호작용을
그림으로 나타낸
것입니다
객체
메시지
노트
생명선
상태 다이어그램
시스템의 다양한
상태와 상태를
변화시키는 액션을
설명합니다
시작점
끝점
전이
가드구문상태
단위 테스팅
모든 시나리오를 다 테스트 하긴 힘들기 때문에
각 기능을 따로 테스트 하는 것이 좋습니다
가급적이면 실제 환경에서 테스트를 할 수 있도록 합니다
코딩 규칙과 읽기 쉬운 코드
잘 작동한다고 그 소프트웨어가 위대한 소프트웨어인 것은
아닙니다 읽기 쉬운 코드를 작성하면 여러분 또는 다른 개발자들이
그 코드를 더 쉽게 유지보수하고 재사용 할 수 있습니다
주석 규칙을 정하자
특히 명확하지 않은 부분에는 주석을 달자
알아보기 쉬운 이름을 쓰자
리팩토링
리팩토링은 코드의 행동에 영향을 주지 않으면서
여러분 코드의 내부 구조를 변경합니다

More Related Content

More from 진화 손

C++20 Concepts library
C++20 Concepts libraryC++20 Concepts library
C++20 Concepts library진화 손
 
C++20 Coroutine
C++20 CoroutineC++20 Coroutine
C++20 Coroutine진화 손
 
C++ 20 Relaxing the range-for loop customization point finding rules
C++ 20 Relaxing the range-for loop customization point finding rulesC++ 20 Relaxing the range-for loop customization point finding rules
C++ 20 Relaxing the range-for loop customization point finding rules진화 손
 
C++ 20 Relaxing the structured bindings customization point finding rules
C++ 20 Relaxing the structured bindings customization point finding rulesC++ 20 Relaxing the structured bindings customization point finding rules
C++ 20 Relaxing the structured bindings customization point finding rules진화 손
 
C++20 explicit(bool)
C++20 explicit(bool)C++20 explicit(bool)
C++20 explicit(bool)진화 손
 
C++20 std::map::contains
C++20 std::map::containsC++20 std::map::contains
C++20 std::map::contains진화 손
 
C++20 Comparing unordered containers
C++20 Comparing unordered containersC++20 Comparing unordered containers
C++20 Comparing unordered containers진화 손
 
C++20 Attributes [[likely]] and [[unlikely]]
C++20 Attributes [[likely]] and [[unlikely]]C++20 Attributes [[likely]] and [[unlikely]]
C++20 Attributes [[likely]] and [[unlikely]]진화 손
 
C++ 20 Lambdas in unevaluated contexts
C++ 20 Lambdas in unevaluated contextsC++ 20 Lambdas in unevaluated contexts
C++ 20 Lambdas in unevaluated contexts진화 손
 
C++20 Library support for operator<=> <compare>
C++20 Library support for operator<=> <compare>C++20 Library support for operator<=> <compare>
C++20 Library support for operator<=> <compare>진화 손
 
C++20 Atomic std::shared_ptr and std::weak_ptr
C++20 Atomic std::shared_ptr and std::weak_ptrC++20 Atomic std::shared_ptr and std::weak_ptr
C++20 Atomic std::shared_ptr and std::weak_ptr진화 손
 
C++20 Default member initializers for bit-fields
C++20 Default member initializers for bit-fieldsC++20 Default member initializers for bit-fields
C++20 Default member initializers for bit-fields진화 손
 
C++ 20 constexpr for algorithm and utility
C++ 20 constexpr for  algorithm and utilityC++ 20 constexpr for  algorithm and utility
C++ 20 constexpr for algorithm and utility진화 손
 
C++17 init-statements for if and switch
C++17 init-statements for if and switchC++17 init-statements for if and switch
C++17 init-statements for if and switch진화 손
 
C++17 Aggregate classes with base classes
C++17 Aggregate classes with base classesC++17 Aggregate classes with base classes
C++17 Aggregate classes with base classes진화 손
 
C++17 std::byte
C++17 std::byteC++17 std::byte
C++17 std::byte진화 손
 
C++17 Dynamic memory allocation for over-aligned data
C++17 Dynamic memory allocation for over-aligned dataC++17 Dynamic memory allocation for over-aligned data
C++17 Dynamic memory allocation for over-aligned data진화 손
 
C++17 return type of emplace_ functions of some containers changed from void ...
C++17 return type of emplace_ functions of some containers changed from void ...C++17 return type of emplace_ functions of some containers changed from void ...
C++17 return type of emplace_ functions of some containers changed from void ...진화 손
 
C++17 [[fallthrough]] attribute
C++17 [[fallthrough]] attributeC++17 [[fallthrough]] attribute
C++17 [[fallthrough]] attribute진화 손
 

More from 진화 손 (20)

C++20 Concepts library
C++20 Concepts libraryC++20 Concepts library
C++20 Concepts library
 
C++20 Coroutine
C++20 CoroutineC++20 Coroutine
C++20 Coroutine
 
C++ 20 Relaxing the range-for loop customization point finding rules
C++ 20 Relaxing the range-for loop customization point finding rulesC++ 20 Relaxing the range-for loop customization point finding rules
C++ 20 Relaxing the range-for loop customization point finding rules
 
C++ 20 Relaxing the structured bindings customization point finding rules
C++ 20 Relaxing the structured bindings customization point finding rulesC++ 20 Relaxing the structured bindings customization point finding rules
C++ 20 Relaxing the structured bindings customization point finding rules
 
C++20 explicit(bool)
C++20 explicit(bool)C++20 explicit(bool)
C++20 explicit(bool)
 
C++20 std::map::contains
C++20 std::map::containsC++20 std::map::contains
C++20 std::map::contains
 
C++20 Comparing unordered containers
C++20 Comparing unordered containersC++20 Comparing unordered containers
C++20 Comparing unordered containers
 
C++20 Attributes [[likely]] and [[unlikely]]
C++20 Attributes [[likely]] and [[unlikely]]C++20 Attributes [[likely]] and [[unlikely]]
C++20 Attributes [[likely]] and [[unlikely]]
 
C++ 20 Lambdas in unevaluated contexts
C++ 20 Lambdas in unevaluated contextsC++ 20 Lambdas in unevaluated contexts
C++ 20 Lambdas in unevaluated contexts
 
C++20 Library support for operator<=> <compare>
C++20 Library support for operator<=> <compare>C++20 Library support for operator<=> <compare>
C++20 Library support for operator<=> <compare>
 
C++20 Atomic std::shared_ptr and std::weak_ptr
C++20 Atomic std::shared_ptr and std::weak_ptrC++20 Atomic std::shared_ptr and std::weak_ptr
C++20 Atomic std::shared_ptr and std::weak_ptr
 
C++20 Default member initializers for bit-fields
C++20 Default member initializers for bit-fieldsC++20 Default member initializers for bit-fields
C++20 Default member initializers for bit-fields
 
C++ 20 constexpr for algorithm and utility
C++ 20 constexpr for  algorithm and utilityC++ 20 constexpr for  algorithm and utility
C++ 20 constexpr for algorithm and utility
 
C++17 init-statements for if and switch
C++17 init-statements for if and switchC++17 init-statements for if and switch
C++17 init-statements for if and switch
 
C++17 Aggregate classes with base classes
C++17 Aggregate classes with base classesC++17 Aggregate classes with base classes
C++17 Aggregate classes with base classes
 
C++17 std::byte
C++17 std::byteC++17 std::byte
C++17 std::byte
 
C++17 not_fn
C++17 not_fnC++17 not_fn
C++17 not_fn
 
C++17 Dynamic memory allocation for over-aligned data
C++17 Dynamic memory allocation for over-aligned dataC++17 Dynamic memory allocation for over-aligned data
C++17 Dynamic memory allocation for over-aligned data
 
C++17 return type of emplace_ functions of some containers changed from void ...
C++17 return type of emplace_ functions of some containers changed from void ...C++17 return type of emplace_ functions of some containers changed from void ...
C++17 return type of emplace_ functions of some containers changed from void ...
 
C++17 [[fallthrough]] attribute
C++17 [[fallthrough]] attributeC++17 [[fallthrough]] attribute
C++17 [[fallthrough]] attribute
 

헤드퍼스트 객체 지향 분석 디자인 11장

  • 1. 헤드 퍼스트 OOA&D 스터디 이데아 게임즈 손진화 부록 i: 남은 것들
  • 2. IS-A와 HAS-A IS-A : 상속 창은 무기이다 HAS-A : 구성 혹은 집합 유닛은 무기를 가지고 있다
  • 3. IS-A와 HAS-A IS-A 관계가 적용될 때보다는, 한 객체가 다른 객체처럼 행동할 때 상속을 사용하세요 ?
  • 4. 유스케이스 형식 유스케이스에 필요한 내용이 다 들어가 있다면 양식은 좀 달라도 됩니다 액터 시스템을 사용하는 외부의 존재이며 사람, 시스템, 장치가 될 수 있다 시작 조건 유스케이스의 첫번째 단계 목표 유스케이스는 항상 목표를 가지고 있어야 한다 주 경로 모든 일이 순조롭게 진행되는 시나리오 대체 경로 예외 발생 시나리오
  • 5. 안티 패턴 디자인 패턴 특정 타입의 문제들에 대한 입증된 해결책으로, 우리의 애플리케이션을 좀 더 이해하기 쉽고, 좀 더 유지보수 하기 쉽고, 좀 더 유연하게 구조화 하는데 도움이 됩니다 안티 패턴 문제들에 대해 빈번히 발생하는 잘못된 해결책입니다 관리자나 프로그래머가 특정 타입의 문제에 대해 지식과 경험이 부족하거나 혹은 완벽한 패턴을 잘못된 상황에 적용할 때 발생하게 됩니다 https://en.wikipedia.org/wiki/Anti-pattern#Software_engineering
  • 6. CRC 카드 Class, Responsibility, Collaborator 클래스의 책임과 다른 클래스와의 협력 여부를 파악하는데 사용합니다 CRC 카드를 잘 사용하면 SRP를 구현하는데 도움이 됩니다
  • 7. 매트릭 Metrics 소프트웨어의 코드나 개발 프로세스를 수치화 하여 나타내는 방법 시스템 전체에 점수를 매길 순 없지만 특정 부분이 잘 되었는지 파악하는데 도움이 됩니다 Ex 결함 밀도 (1000 줄 당) 코드에서 발견된 에러의 수 / (전체 라인 수 / 1000) Ex 추상 메트릭 A = Na / Nc Na:특정 패키지나 모듈 내에서 추상 클래스의 개수 Nc:같은 패키지나 모듈 내에서 클래스 전체의 개수
  • 8. 시퀀스 다이어그램 액터와 시스템 사이에 일어나는 상호작용을 그림으로 나타낸 것입니다 객체 메시지 노트 생명선
  • 9. 상태 다이어그램 시스템의 다양한 상태와 상태를 변화시키는 액션을 설명합니다 시작점 끝점 전이 가드구문상태
  • 10. 단위 테스팅 모든 시나리오를 다 테스트 하긴 힘들기 때문에 각 기능을 따로 테스트 하는 것이 좋습니다 가급적이면 실제 환경에서 테스트를 할 수 있도록 합니다
  • 11. 코딩 규칙과 읽기 쉬운 코드 잘 작동한다고 그 소프트웨어가 위대한 소프트웨어인 것은 아닙니다 읽기 쉬운 코드를 작성하면 여러분 또는 다른 개발자들이 그 코드를 더 쉽게 유지보수하고 재사용 할 수 있습니다 주석 규칙을 정하자 특히 명확하지 않은 부분에는 주석을 달자 알아보기 쉬운 이름을 쓰자
  • 12. 리팩토링 리팩토링은 코드의 행동에 영향을 주지 않으면서 여러분 코드의 내부 구조를 변경합니다