So in my adventure of trying to figure out how to implement object orientation into Drupal 7 (preparing for the imminent move to Drupal 8), I've come to the point of trying to figure out namespaces. Now, the last time I used a legitimate namespace was about 7 years ago in my freshman C++ course (cstdlib anyone?), so I'm putting on my nostalgia goggles for this one. I started my project by creating a class
ClassName.php inside of a folder ('cause I am organized like that), then, in standard Drupal 7 fashion, I included it in the .info file, like so:
I proceeded to call my new class in my code elsewhere;
$thing = new ClassName();. It worked! All was right in my world. Then I decided, "hmm... You know since I'm so new at this, I should have a friend who knows a little more about OO in PHP look at this and tell me if things look right!". Sure enough, I get approval from my friend. "Dude, your private and public functions look great and your module is pretty awesome!", he says. So I'm on top of the world at that moment, i'm learning new stuff and the stuff is working. Then he drops the bomb, "If you really want to get into good OO habits for PHP, you should start using namespaces." Namespaces sound pretty hacker to me, i'm in.