Bill Kirkman writes:
Quote
Folks,
I am looking at architecting what I think is a better solution using
objects (real OO programming :-) ) vs "Forms" programming. What I
mean with "Forms" programming is I drag and drop controls onto a
Form/DataModule and all logic is in the specific form/Data Module
controls or properties or events on the form/Data Module. I see a
long term value, ease of maintenance, and easy to change/extend an
application using objects. Just trying to convince myself and others
that this truly is the best way to develop an enterprise application.
The flip side is I can quickly drop a datagrid, or component X on the
form, set properties(datasource) and bingo! I have the start of a
working application. Add a few "rules" on the events of the
controls/form, and it now does what the requirements state it should
do. I may have to use the same code on multiple forms (dependencies)
but some argue that its just as quick to find and change them on
multiple forms as it is to create the business object framework so
what do you buy developing this way?
So, not really understanding all the benefits in the Business Object
paradigm, what is the argument for building an application,
specifically an application using Business Objects/ Data Access
Layer/whatever vs just RAD development drag/drop controls and wire em
up? I am really looking for some excellent reasons to help me
understand why this is a better way.
TIA,
Bill K
I'm about 2 months ahead of you! I was asking the same questions.
What I have found out is that you can not answer that question in a single
post. For me (so far) I have found that the benefit lies in trying to
get a grip on a few key technologies that are "new" (its embarrassing
to me how far behind I have gotten) and recognizing how they integrate
and what they can do to improve your products.
To me those technologies that you will have to get a grip on are:
1: Refactoring: I just got Martin Fowler's Refactoring: Improving the
Design of Existing Code. Basically, its a systematic and methodical
way of converting your old click event/top down code into true OO code.
Presuming the code already works, you make many small incremental
changes and test. Its a daunting task for those of us with huge legacy
systems.
(Yes, the forms and components you use are objects, and you have used
lists and classes where needed, but if you're like me, 80-90% of the
code written INSIDE the event handlers is top down.)
Persoanlly, I don't think I will be able to refactor my old legacy code
in exactly the manner prescribed. I say that because we are planning a
rewrite, so investing time into the old code is not worth it. HOWEVER,
as I migrate the functions and behaviors to the new system, I will
definitly be refactoring, so I guess that counts.
2. Design Patterns: Basically, there are class/object models that are
tried, tested and proven to help solve most programming problems.
Using these models will improve your architecture.
The "Bible" of Design Patterns is from Eric Gamma, et al commonly known
as the Gang of Four. GoF patterns are those described in their book.
Mine's on order, but like most "Bible's" I hear its not easily read.
Check out my other posts this week, the experts here have been kind
enough to recommend a few other pattern books. (The Delphi book on
patterns is out of print and dead at the publisher. Joanna is going to
give us all an email address so we can mail bomb him into reconsidering
:-) ).
3. Unit Testing: I was fortunate enough to attend Borland's developer
conferance and caught Charlie Calavert's talk on Unit Testing. (That
and Marco Cantu on Delphi design patterns are what got me started on
these topics! Thanks, Charlie & Marco, can not wait for the conferance
CD). Charlie's notes for both 2004 & 2005 can be found at
www.elvenware.com/charlie/conferences/2004/talks/. I highly
recommend the notes on patterns, but even more so on Unit Testing. Get
DUnit and play with it!
Basically, IF your code has been written as objects (see Refactoring
and Design Patterns) then the objects should be able to be instantiated
OUTSIDE of your application. (Yes, objects link to other objects, so
the advanced course in unit testing introduces stub & mock objects).
DUnit is a framework for writing tests that can be run against
instances of your objects outside of your program. It includes a GUI
for running the tests and reporting the results. I hear there are
other frameworks, too.
Be forewarned that you might need a primer in UML to really understand
many of the books you will encounter if you persue this. I am not an
expert in these topics by any means. Its a daunting learning curve,
but I don't see any choice. It just makes too much sense not to work
(although I am skeptical of the claim that the time spent in better
design, building thousands of tiny objects and tens of thousands of
individual tests pays off in time saved later. Better apps, yes. But
its seems to me that it is going to slow development. Admittedly,
because its so new to me that its certainly slowing me down right now.
In addition to Charlie Calavert and all the books you'l find referenced
if you scan this newsgroup, I recommend Jim Cooper's and Joanne
Carter's articles (again, just scan the newsgroup, go to their
websites) and I am sure many others. I have started reading those as
well, and while I don't understand everything yet, its exciting. I'll
build a more solid base knowledge when the books come in and tackle
these articles again.
--