Interface, class or collection Question

A

Andrea Williams

I need to expose the properties of an User Object to all other classes, but
hide the operations (functions) from all but the Business layer of my app?
The goal is to load up this USER object and pass it from app Layer to bus
layer to Data layer and then back once data has been handled. All requests
to the data layer from the business layer, so that it can validate the data
before Insertion, update, etc.



I've read up on Interfaces... I've tested an implementation turning my User
object into an Interface instead of a class, which is what is was before.
Now I can populate the User Interface with the various properties that a
user needs (FirstName LastName, etc.). This seems to work for me to pass it
between the layers. However, since I'm learning this stuff on my own and
have a classic ASP background, I'm unsure if this is the right approach.



I have also heard of people populating arrays or collections and sending it
from class to class as in the ASP Time Tracker code. They create a
collection class to hold the variable from the form and to pass it to the
data layer. I've seen people create a class just to hold the properties of
the object and that class is used on all three layers. With so many
different ways to accomplish the same thing, which would be considered a
"best practice" and would be better for performance?? Are there any articles
that talk about the best ways to pass data from your form through the layers
and back again?



I'm not at the point where I can test for performance right now, so can
anyone more knowledgeable than me tell me which implementation would be
faster at runtime. A pros and cons list of the different options would be
great!





Thanks in advance,



Andrea
 
A

Andrea Williams

No. I've read up some more on interfaces, but it seems that they are mostly
used to execute a function that does something. Only in the MSDN Library
have I seen sample code that exposes properties instead of exposing
functions. I'm still a bit lost on the common implementation. And since my
properties should not be shared, I'm thinking that a Table object would work
better to hold the property values and pass them back and forth between the
layers.

Any advice would be helpful...

Thanks,
Andrea


Alvin Bruney said:
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Andrea Williams said:
I need to expose the properties of an User Object to all other classes, but
hide the operations (functions) from all but the Business layer of my app?
The goal is to load up this USER object and pass it from app Layer to bus
layer to Data layer and then back once data has been handled. All requests
to the data layer from the business layer, so that it can validate the data
before Insertion, update, etc.



I've read up on Interfaces... I've tested an implementation turning my User
object into an Interface instead of a class, which is what is was before.
Now I can populate the User Interface with the various properties that a
user needs (FirstName LastName, etc.). This seems to work for me to
pass
it
between the layers. However, since I'm learning this stuff on my own and
have a classic ASP background, I'm unsure if this is the right approach.



I have also heard of people populating arrays or collections and sending it
from class to class as in the ASP Time Tracker code. They create a
collection class to hold the variable from the form and to pass it to the
data layer. I've seen people create a class just to hold the properties of
the object and that class is used on all three layers. With so many
different ways to accomplish the same thing, which would be considered a
"best practice" and would be better for performance?? Are there any articles
that talk about the best ways to pass data from your form through the layers
and back again?



I'm not at the point where I can test for performance right now, so can
anyone more knowledgeable than me tell me which implementation would be
faster at runtime. A pros and cons list of the different options would be
great!





Thanks in advance,



Andrea
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top