SW-Design / Modules vs. Objects/Classes (Re: Adaptor-Pattern mit Ocaml's Module System (Re: [linux-l] Ocml vs. Java))

Oliver Bandel oliver at first.in-berlin.de
Sa Okt 22 23:52:03 CEST 2005


Hi,

vielleicht interessant für die hier immer wieder auftauchenden
Diskussionen um SW-Design...

...aus einem Paper (icfp99.ps) von Xavier Leroy:

=======================================================================

     Myth: OO programs are easier to extend


 Consider a type of "things" with several kinds of things and
 several operations over things.


                | FP-approach:            | OO-approach:
                |                         |                       
                | One function per        | One class per kind of
                | operation, defined by   | things, one method
                | pattern matching on     | per operation          
                | things                  |                         
 ---------------|-------------------------|-------------------------
 adding a new   | Must edit all           | Add one class, other   
 kind of thing  | functions, adding a     | classes unchanged      
                | new case to every       |
                | pattern matching        |
 ---------------|-------------------------|-------------------------
 adding a new   | add one function,       | Must edit all classes,                              
 operation over | other functions         | adding a new method   
 things         | unchanged               | to every class                       
 ---------------|-------------------------|-------------------------
  
=======================================================================

Schön ist's, wenn eine Sprache beide Möglichkeiten unterstützt.  :)


Ciao,
   Oliver



Mehr Informationen über die Mailingliste linux-l