Namespaces and Naming conventions

Discussion in 'ASP .Net' started by Floppy Jellopy, Jul 20, 2005.

  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" <> 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, Jul 20, 2005
    #1
    1. Advertising

  2. 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/d...ef/html/cpconnetframeworkdesignguidelines.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" <> 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, Jul 20, 2005
    #2
    1. Advertising

  3. Floppy Jellopy

    michaeltorus Guest

    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, Jul 21, 2005
    #3
  4. Floppy Jellopy

    Karl Seguin Guest

    Mike:
    You can take a look at the great:
    http://msdn.microsoft.com/library/d...ef/html/cpconnetframeworkdesignguidelines.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" <> 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, Jul 21, 2005
    #4
  5. 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/d...ef/html/cpconnetframeworkdesignguidelines.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" <> 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, Jul 21, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom Parson
    Replies:
    2
    Views:
    488
    Bjorn Abelli
    May 22, 2006
  2. Adekoba
    Replies:
    5
    Views:
    269
    Steve Holden
    Feb 24, 2008
  3. Tom Anderson
    Replies:
    24
    Views:
    4,769
    Peter Flynn
    May 19, 2009
  4. Joe Kesselman
    Replies:
    0
    Views:
    624
    Joe Kesselman
    May 11, 2009
  5. Peter Flynn
    Replies:
    0
    Views:
    647
    Peter Flynn
    May 13, 2009
Loading...

Share This Page