Re: Java is becoming the new Cobol
- From: LX-i <lxi0007@xxxxxxxxxxxx>
- Date: Sat, 05 Jan 2008 19:54:00 -0700
Judson McClendon wrote:
And yes, I'm programming using OO every day, have been doing so for over a
year, and I have still yet to see anything I couldn't have done simpler and
easier as procedural.
I've been doing it right at 10 months (so I guess I'm a little behind
you), but I'm of a completely different opinion. OO has saved me
*loads* of time. In fact, now when I hear a problem being described, my
mind automatically starts breaking it up into the objects that will be
affected, and the information they need to exchange to make it happen.
Just this past week, I had to write some code for a process that was
very similar to another one. What I did was look at what the old one
did, look at what I needed, *and* look at future known requirements, and
I was able to break the original object up into three objects, then
subclass the second to make mine. I didn't have to write *any* of that
code, because it had already been written.
(It was a "data extraction" query. The top-level object is "BaseQuery",
which has a name, how often to run, what user created it, etc. The next
level is "BaseReportQuery", which is designed to run queries off
reports. It adds word-search capability, and Word and Excel output
options. Finally, the next level represents the actual object from the
system ("IllnessQuery", in my case - it searches occupational illness
investigations). It contains the input for the query.
I've also written an MVC (Model/View/Controller) framework for PHP. It
took a little while to get it tweaked the way I wanted it for the first
few pages, but once I got that, it actually helped me make further pages
much more quickly. (As an added bonus, HTML isn't embedded in PHP files!)
The "control script" creates the "UI Service", which provides an XML
tree in memory that has certain page attributes. Then, the control
script will instantiate "Page" objects if there's dynamic stuff to be
done, and they append data to the XML tree. Finally, the control script
tells the UI service to render the page, and the XML tree is rendered
using an XSLT style***. This is done on the server, so I don't have
to rely on the browser to do it. There are other objects (the ones to
represent the actual data), and a database service that creates an
abstraction layer from the database.
Yes, all this *could* have been done procedurally. However, I don't
think I would have come up with that design had I been thinking
procedurally.
I don't know if you were around when I posted my "My First C#" post.
The feedback I got from it (in here) was really, really great. In fact,
I didn't realize the brilliance of some of that advice until I got to my
new job and started doing OO exclusively every day. The biggest thing
that helped me, I think, is the "one method, one responsibility"
concept. If the building blocks are small enough, you can put them
together quickly. If they're too big, you have to take the time to
either split them apart, or add "another" parameter to alter the
behavior under a certain condition. (And yes, it is valid OO to have a
method whose one responsibility is putting the pieces together - in
fact, that's probably the main method in the class.)
After all, OO is implemented procedurally at the
machine code level. OO is, functionally, just a wrapper, so it's false to
say it couldn't be done procedurally, because it is procedural at the bottom.
For me, it's been a mindset shift - and I have seen it benefit me.
Maybe I'm in a shop where it's done right. :) (Not implying anything
about yours, of course...)
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ / \/ _ o ~ Live from Albuquerque, NM! ~
~ _ /\ | ~ ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ Business E-mail ~ daniel @ "Business Website" below ~
~ Business Website ~ http://www.djs-consulting.com ~
~ Tech Blog ~ http://www.djs-consulting.com/linux/blog ~
~ Personal E-mail ~ "Personal Blog" as e-mail address ~
~ Personal Blog ~ http://daniel.summershome.org ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GEEKCODE 3.12 GCS/IT d s-:+ a C++ L++ E--- W++ N++ o? K- w$ !O M--
V PS+ PE++ Y? !PGP t+ 5? X+ R* tv b+ DI++ D+ G- e h---- r+++ z++++
"Who is more irrational? A man who believes in a God he doesn't see,
or a man who's offended by a God he doesn't believe in?" - Brad Stine
.
- Follow-Ups:
- Re: Java is becoming the new Cobol
- From: Judson McClendon
- Re: Java is becoming the new Cobol
- From: Pete Dashwood
- Re: Java is becoming the new Cobol
- References:
- Java is becoming the new Cobol
- From: Richard
- Re: Java is becoming the new Cobol
- From: Scott
- Re: Java is becoming the new Cobol
- From: Judson McClendon
- Java is becoming the new Cobol
- Prev by Date: Re: Java is becoming the new Cobol
- Next by Date: Re: move of COMP to DISPLAY
- Previous by thread: Re: Java is becoming the new Cobol
- Next by thread: Re: Java is becoming the new Cobol
- Index(es):