DAL or BLL? How to implement objects

M

Mikeon

Since i would be loading data for multiple students, is it not good
practice to define a collection of students within the DTO layer? I
have made a collection class within my business layer for my student
collections, it seems like duplicate code to define another collectin
of students with the dto layer? Or is it better to just use a generic
list for DTO types?

The reason you would like to have your own custom collection of
students is probably that you want to add some logic to it - such as
some kind of validation when adding new item.
I suppose that you do not need (or should not need) any kind of
validation in the DTO since the objects there should have no logic at
all. In this case I would return a simple array of students and not a
List<T> because the List allows you to add and remove objects which you
don't need in this scenario.
 
N

Nemisis

Mikeon said:
The reason you would like to have your own custom collection of
students is probably that you want to add some logic to it - such as
some kind of validation when adding new item.
I suppose that you do not need (or should not need) any kind of
validation in the DTO since the objects there should have no logic at
all. In this case I would return a simple array of students and not a
List<T> because the List allows you to add and remove objects which you
don't need in this scenario.

Thanks for the advice so far, i have gone out and bought some books,
just waiting on them to turn up now. When creating a DTO object, in
your opinion, is it better to be an interface or a class?
 
J

Joerg Jooss

Thus wrote Nemisis,
Thanks for the advice so far, i have gone out and bought some books,
just waiting on them to turn up now. When creating a DTO object, in
your opinion, is it better to be an interface or a class?

A true DTO is a simple data container with some utility functionality such
as ToString() at best. Abstracting that using an interface is overkill.

Cheers,
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top