473,770 Members | 5,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Interface, class or collection Question

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
Nov 15 '05 #1
2 1482
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" <an*******@hotm ail.IHATESpam.c om> wrote in message
news:OR******** ******@TK2MSFTN GP10.phx.gbl...
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

Nov 15 '05 #2
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 [MVP]" <vapor at steaming post office> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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" <an*******@hotm ail.IHATESpam.c om> wrote in message
news:OR******** ******@TK2MSFTN GP10.phx.gbl...
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


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4651
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
3
2378
by: Sai Kit Tong | last post by:
I posted for help on legacy code interface 2 days ago. Probably I didn't make it clear in my original mail. I got a couple of answers but none of them address my issues directly (See attached response). My first reply directed me to source code migration but I didn't have the source code. The second reply mentioned about .NET interoperability (PInvoke I think) but I MENTIONED THAT I COULDN'T FIND ANY DOCUMENTATION FROM MSDN LIBRARY BASED ON...
3
2547
by: Guthrie Phalanx | last post by:
HI all Bit of a newbie on interfaces, I hope this is not a silly question. I am stuck on a problem where I want to create a custom collection of objects, all of whom implement the same interface. The following code probably explains my situation better than words do : interface IEvent { string Title {get; set;} string Description {get; set;}
21
13847
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered by Sets. - ICollection cannot decide containment - IList promises indexability by the natural numbers, which is not achievable (since i hash elements, not sort them). - IDictionary is definatly not setlike. Although I can, of course, define...
9
1033
by: Chris Dunaway | last post by:
I have created an Interface called IClientModule in a class libarary and have compiled the library to a .dll. In my main app, I scan a folder for .dll's and load each one that implements the interface. For each one that is loaded, it is stored in a collection object which is an instance of a typed collection class called ModuleCollection. In the code, I want to iterate through the collection so I tried this code:
15
26302
by: mr.peteryu | last post by:
Hi, Can someone explain the idea behind casting to an interface? For example: -> I have an IInterface that contains a Read() method. -> I have an object "obj" that implements IInterface. Why would someone do the following and what does it mean?
8
1480
by: khalprin | last post by:
Hello, I'm trying to create a component that will be used from .net clients and COM clients. I've got an object model that looks something like this: ISystem IRuntime IConfiguration ICollectionOfConfigurableThings IConfigurableThing
15
2733
by: Gustaf | last post by:
Using VS 2005. I got an 'IpForm' class and an 'IpFormCollection' class, containing IpForm objects. To iterate through IpFrom objects with foreach, the class is implemented as such: public class IpFormCollection : IEnumerable<IpForm> { ArrayList forms = new ArrayList(); public IEnumerator<IpFormGetEnumerator() {
15
2807
by: Xah Lee | last post by:
On Java's Interface Xah Lee, 20050223 In Java the language, there's this a keyword “interface”. In a functional language, a function can be specified by its name and parameter specs. For example: f(3) f(3, )
13
1818
by: =?Utf-8?B?RGF2ZSBXZWVkZW4=?= | last post by:
Hi all, I'm having trouble with a project that I've distilled down to the following code. Unfortunately it won't compile and gives the following error (caused by the call to GetHorses() in HorseFarm's GetAnimals() method): Cannot implicitly convert type 'MyCollection<Horse>' to 'MyCollection<IAnimal>'
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10057
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10002
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9869
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.