Hello everyone,
Since SFML 2 will be released soon, and with the change in the naming convention, I thought this would be a good time to update all my 3 SFML projects - SFMLTheora, sfMod, and sfMidi.
Of course, I will have to change the code to reflect the changes in SFML 2, I will also change my naming convention to follow SFML2.
Aside from that, there are few changes I'm considering, mostly general stuffs which has nothing specific to any of the 3 libraries.
1.
Exception handling:
I used to hate these try-catch stuffs since they were a hassle and can get really messy and meddlesome at times, but recently after programming in C# and Java, I find that they aren't that bad at all, and can be really handy at times.
Currently, the 3 libraries handle errors by simply returning false. I've definitely faced some design problems since constructors can't have a return value, but those were somewhat solved without much problem. (I did know that exceptions could easily solve my problem, but as I mentioned above, I didn't like exceptions at that time).
The drawback to this is that I can't get more info on the error (i.e. why it failed). While this may not be a problem for most case, I do think it will prove to be very useful for debugging purposes. (I debug by placing std::cout<<123 or std::cout<<"lol"; at suspicious places all this time
)
I'm not too sure about this, but with exceptions, the code on the user-end would probably look much cleaner and organized (at least I hope it will be).
However, it will also, at the same time, make your code longer:
if (!vid.Load("video.ogg"))
return 1;
will become
try {
vid.Load("video.ogg")
}
catch (exception ex) {
// handle exception
}
So, tell me which do you prefer (and would like to see in the next version of the 3 libraries above, as well as any future SFML projects I may write) by voting above, and if possible, tell me your reasons, or at least say something about it.
2. NamespaceCurrently, the namespaces I use for each projects are their respective project names, SFMLTheora for SFMLTheora, sfMod for sfMod, sfMidi for sfMidi.
I've been thinking of changing SFMLTheora to something shorter, and might as well shorten the other 2 as well (or are they good enough as is?)
Here are what I currently have in mind:
- sfth for SFMLTheora
- sfmo for sfMod
- sfmi for sfMidi
Another alternative for sfMod and sfMidi would be sfmod and sfmidi respectively, which do you prefer?
Edit: Another suggestion by Nexus for the namespace of SFMLTheora: sftheora
If I decide to go with sftheora, I will most probably change the project name to sfTheora as well, to match the namespace and the other 2 libraries.
It would be great if I can hear some opinions on this as well, especially for sfmo and sfmi.