472,122 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,122 software developers and data experts.

n-Tier doubt!!

Hello everyone,

I'm with a lot of questions about how to design a n-Tier, how to do
the code how to organize, and all the samples that i find, are with
only one table, one class with DataAcess, i need something more
"Complex"..

maybe you guys have a little sample with maybe a User class, and a
UserGroup class that is related with the User class...and a Project
class that is connected with a Client class that is connected with a
ClientContacts class...and the Project class have a ProjectStatus...

my biggest doubt is what should i do when designing them???

is this right?

public class Client
{
private string _Name = string.Empty;

public string Name
{
get
{ return _Name; }
set
{ _Name = value; }
}
public void Insert() {
//Access to DAL
}
public void Delete() {
//Access to DAL
}
public void Update() {
//Access to DAL
}

public class Contact
{
private string _Name = string.Empty;

public string Name
{
get
{ return _Name; }
set
{ _Name = value; }
}

public void Insert()
{
//Access to DAL
}
public void Delete()
{
//Access to DAL
}
public void Update()
{
//Access to DAL
}

}

}
because that sucks...

i have to declare the Client class...if i want to access the Contacts
form a Client i have to:

Client.Contact Contact = new Client.Contact();
Contact.Name..etc..

need help please...

thanks in advance...

Sep 5 '07 #1
3 1250

You can check my example at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!140.entry

I have a strong inclination to seperate the Client class from the class
(ClientManager or ClientController) that creates the Client class.

Please note a difference between N-Layered and N-Tiered designs. My example
is N-Layered, because all code is deployed on a single machine.

Go a google search for N-Tier and N-Layer and you'll find defintions for
them.
Good luck.


"IsRaEl" <yz****@gmail.comwrote in message
news:11**********************@r29g2000hsg.googlegr oups.com...
Hello everyone,

I'm with a lot of questions about how to design a n-Tier, how to do
the code how to organize, and all the samples that i find, are with
only one table, one class with DataAcess, i need something more
"Complex"..

maybe you guys have a little sample with maybe a User class, and a
UserGroup class that is related with the User class...and a Project
class that is connected with a Client class that is connected with a
ClientContacts class...and the Project class have a ProjectStatus...

my biggest doubt is what should i do when designing them???

is this right?

public class Client
{
private string _Name = string.Empty;

public string Name
{
get
{ return _Name; }
set
{ _Name = value; }
}
public void Insert() {
//Access to DAL
}
public void Delete() {
//Access to DAL
}
public void Update() {
//Access to DAL
}

public class Contact
{
private string _Name = string.Empty;

public string Name
{
get
{ return _Name; }
set
{ _Name = value; }
}

public void Insert()
{
//Access to DAL
}
public void Delete()
{
//Access to DAL
}
public void Update()
{
//Access to DAL
}

}

}
because that sucks...

i have to declare the Client class...if i want to access the Contacts
form a Client i have to:

Client.Contact Contact = new Client.Contact();
Contact.Name..etc..

need help please...

thanks in advance...

Sep 5 '07 #2
IsRaEl wrote:
I'm with a lot of questions about how to design a n-Tier,
I think you question is about an object model and rather unrelated
to n-tier (and n-layer).
how to do
the code how to organize, and all the samples that i find, are with
only one table, one class with DataAcess, i need something more
"Complex"..

maybe you guys have a little sample with maybe a User class, and a
UserGroup class that is related with the User class...and a Project
class that is connected with a Client class that is connected with a
ClientContacts class...and the Project class have a ProjectStatus...

my biggest doubt is what should i do when designing them???

is this right?

public class Client
{
private string _Name = string.Empty;

public string Name
{
get
{ return _Name; }
set
{ _Name = value; }
}
public void Insert() {
//Access to DAL
}
public void Delete() {
//Access to DAL
}
public void Update() {
//Access to DAL
}

public class Contact
{
private string _Name = string.Empty;

public string Name
{
get
{ return _Name; }
set
{ _Name = value; }
}

public void Insert()
{
//Access to DAL
}
public void Delete()
{
//Access to DAL
}
public void Update()
{
//Access to DAL
}

}

}
because that sucks...

i have to declare the Client class...if i want to access the Contacts
form a Client i have to:

Client.Contact Contact = new Client.Contact();
Contact.Name..etc..
I would move Contacts class out of Client class.

I would prefer to have the DAL access storing/retrieving/modifying
class X outside of class X.

I would have a constructor with argument (and one without).

Arne

Sep 9 '07 #3
Arne Vajhøj wrote:
I would move Contacts class out of Client class.

I would prefer to have the DAL access storing/retrieving/modifying
class X outside of class X.

I would have a constructor with argument (and one without).
Note that the above is just some comments to the posted code not what
is necessary for a good object model.

Arne
Sep 9 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by tstephan | last post: by
25 posts views Thread by Stuart Hilditch | last post: by
5 posts views Thread by Ryan Ternier | last post: by
reply views Thread by Jon Vaughan | last post: by
reply views Thread by Jon Vaughan | last post: by
122 posts views Thread by ivan | last post: by
reply views Thread by fra | last post: by
reply views Thread by leo001 | last post: by

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.