This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Qualitiy of OO

 
Brian Smith
Ranch Hand
Posts: 232
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Folks,
Could someone expand and clarify this statement
One of the great qualities of object-oriented development is that you can vary the interfaces of classes independent of the implementation. [ UML Distilled, Fowler]

I thought its the other way around coz you can vary the implemenation as per the requirements while keeping the interfaces intact. could someone please help me understand this statement? thanks.
-Tulsi
 
Marlene Miller
Ranch Hand
Posts: 1392
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tulsi,

I found the sentence you quoted in UML Distilled 2nd edition, chapter 6, section Interfaces and Abstract Classes. In UML Distilled 3rd edition, chapter 5, section Interfaces and Abstract Classes, the section has been entirely rewritten. That sentence no longer exists. There is a paragraph about programming to an interface so that the implementation can be changed.

Regards, Marlene
 
Brian Smith
Ranch Hand
Posts: 232
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Marlene. but don't you think the statement is a bit odd? any comments?
 
Marlene Miller
Ranch Hand
Posts: 1392
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
�you can vary the interfaces of classes independent of the implementation�

Hi Tulsi, Yes, I think the statement is odd. The converse (one interface, vary the implementation) is the usual way to think about using interfaces.

What does vary x independent of y mean? z = f(x, y). Hold y fixed and change x. Given an implementation, vary the interface without changing the implementation.

interface X { void f(); }
interface Y { void g(); }

class C implements X, Y {
public void f() { /*code*/ }
public void g() { /*code*/ }
}

--------

�Programming languages uses a single construct, the class, which contains both interface and implementation.�

This sounds like C++. C++ does not have an �interface� construct. "interface" has several different casual meanings. Classes that have things regarded as �interface� might contain data and functions that are implemented.

�Using the interface as a separate construct is rarely used, which is a shame.�

/Maybe/ Martin Fowler is thinking about C++. /Maybe/ when he said vary the interfaces, he meant, in C++ separate into different classes the things regarded as interface from the things regarded as implementation.

-------

I once asked the C++ folks what interface means to them:
comp.lang.c++.moderated Somewhere in that discussion is a list of various things interface means.
[ December 28, 2004: Message edited by: Marlene Miller ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic