Re: Real world modeling.
From: Harry Erwin (herwin_at_theworld.com)
Date: 12/01/03
- Next message: Cristiano Sadun: "Re: Java "interface" vs. OO interface"
- Previous message: Robert Klemme: "Re: strategy pattern"
- In reply to: Topmind: "Re: Real world modeling."
- Next in thread: Phlip: "Re: Real world modeling."
- Reply: Phlip: "Re: Real world modeling."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 1 Dec 2003 08:50:31 +0000
Topmind <topmind@technologist.com> wrote:
> [....]
> > Such alignments were possible long before object oriented languages
> > were conceived, and are just as possible today. The technology of OO
> > has done little, if anything, to enhance the ability to create such
> > alignments. There is no difference in the expressivity of the
> > following two lines of code:
> >
> > C: Deposit(myAccount, 200.00);
> > Java: myAccount.deposit(200.00);
> >
> > Whether the language is C or Java, whether the paradigm is procedural
> > or OO, there are data structures, and there are procedures. And the
> > ability to choose names for these entities, and align those names to
> > problem domain entities has not changed.
> >
> > What *has* changed is something that is both more subtle and more
> > profound than the naming alignment. The difference between the two
> > statements above is in the internal coupling of the system.
> >
> > If we assume that there are two different kinds of accounts, then the
> > C Deposit function must know about them, and probably has some kind of
> > case statement:
> >
> > void Deposit(Account* a, double amount) {
> > if (a->type == SAVINGS)
> > ...
> > else if (a->type == CHECKING)
> > ...
> > }
> >
> > This means that the Deposit function is coupled to all the accounts.
> > Whenever a new kind of account is created, this function must change.
> >
> > The Java program does not have this coupling. To add a new kind of
> > account to the Java program one simply creates a new subtype of
> > account. No case statement exists.
> >
> > The result is a looser coupled design. Not a design that better
> > models the real world, but a design in which change are easier to make
> > because there are fewer dependencies to tangle the design.
>
> But you are assuming that things nicely divide up into global sub-types
> or global hierarchical taxonomies. My experience is that they *don't*,
> at least in the bussiness world. In otherwords, polymorphing off of
> subtypes makes certain assumptions about stable classifications of
> things. I find these assumptions are often false. Robert dissagrees.
> Either way, just be careful about hard-wiring your software design to
> noun taxonomies.
>
> >
> > Robert C. Martin | "Uncle Bob"
>
> -T-
I agree about the problem with taxonomies. The kinds of abstraction you
assume to be important in the development of a program will constrain
the solutions you have available downstream. On the other hand, the
kinds of objects in your problem domain (not the business logic, ->the
objects<-) tend to be based on physical things and hence rigid. In an
airline reservation system, this suggests that you need to start with
airframes (which can be reconfigured--so delegate aircraft
configuration), people, credit cards, passports, crewpositions, gates,
etc. Changing those is much less likely than changing cabin
configuration, passenger booking types, airports, etc.
-- Harry Erwin <http://www.theworld.com/~herwin/>
- Next message: Cristiano Sadun: "Re: Java "interface" vs. OO interface"
- Previous message: Robert Klemme: "Re: strategy pattern"
- In reply to: Topmind: "Re: Real world modeling."
- Next in thread: Phlip: "Re: Real world modeling."
- Reply: Phlip: "Re: Real world modeling."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|