From: Marcel K Haesok
Subject: Design Patterns.
Date: 
Message-ID: <36FBC76C.7495E9FA@earthlink.net>
Reposting, after a mistake:

Hi,
        I was reading the following passage in the book:
        1. Program to an interface, not to an implementation.
                Don't declare variables to be instances of particular
concrete
classes. Instead, commit only to an interface defined by an abstract
class. You will                                                 find
this to be a common theme of the design
patterns in this book.

        And I said to myself, holy Moses, what a radical statement!
        But then I realized that as ideal and radical as it may sound,
if I
followed that advice, the program will be totally flexible and reusable.

What I would                            love to hear from experienced
developers are two
things:

        1. How 'practical' is this advice? Is this sort of radical
approach
'actually' practiced?
        2. If 'interface' is preferrable to 'inheritance' in oo design,
wouldn't it follow that Java is much superior to C++? In the sense that
using interface is so                                           much
easier in Java than in C++?

        Thanks. Marcel

From: zues
Subject: Re: Design Patterns.
Date: 
Message-ID: <36fbddaf.0@10.1.8.21>
1) This is noting new. god even people at microsoft have figure that out.
stuff like COM, ODBC and just about any big C++ program do that.

2) NO, interface is nothing more than pure abstract class that has no
implementations. as in.

[JAVA:]
//by the way if you ever read anything from the evil  empire chances are
that you will find classes that start with I, like IUnknown,
IQueryInterface, IBill

interface IFoo
{
    public int foo1();
    public char foo2();
}

class FooImp implements IFoo ...

[C++]
class IFoo
{
    virtual public int foo1() = 0;   // = 0 pure virtual
    virtual public char foo2() =0;
}
class FooImp : public IFoo....
looks the same to me. different syntax but that about it. This stuff has
been around for a while.
>And I said to myself, holy Moses, what a radical statement!
The whole ActiveX, COM+, Java event handling  (to name few)are build on that
idea...so I don't know about Moses being holy(that would be a matter for
discusion) but as far as interface goes, its as old as moses, would have
been today.


Marcel K Haesok wrote in message <·················@earthlink.net>...
>Reposting, after a mistake:
>
>Hi,
>        I was reading the following passage in the book:
>        1. Program to an interface, not to an implementation.
>                Don't declare variables to be instances of particular
>concrete
>classes. Instead, commit only to an interface defined by an abstract
>class. You will                                                 find
>this to be a common theme of the design
>patterns in this book.
>
>        And I said to myself, holy Moses, what a radical statement!
>        But then I realized that as ideal and radical as it may sound,
>if I
>followed that advice, the program will be totally flexible and reusable.
>
>What I would                            love to hear from experienced
>developers are two
>things:
>
>        1. How 'practical' is this advice? Is this sort of radical
>approach
>'actually' practiced?
>        2. If 'interface' is preferrable to 'inheritance' in oo design,
>wouldn't it follow that Java is much superior to C++? In the sense that
>using interface is so                                           much
>easier in Java than in C++?
>
>        Thanks. Marcel
>
>
From: Vassil Nikolov
Subject: Re: Design Patterns.
Date: 
Message-ID: <7dgrvo$e0m$1@nnrp1.dejanews.com>
In article <·················@earthlink.net>,
  Marcel K Haesok <······@earthlink.net> wrote:
(...)
>         2. If 'interface' is preferrable to 'inheritance' in oo design,
> wouldn't it follow that Java is much superior to C++? In the sense that
> using interface is so                                           much
> easier in Java than in C++?

Yes.  In the same way as `if real numbers are preferrable to imaginary
numbers in numeric design, then C is much superior to FORTRAN,' sort
of.

Not crossposting to the Java and Smalltalk groups (they won't miss it).

Vassil Nikolov <········@poboxes.com> www.poboxes.com/vnikolov
(You may want to cc your posting to me if I _have_ to see it.)
   LEGEMANVALEMFVTVTVM  (Ancient Roman programmers' adage.)

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own