Re: Real world modeling.

From: Harry Erwin (herwin_at_theworld.com)
Date: 12/01/03


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/>


Relevant Pages

  • Re: Real world modeling.
    ... > Such alignments were possible long before object oriented languages ... > Whenever a new kind of account is created, ... > The result is a looser coupled design. ...
    (comp.object)
  • compensation toward busy cult
    ... raise hitherto or Calvin will account the sufferers. ... Some abuses hand, pretend, and analyse. ... A lot of joint individual suburb realizes groupings about Hamid's ... It might delay once, underline forward, then design ...
    (sci.crypt)
  • Re: External users vs internal users.
    ... I think I need help with the design full-stop. ... To have Team and Meeting sites available to groups of external users. ... Then you'll need a separate WSS farm for this since you're using account ... > server, with Portal server on an internal server, but both use the same ...
    (microsoft.public.sharepoint.portalserver)
  • Re: MVC design questions
    ... Instead of a single CRUD GUI program I've got two, the idea being that one can be given to anybody because it can't damage the database (no insert/update/ delete capability at all while the other, which can do these things, is intended only for suitable authorised users: most data is bulk loaded and the update GUI is only there for removing to odd piece of junk and tidying up. ... In fact, i'd create three - a full-access account for the DBA, an account with the ability to edit the data, but not do DDL, for the update app, and a read-only one for the search app. ... I have almost no OO background and have no idea who the currently recognised OO design gurus are. ... That era was dominated by big ideas - big processes, big notations, big books, big words. ...
    (comp.lang.java.programmer)
  • Table design / query question
    ... I'm trying to make a design decision however right now I'm deciding on ... changes to the state of the account as the users make the changes. ... state of the account - through all history) using the four historical ... ActID PK ...
    (microsoft.public.sqlserver)