Results 1 to 10 of 10

Thread: Anyone know about namespaces?

  1. #1

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    A namespace is basically a logical grouping of classes, you already know. You use them in order to avoid conflicting code, you use them to logically organize your classes.

    Whenever you write a class for a class library, it's best to give it a namespace. Reason: So that if anyone else wants to use it, they have an idea what it's about.

    Pretty simple answer though, do you have any specific Q?

  3. #3

  4. #4

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Also...if I was writing some forum software...what should I call the project, and what should I call the solution?
    Should I call them both "WokaForums"???

    Woka

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by Wokawidget
    So...a name space per function then?

    Woof
    A namespace for a GROUP of classes, then.

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by Wokawidget
    Also...if I was writing some forum software...what should I call the project, and what should I call the solution?
    Should I call them both "WokaForums"???

    Woka
    Call them whatever you like. Just be sure to make your namespaces "scalable" ( I wouldn't know the proper term)

    It could be something like

    Wokawidget.WebSolutions.Forums.WokaForums

    Edit:

    So that, in the future, if you made an email client one day, you'd name it

    Wokawidget.WinSolutions.Email.WokaMail

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by Wokawidget
    So...a name space per function then?

    Woof
    OK, I have an example:

    I am currently working on the sandpaper project. I am making a Meaning Of Life generator. This generator consists of three classes for whatever reasons.

    I have given it the namespace

    Sandpaper.MeaningOfLife

    Meanwhile, wossname would be working on the eleventh commandment, and he'd call it

    Sandpaper.EleventhCommandment

    which itself consists of say, 15 classes.

    See where I'm going?

  8. #8
    Addicted Member
    Join Date
    Dec 2002
    Posts
    175
    .... also
    one of your developers decided to incorporate widgets from WobblyWidgets - guess what? They also developed code for MeaningOfLife (it's a very popular area of software engineering right now!)
    But because there's is in the namespace WobblyWidgets there is no conflict because its WobblyWidgets.MeaningOfLife.

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Yes, but you really have to wonder about this trend. They all end up giving us 42 as an answer anyways.

  10. #10
    Addicted Member
    Join Date
    Dec 2002
    Posts
    175

    Wink

    Ah!! But now you can use polymorphism and also get the answer Mice!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width