Re: Is this too much OOP?
- From: needin4mation@xxxxxxxxx
- Date: 21 Sep 2006 08:50:37 -0700
Rick Elbers wrote:
Op 20 Sep 2006 14:15:52 -0700 schreef needin4mation@xxxxxxxxx:
Hi,
Beginner OOP Question.Sure. Even worse: I use code and libraries of other people and also
I wanted to know if real designers that know OOP - that really use it
to create applications - use the models found in books.
their thoughts. The most usefull things for me are analogies from
other domains, but I guess that depends on your way of thinking(
divergent/convergent for instance)
For example, I am writing a web application with asp.net c#. It will
handle employee data. In books I usually see the example that there is
a base employee class. From that class, a specialization is done when
a Manager or line staff employee derives from the employee class.
From what you say here I wouldnt hesitate to say: bull. The simple
fact that your application will "handle" employee data doesnt tell me
*anything* about the design. Apriori overemphasizing of inheritance
is the best way to screw every design effort before it really starts.
If you really look at the good books and patterns in which you can
find "employee" objects you wll find significant behaviors attached.
Those are the clue to the design solution.
Since I am not that great an OOP programmer and probably have a lot of
jumbled code, I wanted to know if it was too much for me to really
write web apps using this model. Would someone really create an
Employee class that held say, lastname, firstname, ssn, etc. and have
methods to insert that name into the database, update and and delete?
Another problem with webapplications is its stateless nature which
doesnt collobarate very fine with the OO way of doing things( keeping
state and behavior together). If we talk about .net apps specifically
then I would for this 2 tier application strongly suggest to use the
datamodel apprioach inherent in the webservice architecture.
Now I just have a page that handles it. Granted the page could beYou are absolutely right and you could add to that the fact that the
considered a class, but it is not really encapsulated and I don't
believe it would really ever be instantiated or referenced from other
pages.
database ALSO has this kind of datarelations. Why in heavens name
duplicate it ?
I guess I've never seen real programming code that was "good." My
stuff works, doesn't break, but I know something is "wrong" with its
design. Thanks for any thoughts.
You might explore that feeling a little bit more. Is there really
something "wrong " ? In what circumstances do you feel that way about
that code ? In what kind of situations you wish you had done it
differently ?
Rick
Thanks. Actually, some of the stuf I look at makes me shudder. The
more I read the more I am amazed any of it is still working. That may
be a natural progression.
Since my experience is limited to web apps (some executables, but no
many) that use databases, I'm not feeling very OOP. That's supposed to
sound a little funny, but what I really mean is that what I write never
looks all neat and tidy like the books. I think I may just look for
duplication at the moment.
For example, I have an app that hits the database. I found I always
doing various regex manipulations to parse the data. So, instead of
putting that code in every web page, I created a separate class that I
pass the SQL string to. That's about as much OOP design I have done.
I understand that I am technically using it in many ways inherting
items from the page and such, but again, nothing like books thave have
these classes everywhere for employees, addresses, etc.
.
- Follow-Ups:
- Re: Is this too much OOP?
- From: Bruno Desthuilliers
- Re: Is this too much OOP?
- References:
- Is this too much OOP?
- From: needin4mation
- Re: Is this too much OOP?
- From: Rick Elbers
- Is this too much OOP?
- Prev by Date: Re: Is this too much OOP?
- Next by Date: Re: Internal State vs. Navigating Associations
- Previous by thread: Re: Is this too much OOP?
- Next by thread: Re: Is this too much OOP?
- Index(es):
Relevant Pages
|