===================================<br />Fear not, God know the best.<br />SCJP2 91%<br />SCWCD 89%<br />SCJD2 92% (143/155 pts)<br />SCEA Part I (89%)
===================================<br />Fear not, God know the best.<br />SCJP2 91%<br />SCWCD 89%<br />SCJD2 92% (143/155 pts)<br />SCEA Part I (89%)
Originally posted by Alexander Yanuar Koentjara:
From design pattern book, I found that Bridge's goal is to separate the interface of class with its implementations (which may do different business logic).
The question is: what is the different between Bridge and interface in java?
Ciao,<br />Alberto
Originally posted by Alberto Dell'Era:
By "Interface" they don't mean the Java interface, since DPs are language-agnostic and they don't care if you use Java, C++, Eiffel ...
In the Bridge DP they don't use the term "Interface " but "Abstraction" instead:
"The Bridge Pattern separates the Abstraction from the Implementation ..."
The Abstraction of Bridge is actually a hierarchy of classes (not a single class) and the Implementation is another hierarchy of classes; the two are connected through a reference from the root class of Interface to the root class of Implementation. When you draw it on paper it resembles a bridge (hence the name, even if other interpretation is possible, of course).
(Please note that this is just one of a number of possible "prototypycal" arrangement of classes).
There's a wonderful dissertation about the Bridge DP on "Design Patterns Explained" by Alan Shalloway, a wonderful book, not only on DP but on OOA/OOP in general.
===================================<br />Fear not, God know the best.<br />SCJP2 91%<br />SCWCD 89%<br />SCJD2 92% (143/155 pts)<br />SCEA Part I (89%)
Originally posted by deneb shah:
I guess the usability of the object guides what pattern is it and not just the mere appreances...
You will be an architect soon... be rationale
===================================<br />Fear not, God know the best.<br />SCJP2 91%<br />SCWCD 89%<br />SCJD2 92% (143/155 pts)<br />SCEA Part I (89%)
Originally posted by Alexander Yanuar Koentjara:
Hmm... I just stated the equality of interface (in java) and Bridge. And, I'm still thinking that the design pattern used in "java language's interface" is Bridge..
Yup, you're taking from different book.. I got the references in PDF file: Design Pattern (Java Companion) by James W. Cooper. He uses the term "interface" instead
Correct me if I am wrong, in JDBC the root interface is the Driver and the hierarcy you mentioned are Resultset, Connection, Statement, etc. Now I get a clearer picture. Thanks very much!
But then, if there is currently only one possible implementations for the root interface and the hierarchy, that become a Facade design pattern!!
Ciao,<br />Alberto
Your buns are mine! But you can have this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|