<UML Chapter 1, Head first OOAD chapter 5>
No inheritance instead favor composition(aka aggregation)
1. What is difference between
-Abstract classes, Interfaces?
abstract class- italic으로 표시, interface-<<interface>>로 표시된다.
public abstract class A, public interface Interface
abstract는 클래스입니다. 메소드(함수) 바디가 구현 되어 질수 있구요 단 10개의 메소드중 1개 이상은 abstract 메소드여야 합니다. 이전에는 쓰임새가 많지 않았는데, 개발환경이 프레임웍화되어가면서 상위 클래스들이 주로 abstract로 많이 구현되어 있습니다. 개발자들이 상속받아 만드는 클래스들이 그 놈을 구체화 (abstarct = 추상화) 시키는 역할을 하구요. interface는 클래스가 아닙니다. 모든 메소드가 prototype만 정의되어 있습니다. 자바는 클래스는 단일상속만이, 인터페이스는 다중상속이 됩니다. 이는 EJB 개발시 remote interface, business interface 다중상속으로 흔히 볼 수 있습니다. |
extends, implements
2. What is difference between
-Composition, Aggregation?
Composition의 표기법 또한 위와 같이 Aggregation과 비슷하지만 다이아몬드의 내부가 채워져 있다는 점만 다릅니다. 그럼 Composition의 개념과 코드에서는 Aggregation과 어떤 차이가 있는지 보겠습니다. Composition은 Aggregation보다 강한 집합이라고 했습니다. 여기서 강한 집합이란 part가 whole에 종속적이어서 part가 whole의 소유입니다. 반면 Aggregation은 part가 whole에 대해 독립적이어서 whole이 part를 빌려 쓰는 것과 비슷합니다. 이러한 의미 때문에 Aggregation과는 다르게 명확하게 나타나는 점이 있습니다
http://www.nextree.co.kr/p6753/ 펌
Flexibility: Use me so that your software can change and grow without constant rework. I keep your application from being fragile.
Encapsulation: You use me to keep the parts of your code that stay the same separate from the parts that change; then its really easy to make changes to your code without breaking everything
Functionality: Without me, you will never actually make the customer happy. No matter how well-designed your application is, I'm the thing that puts a smile on the customer's face.
Design pattern: I'm all about reuse and making sure you're not trying to solve a problem that someone else has already figured out.
229쪽 (head first OOAD 연습)
'Object Oriented Design with Java' 카테고리의 다른 글
렉쳐 3 리뷰 (0) | 2015.11.08 |
---|---|
클래스 다이어그램 설명 펌 (0) | 2015.11.08 |
Refactor 뜻 (0) | 2015.11.08 |
렉쳐 1 리뷰 (0) | 2015.11.08 |
Hacked mean (0) | 2015.11.08 |