473,396 Members | 1,923 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,396 software developers and data experts.

Rich Domain (business objects) Qustion

I am trying to build more applications using a more OO approach, with
more seperation of business and presentation logic.

One problem I am running into involves the design philosophy behind
using a rich domain.
Lets say that for a specific page you need to view all the line items
for a given order, and produce some aggregrate information about those
line items.

Now, the cheap and dirty method would be to just fetch a dataset, loop
through it to do any aggregrate calculations you need for the footer,
and then databind it to a datagrid.

If you were to do this same task w/ a rich domain model, you would
probably get an Order object that contained a collection of Line Items.

This means you would have to instantiate an object for every line item,
only to turn around and do nothing while those items (other than just
databinding the results to a datagrid).
So, am I designing this correct, or is there a better way to do this?
How do people who follow the rich domain model deal with issues like
this? In this example, there usually wouldn't be a ton of line items,
but in other applications you could have hundreds of items. I am
thinking the performance penality would be really large.

Nov 19 '05 #1
3 1472
Hi cmay:

It always depends on the application, but a DataSet object is a
reasonable choice if you only need read-only aggregate information.
It's especially nice to do all the aggregation work in the database
with a GROUP BY, because database engines are particularly good at
this.

In terms of populating hundreds of LineItem objects, it might be just
as expensive to populate hundreds of rows in a DataGrid - they are not
the lightest weight object in the framework...

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 27 Jun 2005 11:00:33 -0700, "cmay" <cm**@walshgroup.com> wrote:
I am trying to build more applications using a more OO approach, with
more seperation of business and presentation logic.

One problem I am running into involves the design philosophy behind
using a rich domain.
Lets say that for a specific page you need to view all the line items
for a given order, and produce some aggregrate information about those
line items.

Now, the cheap and dirty method would be to just fetch a dataset, loop
through it to do any aggregrate calculations you need for the footer,
and then databind it to a datagrid.

If you were to do this same task w/ a rich domain model, you would
probably get an Order object that contained a collection of Line Items.

This means you would have to instantiate an object for every line item,
only to turn around and do nothing while those items (other than just
databinding the results to a datagrid).
So, am I designing this correct, or is there a better way to do this?
How do people who follow the rich domain model deal with issues like
this? In this example, there usually wouldn't be a ton of line items,
but in other applications you could have hundreds of items. I am
thinking the performance penality would be really large.


Nov 19 '05 #2
Scott,

Thanks for the reply.

Can I ask another question: (2 parter) How do most objects (which are
representing data from a database) handle Null values? When you are
accessing a dataset, you can check if the value is DBNull.Value, but if
you are strongly typing the properties of your object, how do you do
that? Do you type them as nullable types?
Also, with a dataset you can extract a view for sorting and filtering
before binding to a datagrid. Is there anything similar w/ objects
that once can implement, or do you have to write your own code to order
/ filter your collection of objects?

Nov 19 '05 #3
I have not tried nullable types enough to be comfortable with them yet
(the nullable types in 2.0, that is).

In general I've tried to avoid the problem by using NOT NULL columns
in the database design. When forced to I've used the nullable Sql
types like SqlDateTime.

For sorting and filtering I've relied on the database, too. Although
you can (and would have to) write your own filtering and sorting using
something like: http://odetocode.com/Articles/203.aspx, I try to pull
records back from the database in order and keep them in an ordered
ArrayList.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On 29 Jun 2005 16:32:06 -0700, "cmay" <cm**@walshgroup.com> wrote:
Scott,

Thanks for the reply.

Can I ask another question: (2 parter) How do most objects (which are
representing data from a database) handle Null values? When you are
accessing a dataset, you can check if the value is DBNull.Value, but if
you are strongly typing the properties of your object, how do you do
that? Do you type them as nullable types?
Also, with a dataset you can extract a view for sorting and filtering
before binding to a datagrid. Is there anything similar w/ objects
that once can implement, or do you have to write your own code to order
/ filter your collection of objects?


Nov 19 '05 #4

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

Similar topics

25
by: Stuart Hilditch | last post by:
Hi all, I am hoping that someone with some experience developing nTier apps can give me some advice here. I am writing an nTier web app that began with a Data Access Layer (DAL), Business...
0
by: aa7im | last post by:
I am starting a new project and I always and looking for a better way to skin a cat. Anyway, I am interested in seeing how different people have implemented an N-Tier type architecture (using...
5
by: G. Stewart | last post by:
The word "Business" in the term implies some sort of commercial aspects or connotations. But from what I can see, that is not necesserially the case at all? So what is the reasoning behind the...
8
by: Keith-Earl | last post by:
Okay, looking for a Best Practice. We are building a classic three tier app in VB.NET. When we load up a WebForm we have access to very useful objects such as the Session object. We frequently...
5
by: Bob | last post by:
We have a pretty complicated Excel based application that I'm looking to make the functionalities online. It has very rich UI and displays numerous input controls (think a tax form like screen). ...
0
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the...
25
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.