Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > Java

Reply
 
LinkBack Thread Tools Display Modes
Old 09-30-2004, 06:37 AM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
what happens when the OO model makes things too slow?

i was trying to be pretty strict with my OO approach to the support app i'm developing.

the problem with that is TOO MANY QUERIES! for example, to show an issue history, you need to build the past 10 or so issues for a specific customer.

for each issue, you then need to build a customer object, which calls the phone and product files, and then build an employee object.

with each query costing me from 500-1200ms, this can really add up. i'm dealing with an ibm as/400 -> db2.

the work around i used is to just code a join query in the jsp page itself. this makes things soooo much faster. i only do this when a list of objects need to be viewed which normally would have to execute multiple queries for each row.

what would you do?
__________________
Mike
sde is offline   Reply With Quote
Old 09-30-2004, 08:32 AM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,139
Belisarius is on a distinguished road
It sounds like you need some more specialized queries. I'm not fully familar with what you're doing, but it sounds like you built queries into the datastructure, whereas I tend to keep queries out of the datastructure. I have utility classes build the datastructure I need. For instance, should I want to perform a specific task (such as get an issue history), I'd write a method getIssueHistory(), pass it all the variables I'd need, and form the whole query right there, if possible.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 10-05-2004, 08:21 AM   #3 (permalink)
technobard
Centurion Nova Prime
 
technobard's Avatar
 
Join Date: May 2002
Location: Oak Park, IL (USA)
Posts: 285
technobard is on a distinguished road
Sorry for the late reply. I've been on vacation in sunny San Diego. Ahhh...Er, where was I? Oh, yeah. Just a couple of comments to build on Belisarius' statement. It sounds like you're equating a normalized database structure with object orientation. A customer object, for example, should contain all of the info that makes sense for a customer. This may or may not match up with a normalized database structure. Objects can have embedded one to many relationships like multiple addresses or phone numbers. Relational databases can't. When you map the objects to the database, that mapping can very often be a join between multiple tables. You may also have cases where you plan on processing some resultset, but never actually instantiating the values as objects. Specialty getter methods that either take parameters or contain complete embedded SQL (not my favorite) are perfect for this sort of thing. I'm sure by now you've moved past this issue, but I wanted to add my 2 cents, for what it's worth.
__________________
It takes 2 points to draw a straight line, but at least 3 points to draw a conclusion.
technobard is offline   Reply With Quote
Old 10-06-2004, 06:42 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
thanks for the response guys and you're both pretty much right on.

my solution was as i originally started to do, .. just joining tables in areas that i need to display a list of joined data.

it's not pretty, but it's what i gotta do to make it work right.
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
slow??? revolution Feedback 2 05-14-2002 08:02 PM
Things to do... (another funny!) MiLady Mirlyn Lounge 0 05-12-2002 06:14 PM


All times are GMT -8. The time now is 01:12 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting