I have no problem with lots of objects as long is it does not impede on
performance. Usually it will take a hell of a lot of objects before
performance will degrade.
In past projects that I have worked on, I find it beneficial to defined
objects and initialize them in the data layer. Basically, the data layer
reads the information from the database and sets the necessary properties.
That way the consuming code does not need to be aware of issues like row and
column format of the dataset. It also helps the compiler perform type
checking if you use actual objects. Objects are just easier to use and are
for the most part self documenting. Suppose that you have an object called
Comment with a property called Text. It is easier to read this then to get
row X, column Y of some dataset.
This is just my opinion and others may view things differently but I find
that the benefits outweigh the consequences.
Now, there is something that you might want to consider, whether you want to
communicate a lot with the database or store all those objects in memory.
One idea might be that if you create an object hierarchy, you might not want
to load some objects until they are actually used. There is no point in
having something in memory that might never be used. Therefore whenever you
call a property, it can call the data layer to initialize the information
and return what you expect. Or you could load all information when the
highest level object is created.
"Simon" <sh856531@microsofts_free_email_service.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi all,
I'm hoping that someone could help with the following general question:
I'm making a website that manages beta releases of software. It does
various things like store bugs, comments, work arounds and feature
requests. Users can subscribe to be notified if a feature or bug is
detected in their area of interest.
The software developer can publish new and polls and all sorts of crap
like that.
My question is, is it good practice to create a class or struct for nearly
all the nouns in the statements above.
I currently have classes representing Users, Roles, Permissions.
I'm wondering if I should create classes for things like bus, comment,
feature requests and so on or should I just pass around datasets and
datarows to represent the data and have other classes work on those data
collections.
If I should use custom objects for most of these requirements should I
always initialise them in the data layer before passing them back up to
the buisiness tier?
Thanks to any advice you can offer.
Kindest Regards
tce