![]() |
|
|
|||||||
![]() |
ASP Net - Namespaces and Naming conventions |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
How can you already have a web app if you haven;t even determined your namespacing? Ask yourself this: What makes a person object and how can i have one at both the BOL and the DAL? And frankley unless this is a class library...which its not..... who cares? "michaeltorus" <michaeltours@-NOSPAM-btinternet.com> wrote in message news:%... > HI > > I've got an n-tier web app. The namespaces follow the layers in that I've got a DAL namespace, a BOL namespace and a WEB namespace > > What I'm tring to decide is the naming convention for my classes. > > Theres 2 scenarios, firstly, Let's use a person object as an example: > > If I name my person classes in both the DAL Layer and BOL layer to be ... > > namespace BOL > { > class Person > {} > } > > namespace DAL > { > class Person > {} > } > > > > Then, whenever I create a person from the DAL Layer I have to reference it by using the qualified name: > > namespace BOL > { > class Person > { > private DAL.Person _person = new DAL.Person(); > } > } > > > The other scenario is to declare my person objects with e suffix of the layer they reside in, so I can use the namespaces at the top without having to include the fully qualified name each time I create a DAL object: > > using DAL; > > namespace BOL > { > class PersonBol > { > private PersonDal _personDal = new PersonDal(); > } > } > > > > I'd like to know what is the preferred Method or standard for these kind of things .... > > Also, Bear in mind the the full length of the namespaces is actually 4 or 5 words ..... > > Cheers > > Mike > > > > > --- > Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/ Floppy Jellopy |
|
|
|
|
#2 |
|
Posts: n/a
|
I disagree. The timer class you speak of is actually a timer in both instances. A Person at the BOL might well be a Person but at the DAL would be a PersonProvider. The two have very different reasons for being and would not contain the same properties etc. Either way this post has nothing whatsoever to do with asp.net other than the fact that it happens to be asp.net application type. Its ironic that the poster is expressing a concern for namespacing best practises when they cant even get their message posted to the correct newsgroup namespace. > Even Microsoft has some problems with this sort of issue. For example, there > is a Timer class in 2 different namespaces in the .Net platform. I don't > know that there's a "right" way or "wrong" way to deal with it. Sometimes a > class name just is more understandable with a certain name, and using the > NameSpace solves the problem. Using "using" or "imports" statements, while > convenient, doesn't preclude the use of a NameSpace here and there from time > to time. > > -- > HTH, > > Kevin Spencer > Microsoft MVP > .Net Developer > The sun never sets on > the Kingdom of Heaven > > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> > wrote in message news:... > > Mike: > > You can take a look at the great: > > http://msdn.microsoft.com/library/de...guidelines.asp > > > > which has advice on naming guidelines. I'm not sure that you'll find > > anything specific to your problem though. > > > > To be honest, I don't understand why you DAL has a class named "Person" in > > it? Seems to me your DAL should be mapping between your relational store > > and your business layer...why then would it be Person aware? > > > > DataProvider.GetInstance.GetPerson(int userId); > > DataProvider.GetInstance.GetPerson(string userName); > > > > no? > > > > Karl > > > > -- > > MY ASP.Net tutorials > > http://www.openmymind.net/ - New and Improved (yes, the popup is > > annoying) > > http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to > > come!) > > "michaeltorus" <michaeltours@-NOSPAM-btinternet.com> wrote in message > > news:%... > >> HI > >> > >> I've got an n-tier web app. The namespaces follow the layers in that I've > >> got a DAL namespace, a BOL namespace and a WEB namespace > >> > >> What I'm tring to decide is the naming convention for my classes. > >> > >> Theres 2 scenarios, firstly, Let's use a person object as an example: > >> > >> If I name my person classes in both the DAL Layer and BOL layer to be .... > >> > >> namespace BOL > >> { > >> class Person > >> {} > >> } > >> > >> namespace DAL > >> { > >> class Person > >> {} > >> } > >> > >> > >> > >> Then, whenever I create a person from the DAL Layer I have to reference > >> it by using the qualified name: > >> > >> namespace BOL > >> { > >> class Person > >> { > >> private DAL.Person _person = new DAL.Person(); > >> } > >> } > >> > >> > >> The other scenario is to declare my person objects with e suffix of the > >> layer they reside in, so I can use the namespaces at the top without > >> having to include the fully qualified name each time I create a DAL > >> object: > >> > >> using DAL; > >> > >> namespace BOL > >> { > >> class PersonBol > >> { > >> private PersonDal _personDal = new PersonDal(); > >> } > >> } > >> > >> > >> > >> I'd like to know what is the preferred Method or standard for these kind > >> of things .... > >> > >> Also, Bear in mind the the full length of the namespaces is actually 4 or > >> 5 words ..... > >> > >> Cheers > >> > >> Mike > >> > >> > >> > >> > >> --- > >> Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/ > > > > > > Floppy Jellopy |
|
|
|
#3 |
|
Posts: n/a
|
H
I've got an n-tier web app. The namespaces follow the layers in that I've got a DAL namespace, a BOL namespace and a WEB namespac What I'm tring to decide is the naming convention for my classes. Theres 2 scenarios, firstly, Let's use a person object as an example If I name my person classes in both the DAL Layer and BOL layer to be .. namespace BO class Perso { namespace DA class Perso {} Then, whenever I create a person from the DAL Layer I have to reference it by using the qualified name namespace BO class Perso private DAL.Person _person = new DAL.Person() The other scenario is to declare my person objects with e suffix of the layer they reside in, so I can use the namespaces at the top without having to include the fully qualified name each time I create a DAL object using DAL namespace BO class PersonBo private PersonDal _personDal = new PersonDal() I'd like to know what is the preferred Method or standard for these kind of things ... Also, Bear in mind the the full length of the namespaces is actually 4 or 5 words .... Cheer Mik --- Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/ michaeltorus |
|
|
|
#4 |
|
Posts: n/a
|
Mike:
You can take a look at the great: http://msdn.microsoft.com/library/de...guidelines.asp which has advice on naming guidelines. I'm not sure that you'll find anything specific to your problem though. To be honest, I don't understand why you DAL has a class named "Person" in it? Seems to me your DAL should be mapping between your relational store and your business layer...why then would it be Person aware? DataProvider.GetInstance.GetPerson(int userId); DataProvider.GetInstance.GetPerson(string userName); no? Karl -- MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!) "michaeltorus" <michaeltours@-NOSPAM-btinternet.com> wrote in message news:%... > HI > > I've got an n-tier web app. The namespaces follow the layers in that I've > got a DAL namespace, a BOL namespace and a WEB namespace > > What I'm tring to decide is the naming convention for my classes. > > Theres 2 scenarios, firstly, Let's use a person object as an example: > > If I name my person classes in both the DAL Layer and BOL layer to be ... > > namespace BOL > { > class Person > {} > } > > namespace DAL > { > class Person > {} > } > > > > Then, whenever I create a person from the DAL Layer I have to reference it > by using the qualified name: > > namespace BOL > { > class Person > { > private DAL.Person _person = new DAL.Person(); > } > } > > > The other scenario is to declare my person objects with e suffix of the > layer they reside in, so I can use the namespaces at the top without > having to include the fully qualified name each time I create a DAL > object: > > using DAL; > > namespace BOL > { > class PersonBol > { > private PersonDal _personDal = new PersonDal(); > } > } > > > > I'd like to know what is the preferred Method or standard for these kind > of things .... > > Also, Bear in mind the the full length of the namespaces is actually 4 or > 5 words ..... > > Cheers > > Mike > > > > > --- > Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/ Karl Seguin |
|
|
|
#5 |
|
Posts: n/a
|
Even Microsoft has some problems with this sort of issue. For example, there
is a Timer class in 2 different namespaces in the .Net platform. I don't know that there's a "right" way or "wrong" way to deal with it. Sometimes a class name just is more understandable with a certain name, and using the NameSpace solves the problem. Using "using" or "imports" statements, while convenient, doesn't preclude the use of a NameSpace here and there from time to time. -- HTH, Kevin Spencer Microsoft MVP ..Net Developer The sun never sets on the Kingdom of Heaven "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:... > Mike: > You can take a look at the great: > http://msdn.microsoft.com/library/de...guidelines.asp > > which has advice on naming guidelines. I'm not sure that you'll find > anything specific to your problem though. > > To be honest, I don't understand why you DAL has a class named "Person" in > it? Seems to me your DAL should be mapping between your relational store > and your business layer...why then would it be Person aware? > > DataProvider.GetInstance.GetPerson(int userId); > DataProvider.GetInstance.GetPerson(string userName); > > no? > > Karl > > -- > MY ASP.Net tutorials > http://www.openmymind.net/ - New and Improved (yes, the popup is > annoying) > http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to > come!) > "michaeltorus" <michaeltours@-NOSPAM-btinternet.com> wrote in message > news:%... >> HI >> >> I've got an n-tier web app. The namespaces follow the layers in that I've >> got a DAL namespace, a BOL namespace and a WEB namespace >> >> What I'm tring to decide is the naming convention for my classes. >> >> Theres 2 scenarios, firstly, Let's use a person object as an example: >> >> If I name my person classes in both the DAL Layer and BOL layer to be ... >> >> namespace BOL >> { >> class Person >> {} >> } >> >> namespace DAL >> { >> class Person >> {} >> } >> >> >> >> Then, whenever I create a person from the DAL Layer I have to reference >> it by using the qualified name: >> >> namespace BOL >> { >> class Person >> { >> private DAL.Person _person = new DAL.Person(); >> } >> } >> >> >> The other scenario is to declare my person objects with e suffix of the >> layer they reside in, so I can use the namespaces at the top without >> having to include the fully qualified name each time I create a DAL >> object: >> >> using DAL; >> >> namespace BOL >> { >> class PersonBol >> { >> private PersonDal _personDal = new PersonDal(); >> } >> } >> >> >> >> I'd like to know what is the preferred Method or standard for these kind >> of things .... >> >> Also, Bear in mind the the full length of the namespaces is actually 4 or >> 5 words ..... >> >> Cheers >> >> Mike >> >> >> >> >> --- >> Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/ > > Kevin Spencer |
|