ZeroPage / team6-titan-2015

Software Engineering Term Project on 2015 in CAU. CHECK LICENSE BEFORE USE IT.
MIT License
0 stars 0 forks source link

Fatory Interface for Tree <=> DOM #7

Closed RKTP closed 9 years ago

RKTP commented 9 years ago

This will be factory interface that returns DefaultMutableTreeNode or Document(DOM interface) instance.

Here's two way of implementing it...

  1. The class has 2 interfaces that transforms one to another(which is current structure design)
  2. The class has 2 interfaces that returns real builder class that transforms one to another, and their will be 2 builder class that performs transformation. ex) DocumentBuilderFactory xmlFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder xmlBuilder = xmlFactory.newDocumentBuilder(); this.doc = xmlBuilder.parse(this.sourceFile);

Actually, I don't see any reason why the DOM interfaces are designed in 2nd way.

What do you guys think about this problem?

RKTP commented 9 years ago

써놓고 보니 영어라서 불친절할까봐 다시 한글로. 현재 커밋한걸 보면 얼추 알거라고 생각하지만 DOM document 와 DefaultMutualTreeNode 사이 간의 호환을 위한 팩토리 인터페이스를 구현하고자 올려놓았음.

지금 구조는 그냥 해당 인터페이스가 양쪽 흐름에 하나씩 인터페이스를 들고 있는 단순한 구조임.

내가 의문을 가진 점은 현재 자바 라이브러리로 제공하는 팩토리 클래스가 별개로 구현된 Builder 인터페이스의 인스턴스를 만들어주는 역할일 뿐, 직접 Builder 메소드를 들고 있지 않다는 점임.(물론 팩토리 패턴이라는 게 인터페이스 뱉어주는게 목적이긴 하지만, 현재 구조도 Document랑 TreeNode 인스턴스 던져주니까 어찌어찌 납득은 됨)

어떤 구현 방식이 설계적으로 더 우수하다고들 생각하는지 의견을 듣고 싶음.

SkywaveTM commented 9 years ago

지금 상태로는 딱히 객체화가 중요한게 아니다보니 그냥 메서드 둘 다 static method로 만들어도 상관없다 생각.

anyongho commented 9 years ago

던져주기만 해도 괜찮을것 같음