PC Review


Reply
 
 
=?Utf-8?B?QnJ1bm8gUm9kcmlndWVz?=
Guest
Posts: n/a
 
      7th Apr 2005
Hi,

I'm developing my first real object-oriented project, and having some
trouble...

Simple scenario:

DB
Table Orders, Fields: Client, Date
Table OrderDetails, Fields: OrderID, Product, Price, Quantity, Discount

Businness Entity
Order, Fields: Client, Date, TotalQuantity, TotalPrice

How should I fill TotalQuantity and TotalPrice fields???
The first approach is using a view, but I don't want to have businness
logic in the database, nor use aggregate functions.
The second, would be creating those fields in the Orders table, but that
would be a waste of space and code.
The third, would be filling the businness entities in the code itself, but
for that, I would need to load all order details in the memory, and loop for
each one. This is ok when I already need all order details, but in a simple
view of all orders, it's not that good.

I still think the third option is the best. Maybe you can give me a clue.

Thanks,
Bruno Rodrigues.
 
Reply With Quote
 
 
 
 
Sean Hederman
Guest
Posts: n/a
 
      7th Apr 2005
Why don't you want to use aggregate functions? They'd be far faster and more
effiicient than anything you could code.

"Bruno Rodrigues" <(E-Mail Removed)> wrote in
message news:721DDB3D-578B-4C99-8B32-(E-Mail Removed)...
> Hi,
>
> I'm developing my first real object-oriented project, and having some
> trouble...
>
> Simple scenario:
>
> DB
> Table Orders, Fields: Client, Date
> Table OrderDetails, Fields: OrderID, Product, Price, Quantity, Discount
>
> Businness Entity
> Order, Fields: Client, Date, TotalQuantity, TotalPrice
>
> How should I fill TotalQuantity and TotalPrice fields???
> The first approach is using a view, but I don't want to have businness
> logic in the database, nor use aggregate functions.
> The second, would be creating those fields in the Orders table, but that
> would be a waste of space and code.
> The third, would be filling the businness entities in the code itself,
> but
> for that, I would need to load all order details in the memory, and loop
> for
> each one. This is ok when I already need all order details, but in a
> simple
> view of all orders, it's not that good.
>
> I still think the third option is the best. Maybe you can give me a clue.
>
> Thanks,
> Bruno Rodrigues.



 
Reply With Quote
 
Aquila Deus
Guest
Posts: n/a
 
      7th Apr 2005

Bruno Rodrigues wrote:
> Hi,
>
> I'm developing my first real object-oriented project, and having

some
> trouble...
>
> Simple scenario:
>
> DB
> Table Orders, Fields: Client, Date
> Table OrderDetails, Fields: OrderID, Product, Price, Quantity,

Discount
>
> Businness Entity
> Order, Fields: Client, Date, TotalQuantity, TotalPrice
>
> How should I fill TotalQuantity and TotalPrice fields???
> The first approach is using a view, but I don't want to have

businness
> logic in the database, nor use aggregate functions.
> The second, would be creating those fields in the Orders table, but

that
> would be a waste of space and code.
> The third, would be filling the businness entities in the code

itself, but
> for that, I would need to load all order details in the memory, and

loop for
> each one. This is ok when I already need all order details, but in a

simple
> view of all orders, it's not that good.
>
> I still think the third option is the best. Maybe you can give me a

clue.

The first. Your database must contain part of Business Logic, whether
you like or not.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Book about Architeture in .NET (Components, Services...) Book about Architeture in .NET (Componen Microsoft Dot NET Framework 0 29th Nov 2007 09:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:50 PM.