T
Terry Paterson
Hi There,
I'm working on creating the middle-tier of a three tier system - the
system is an inventory control system, and is supposed to replace an
existing char based, xBase system.
I want to represent all of my inventory items (parts) as instances of
a PART class, which has various instance variables - age, vehicle
model, vehicle year, part type, colour, mileage, price, condition,
status, etc, and then of course various getter/setter methods.
now -- my question is -- will one class be sufficient to represent all
the usages of part data ?
i.e. if I wanted to update the prices of all the engines in the
existing system I could do something like ( UPDATE inventory SET
price=price*1.10 WHERE parttype='ENGINE' )
but if I want to deal only with objects presumably I would need to
construct a method which gets references to all of the required PART
objects, and then call some method on each object to update the price
? which seems rather in-efficent compared to the previous SQL..
I should also mention that part of the reason I'm thinking I'd have to
do it this was is that I hoped to use the Observer/Observable pattern
on my PART objects so that multiple users across the network could be
looking at the same PART objects and be notified if any of it's
properties changed -- i.e. the users would infact have references to
the SAME part object.
is this a sensible way to go about things ? is there a better way to
perform batch updates ? does is make sense to give users on different
PCs references to the same part objects on the middle-tier ?
any help / suggestions would be much appreciated !
I'm working on creating the middle-tier of a three tier system - the
system is an inventory control system, and is supposed to replace an
existing char based, xBase system.
I want to represent all of my inventory items (parts) as instances of
a PART class, which has various instance variables - age, vehicle
model, vehicle year, part type, colour, mileage, price, condition,
status, etc, and then of course various getter/setter methods.
now -- my question is -- will one class be sufficient to represent all
the usages of part data ?
i.e. if I wanted to update the prices of all the engines in the
existing system I could do something like ( UPDATE inventory SET
price=price*1.10 WHERE parttype='ENGINE' )
but if I want to deal only with objects presumably I would need to
construct a method which gets references to all of the required PART
objects, and then call some method on each object to update the price
? which seems rather in-efficent compared to the previous SQL..
I should also mention that part of the reason I'm thinking I'd have to
do it this was is that I hoped to use the Observer/Observable pattern
on my PART objects so that multiple users across the network could be
looking at the same PART objects and be notified if any of it's
properties changed -- i.e. the users would infact have references to
the SAME part object.
is this a sensible way to go about things ? is there a better way to
perform batch updates ? does is make sense to give users on different
PCs references to the same part objects on the middle-tier ?
any help / suggestions would be much appreciated !