473,383 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

OO design in servlet design question

One thing i'm finding very quickly as my servlets become more logically
condensed, is that an "object" in the sense of "object oriented design"
becomes restricted to a "webpage/servlet". How do you enterprise programmers
manage to effectively incorporate OO design (in the architecturally broad
sense) within an application that, perhaps more efficiently benefits in
performance from one servlet rather than 12 servlets performing the logical
functions of what 1 servlet spaghetti coded can do?
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.720 / Virus Database: 476 - Release Date: 7/14/04
Jul 17 '05 #1
4 1914
"dave" <go******************@nowhere.com> wrote in message
news:0L*****************@nwrdny03.gnilink.net...
One thing i'm finding very quickly as my servlets become more logically
condensed, is that an "object" in the sense of "object oriented design"
becomes restricted to a "webpage/servlet". How do you enterprise programmers manage to effectively incorporate OO design (in the architecturally broad
sense) within an application that, perhaps more efficiently benefits in
performance from one servlet rather than 12 servlets performing the logical functions of what 1 servlet spaghetti coded can do?

There are many possible answers to this. Probably the most basic one is that
it's rarely desirable to give up maintainability in favor of efficiency.
Besides, OOD doesn't claim to be efficient.
Jul 17 '05 #2
dave wrote:
One thing i'm finding very quickly as my servlets become more logically
condensed, is that an "object" in the sense of "object oriented design"
becomes restricted to a "webpage/servlet". How do you enterprise programmers
manage to effectively incorporate OO design (in the architecturally broad
sense) within an application that, perhaps more efficiently benefits in
performance from one servlet rather than 12 servlets performing the logical
functions of what 1 servlet spaghetti coded can do?


I'm trying to reach good OO design with my NetForm web application
framework (http://netform.sohlman.com). It has inhertance, reuse,
delegation etc. It is not used very big scale, but let's see.

- Sampsa

--
-------------------------------------------
// Sampsa Sohlman //
// My email can be found on my homepage //
// http://sampsa.sohlman.com //
-------------------------------------------
Jul 17 '05 #3
"dave" <go******************@nowhere.com> wrote in message news:<0L*****************@nwrdny03.gnilink.net>...
One thing i'm finding very quickly as my servlets become more logically
condensed, is that an "object" in the sense of "object oriented design"
becomes restricted to a "webpage/servlet".
How so? I've misunderstood something here.

At its most simple, a servlet is a class that inherits from
HttpServlet. Yes, there are restrictions on your user I/O and your
threading model, but it remains just a class. To process a particular
doPost(), your HttpServlet subclass will start talking to other
classes in other packages in your system: "oject in the sense of
"object oriented design" applies equallys to all instances of those
classes. It's not restricted to the HttpServlet subclass object.

How do you enterprise programmers
manage to effectively incorporate OO design (in the architecturally broad
sense) within an application that, perhaps more efficiently benefits in
performance from one servlet rather than 12 servlets performing the logical
functions of what 1 servlet spaghetti coded can do?


OO design, in the architecturally broad and any other sense we care to
mention, is flexibility through variance encapsulation. To make your
sevlet more OO, just make it flexible. I've always found that the best
way to encapsulate variation is to have an alternate implementation
always in mind when performing the design. The obvious choice (without
knowing what your servlets actually do) here is to design your servlet
so that it's also runnable from a command line. Or from a local GUI.
Even if you don't actually implement the alternative, it concentrates
the mind wonderfully on the interfaces your system exposes rather than
the user-access implementation. These interfaces then encapsulation
the user-access variations, and Robert is your father's bruvva.

..ed

www.EdmundKirwan.com - Home of The Fractal Class Composition
Jul 17 '05 #4
dave wrote:
One thing i'm finding very quickly as my servlets become more logically
condensed, is that an "object" in the sense of "object oriented design"
becomes restricted to a "webpage/servlet". How do you enterprise programmers
manage to effectively incorporate OO design (in the architecturally broad
sense) within an application that, perhaps more efficiently benefits in
performance from one servlet rather than 12 servlets performing the logical
functions of what 1 servlet spaghetti coded can do?


Dave,

Forget about your servlets for a minute. Now, design and write all of
your business logic code as a service library. Use as much OO as is
appropriate. (These will be your models and controllers.) Now write
your servlets as simple wrappers that invoke the business logic in the
servlet context. Use a templating engine like JSP, velocity, XSLT to
create the HTML responses. (These will be your view.)

Using a framework like Struts can help you with this task as well.

HTH,
Ray

--
XML is the programmer's duct tape.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: TheLetti | last post by:
Hy! I've just downloaded the latest Java 2 SDK (j2sdk1.4.2_01). For my surprise in this version the servlet-classes are not integrated (e.g. the class javax.servlet). So I found all the...
1
by: Markos Charatzas | last post by:
Hello all, Can someone point out a few servlet design patterns and general observations when it comes to such development? I'm familiar with the common one of having a servlet for every webpage,...
1
by: Hai Tran | last post by:
Any help is appreciated. Installed Tomcat 4.1 and Mysql on a WinXP. I've manage to get Tomcat up and was able to view my first application ( myhome ) simple home page. Tomcat was installed under...
1
by: lsprtt | last post by:
I'm trying to create this program and I need some help It includes using JAVA, XHTML and Servlet Create a Web application for dynamic FAQs. The application should obtain the information to...
6
by: santhoskumara | last post by:
How to request to servlet from Ajax and also I got the DOM object in the servlet through Business Logic. Now how will i pass the DOM object from serlvet to Clientside. Where in the client Side i am...
14
by: ramadeviirrigireddy | last post by:
Hi All, I have the following code for form and servlet. when the form is submitted the servlet will print the values passed by the form. i'm not getting the servlet o/p when i submit the...
2
by: ManidipSengupta | last post by:
Hi, a few (3) questions for the Java experts, and let me know if this is the right forum. It deals with 100% java code (reason for posting here) but manages a Web browser with Javascript. Thanks in...
3
by: vijaykumardahiya | last post by:
Dear Sir, I have two queries. First question is: I have a Html page. On which Have two buttons Submit and Issue. I want when I click on Sumit button request should be go to submit.jsp. and When I...
9
by: mjahabarsadiq | last post by:
Hi I have created a servlet that is to be started at the server startup. And I got it. In that I have created a object of another class and set it as a session attribute. What I am trying is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.