just wondering how to design this...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,

Please allow me to revisit this topic once more it has hindered me for the
longest. Even after the great replies I got in the past. I guess they might
have been a bit over my head or my requirements weren't very clear. I’m
betting on the latter (not asking clear) so after several months of pondering
please allow me to rephrase my question. Ok, so I'll begin already

Given: Northwind Customers and Orders tables.
Goal1 I'd like to create a simple win app that I'm hoping will clear up
some architecture questions I'm challenged with.
Goal2 All I want to accomplish is to edit a customer's order.

For example, display a list of customers. I should be able select a customer
which then displays a list of orders for that customer. And finally select an
order to edit.

My understanding challenge:
I'm having class design issues. let me first ask my one question then I'll
maybe followup with the next after I'm clear on this one.
For instance:
I'm wondering if I want to get orders for a customer would I create a method
called GetOrders in the Customer's class or Order class?

Thanks,
rodchar
 
Hi Rod,

First question first: in my mind, getorders() would logically be in the
customers class; the orders class would contain methods that deal with the
array of orders you 'get'.

HTH,

Bernie Yaeger
 
Got it: my GetOrders method in my Customer class
Now: i'm using a typed dataset with both the customers and orders table in it.
my first guess is to dim a new dataset in the customer class and get a list
of all the customers. And then, once i retrieve one customer i'll use the
GetOrders method.

Inside my GetOrders method, do i dim a new Order object passing a reference
of the dataset so i can populate the Orders table?
 
Hi ROd,

Yep; sounds logical to me.

Bernie

rodchar said:
Got it: my GetOrders method in my Customer class
Now: i'm using a typed dataset with both the customers and orders table in
it.
my first guess is to dim a new dataset in the customer class and get a
list
of all the customers. And then, once i retrieve one customer i'll use the
GetOrders method.

Inside my GetOrders method, do i dim a new Order object passing a
reference
of the dataset so i can populate the Orders table?
 
are there some other ways to achieve this which would also be acceptable? if
so, could please give me 1 or 2 other examples.

thanks,
rodchar
 
rodchar said:
are there some other ways to achieve this which would also be acceptable?
if
so, could please give me 1 or 2 other examples.


Years of development have made me cynical.
Maybe I'm a jaded dinosaur.
I look at different ways of doing stuff and I look at what the benefits are.
I don't find OO actually returns the pluses claimed.
Or at least the sort of OO you're describing.


You already probably realise that you're taking longer.

The only real world benefit (IMO) of using the approach is if you're
re-using objects.

I would suggest you decide whether you have some other reason for doing the
OO thing beyond efficiency of development.
Will your objects will really be re-used?
Often they are not.
That customer logic bit is often only used in the customer maintenance
screen.

Oh... Use stored procedures though.
Stored procedures are arguably another
layer/object/whatever-flavour-of-month-calls-it.
They're also a hell of a lot easier to get your head round than full on OO
so they're quicker to write.
What you do find is that the customer-to-orders data is used in a coupla
reports and maybe maintenance screens.
One stored procedure can be used for the lot.

Anyhow, that's my view.
 
alright: now to select an individual order how would that work?
would have a method in the Order class called GetOrder and call it from the
Customer class?
 
rodchar said:
alright: now to select an individual order how would that work?
would have a method in the Order class called GetOrder and call it from
the
Customer class?

Possibly.

Maybe you should have an orders class.

It depends.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top