Berend
Hi there,
Newbie question!
I'm only at day 30 and until now almost all functions are prefixed with 'Game' or 'Win32' and types likewise. I've looked at Caseys latest commit and it seems that he stopped prefixing the Game code after a while.
What is the reason not to structure code into namespaces? Is it searchability? Or because it is trivial because you can just name a function whatever you want?
Dont you benefit from knowing about the context of a function and allowing them to use the same name if they want to?
Something like this?
Game::GetState();
Game::Entity::GetState();
Game::Sound::AudioSource::GetState();
Thanks!
Do you need to be reminded you are building a game?
Namespaces are meant to avoid name collisions. Not to organize your code into a hierarchy. In C, code isn't organized into hierarchies, id ir organized into files.
Your examples hint that you are thinking in OOP, so I will direct you to the many fine examples on the site of why that is bad according to Casey.
Also, we are using function overloading, which means we know what a function is doing both by its name and the data it is working on.