Re: Mixing OO and DB
Date: Thu, 14 Feb 2008 09:50:13 -0600
Message-ID: <2008021409501375249-unclebob_at_objectmentorcom>
On 2008-02-13 05:38:32 -0600, "David Cressey" <cressey73_at_verizon.net> said:
> One of the features of the classical procedural languages is the rigid
> separation of "program" and "data". In Pascal, for instance, one can create
> some new Pascal code, in the form of text, manipulating it as though it
> were data (which it is). But in order to "execute" it, one needs to pass
> it through the compiler, and from there to the run time system. Once it's
> "program" it can't be seen as "data" anymore. A program cannot examine
> itself.
Very nicely put. This is essentially the dinstinction between source
code and binary code. It is at this boundary where OO has it's power.
You see, OO is about *source* code. Here's why:
The second is problematic because it makes a mess of the code, and is
deeply fragile. It also makes a third format much more difficult.
The third is OO. The technique is simple. All content generation code
goes in one class. This class makes calls to an object interface that
has functions for newRow, newCell, etc. There are two implementations
of the interface. One that emits tabs and line ends, another that
emits HTML tags.
The *source code* dependencies all point towards the interface. The
The benefits are:
- We can add new formats without affecting any others.
- We can change content in one place.
- When content changes, the format modules do not need to be recompiled, or redeployed; and vice versa.
-- Robert C. Martin (Uncle Bob) | email: unclebob_at_objectmentor.com Object Mentor Inc. | blog: www.butunclebob.com The Agile Transition Experts | web: www.objectmentor.com 800-338-6716 |Received on Thu Feb 14 2008 - 16:50:13 CET