|
-
Sep 21st, 2004, 02:54 AM
#1
Anyone know about namespaces?
Why, when and where should you use namespaces?
Woof?
-
Sep 21st, 2004, 03:31 AM
#2
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?
-
Sep 21st, 2004, 03:36 AM
#3
So...a name space per function then?
Woof
-
Sep 21st, 2004, 03:39 AM
#4
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
-
Sep 21st, 2004, 03:48 AM
#5
Originally posted by Wokawidget
So...a name space per function then?
Woof
A namespace for a GROUP of classes, then.
-
Sep 21st, 2004, 03:50 AM
#6
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
-
Sep 21st, 2004, 03:52 AM
#7
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?
-
Sep 21st, 2004, 05:46 AM
#8
Addicted Member
.... 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.
-
Sep 21st, 2004, 05:49 AM
#9
Yes, but you really have to wonder about this trend. They all end up giving us 42 as an answer anyways.
-
Sep 21st, 2004, 05:51 AM
#10
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|