Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Namespaces and Naming conventions

 
Thread Tools Search this Thread
Old 07-20-2005, 01:22 PM   #1
Default Re: Namespaces and Naming conventions



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
  Reply With Quote
Old 07-20-2005, 11:20 PM   #2
Floppy Jellopy
 
Posts: n/a
Default Re: Namespaces and Naming conventions

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
  Reply With Quote
Old 07-21-2005, 09:48 AM   #3
michaeltorus
 
Posts: n/a
Default Namespaces and Naming conventions
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
  Reply With Quote
Old 07-21-2005, 01:01 PM   #4
Karl Seguin
 
Posts: n/a
Default Re: Namespaces and Naming conventions
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
  Reply With Quote
Old 07-21-2005, 02:36 PM   #5
Kevin Spencer
 
Posts: n/a
Default Re: Namespaces and Naming conventions
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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46