Re: Programming to an Interface



On 2006-05-13 16:23:01 -0500, ram@xxxxxxxxxxxxxxxxxx (Stefan Ram) said:

"H. S. Lahman" <h.lahman@xxxxxxxxxxx> writes:
I think the point here is that one designs the interface first
and then the implementation.

I also think so. Therefore, I was astonished when I read a
printing of »Applying UML and Patterns«, where Craig Larman,
when designing a class first decided which fields are needed
and then which methods.

By »interface first«, I would first decide about the interface
(i.e., which operations should be supported by the object),
then I would ask how to implement them (which includes to
decide which fields [instance variables] are needed).

I agree with the spirit of this idea. Designing interfaces first is a great goal. However, it can only be approached asymptotically. Sometimes we design classes because we know what data they hold, and then we think about their behavior. This is just human nature; and part of the creative process. In such cases the discovery of interfaces can come late rather than early.


--
Robert C. Martin (Uncle Bob)  | email: unclebob@xxxxxxxxxxxxxxxx
Object Mentor Inc.            | blog:  www.butunclebob.com
The Agile Transition Experts  | web:   www.objectmentor.com
800-338-6716                  |



.



Relevant Pages

  • Re: Hardware to test (FPGA-based) prototype?
    ... There's not much good designing a highly testable board that doesn't ... synchronous interfaces are very ... >test high-speed cards and interfaces? ... You could try to obtain a used DAS9200 or TLA510 system with a pattern ...
    (comp.arch.embedded)
  • Re: Interface-based programming
    ... By creating interfaces and publicizing it to your clients, ... When designing your own components, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Interface-based programming
    ... I am an advocate of interfaces an encourage their ... > I've been reading Juval Löwys "Programming .NET Components", ... > Juval Löwy is indeed an advocate of using interface-based programming ... When designing your own components, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Interface-based programming
    ... After having read most of Juval's book, I constantly tumble ... Today the tumble was across a blog entry that compares interfaces and ... Regards, ... When designing your own components, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Computer programmers habits in electronics
    ... >> When I kept using block diagramming she got pissed at me and started ... > language tailored to designing object-oriented software applications. ... UML is yet-another-attempt at turning a task that is hard to understand and ... > Wescott Design Services ...
    (sci.electronics.design)