Saturday, October 4, 2008

Namespaces are cities

I was paging through Ron Penton's "Beginning C# Game Programming" tonight and in chapter 4 he covers into the topic of namespaces.

He uses an interesting metaphor to describe namespaces that never crossed my mind: Cities

I'll paraphrase a bit...

If you tell someone merely that you live on Main Street that's not really telling them very much information. You need to tell them the name of the city too. Think of the namespace as the name of the city and the class as the street. He goes on to explain that Direct3D and DirectSound both contain classes called Device. It's really the namespace that differentiates them.


While I think this works, it doesn't really resonate with me.

I'd like to hear what you think.

No comments: