Part 21 - Learning Namespaces for Beginners
Written by Eric Muss-Barnes, 3 January 2019Namespaces are a concept I never even heard about, until I was working at Walt Disney Studios and a fellow developer insisted I use them for a project I was assisting him with. I had no idea what he was talking about when he asked me to "namespace my variables".
Huh?
Turns out, namespaces are one of the dumbest, most convoluted and pointless methodologies of coding I have ever seen.
You know what they are? Namespaces are variables... for variables. I've taught you about variables in past articles. Variables are great. Variables are useful. But why on earth would you need a variable for a variable? Because when working on a large project with multiple people, it's possible another programmer might pick the same word. For example, if you have a website with multiple order forms and a sign-up pages, those pages might use a variable called "firstname" and you need to make sure those variables don't conflict later in the database. People with brains can easily see, you avoid this problem of duplicates by inventing very explicit variable names - "signupfirstname" and "orderfirstname" for example. Programming nerds came up with this moronic solution called a "namespace" which is basically a block of code, which encapsulates a variable, assigned to the variable.
Seriously? That's the best these dunces could come up with?
Assigning a namespace involves about quadruple as many lines of code, making things far more complicated than it need be. All a smart person would do to alleviate the potential conflict is use better naming conventions. All a computer science fool does to fix his code... is write more code! That's like deliberately adding ten miles onto your commute, but calling it a "short cut". You have to be an idiot to think that way! Truly "namespaces" are one of the most ignorant, illogical, senseless solutions to a problem any intelligent person could imagine. But, we're not talking about intelligent people. We're talking about trendy computer nerds who want to be cool.
When I tried to ask the fellow developer at Disney the reason why he was using namespaces, his answer was, "That's the standard."
...What?
What on earth are you talking about!?
"That's the standard?"
That's not an answer! The "standard" what? Who sets this "standard" for you?
But, like a mindless robot, he was incapable of elaborating on that statement. "That's the standard." was all he could say. No capacity to think. No ability to rationalize. Only regurgitate.
Computer technology, most especially Internet technology, by it's very nature, is about innovation. About exploration. About experimentation. About thinking outside the box and coming up with creative solutions to problems. Rebels. Pirates. Pioneers. The Wild West! The cutting-edge! That is computer science. Computer technology is not about conformity and obedience. But, to him, it was.
"That's the standard." (bleep)
"That's the standard." (bleep)
"That's the standard." (bleep)
"That's the standard." (bleep)
All a bunch of lemmings.
Developers use namespaces just because some idiot college professor programmed them to think that way. Don't think like them. Think for yourself.
By the time you read this, "namespaces" will undoubtedly be deemed unhip and replaced by some newer, even-more-idiotic workflow.
I understand they are doing sophisticated programming.
I understand they make $50,000 more than I do.
I understand they have a Masters degree.
I understand they posses skills which exceed my own.
I understand they still aren't bright enough to impress me. "Sophisticated" doesn't automatically equal "intelligent". After all, he was completely incapable of articulating any reasoning behind his programming.
Are you going to make code that is useful or useless? Smart or ignorant? It's up to you, my students. But I think you will want to make code that is sensible.
Because remember, kids, the world owes you nothing... until you create things of value.
Glossary
namespace
A variable... assigned to a variable. Which is about as sensible as poop-flavored chewing gum.Other Articles