Web Hosting Talk







View Full Version : define namespace???


Akash
04-08-2002, 07:54 PM
okay....who can define namespace in layman's terms??

ScottD
04-08-2002, 08:14 PM
Depends on your context. Here are a few uses of namespaces.

C++
Namespaces provide a way to group logical declarations. For example, the Standard C++ Library is in the namespace std. This avoids any possible conflicts later on if you are to create your own functions or objects that have the same names as those in the std namespace. The real benefit here is that you can write a library in your own namespace and never worry about conflicting with another vendor.

A sample:
namespace scott {
class MyObject { ... } ;
}; // namespace scott

namespace joe {
class MyObject { ... } ;
}; // namespace joe

// now declare...
scott::MyObject scottsObject; // declares scotts MyObject
joe::MyObject joesObject; // declares joes MyObject

// or...
using namespace scott;
MyObject scottsObject; // declares scotts MyObject
joe::MyObjet joesObject; // declares joes MyObject

Java
Similar to C++, but uses the package / import stuff.

XML
Very important to XML in that when you define an XML Schema you have to provide a namespace for which it is to be validated against. I haven't done a lot of this so have no first hand experience, but its purpose is to same -- to provide a logical grouping that will not conflict with others.

Now, what context are you speaking in? I am sure there are plenty of others.

JayC
04-08-2002, 08:19 PM
Depends on the context, but essentially a set or collection of names in which all the names are unique; and it's sometimes used to refer to the common portion of a contiguous or related group of names.

The buzz right now about "namespace" is related to xml, so if you're talking about that specifically... well, it can't be explained in "layman's terms." :)

Akash
04-08-2002, 08:21 PM
hmm...didn't know that....

it's for a networking course i'm finishing up....i think it has to do with dns services, but im really confused and the book doesn'texplain it very well :(

AussieHosts
04-08-2002, 08:26 PM
In a DNS context, it is often used to refer levels of domains.

domain.com domains are in the TLD namespace
domain.com.au domains are in the Australian ccTLD namespace

and so on. Each one being a segment of namespace, containing unique records.

Cheers

Gary

Akash
04-08-2002, 08:28 PM
Originally posted by Editor
In a DNS context, it is often used to refer levels of domains.

domain.com domains are in the TLD namespace
domain.com.au domains are in the Australian ccTLD namespace

and so on. Each one being a segment of namespace, containing unique records.

Cheers

Gary


now why couldn't the book just put it that way???

if anyone else has any other explanations i'd love to hear them

thanks for all ur replies:D

JayC
04-08-2002, 08:41 PM
Originally posted by akashd
i think it has to do with dns servicesCould be. DNS namespace still fits the original general definition: all the names are unique. Essentially DNS defines a namespace hierarchy. If your domain name is mydomain.com, all of your machines will have names within the mydomain.com namespace.

Of course you could use DNS internally on a network that's not connected to the internet, so your DNS namespace doesn't necessarily have to include internet-related TLDs.