by mh » Mon Jan 25, 2010 10:14 pm
Not necessarily always better. If an algorithm or other piece of logic is best and most clearly expressed procedurally then I say "code it procedurally" - going OO with it can only lead to obfuscation (the reverse is also true).
Writing the code first time round is only half the battle remember; you have to maintain it going forward, and the person who takes over your job when you've left (or who fills in for you when you're on leave) will also have to maintain it.
Regarding compile times, DirectQ is C++ (purely to make DirectX calls easier) and I would guess it takes on average 5 to 10 times longer to compile than Win/GL/DarkPlaces/etc (or at least it certainly feels like it does). When you're measuring compile times in seconds that's peanuts; for really large projects you've probably just lost a few hours productivity (you may not have the luxury of nightly builds if you need to get a critical bugfix done now).
For the record, DirectQ does use classes in certain parts of it's code: the menus are all OO (there's even some multiple inheritance in there), cvars and commands are OO, the progs interpreter is OO, lightmaps are OO (although in hindsight they didn't really need to be), memory is OO. The renderer and base client and server code are purely procedural however and I don't see a convincing argument for going OO with them.