Uhm. 10000 classes probably mean:
1) Your developers use functors/algorithms implemented as classes and not freestanding functions/lambdas. If they are stateless, then that's just a matter of taste.
2) Your developers in fact do not know how to separate data from algos.
3) Your C code has 10000 structures instead of classes.
Posted Jul 1, 2012 19:03 UTC (Sun) by khim (subscriber, #9252)
[Link]
Uhm. 10000 classes probably mean:
Sorry, I've messed up with relevant sentence. I meant not 10'000 classes (that'll be too extreme of a subsystem to rewrite in one go), but tens of thousand lines (spread over hundred or so small classes in dozen of files).
Your C code has 10000 structures instead of classes.
Not even close. It has couple of structures - but these are only used for testing. Production code just passes data around using regular variables (on registers if you use -O2). This means that a lot of things are just impossible to do without major refactoring/rewriting of the code (because the data is just not available where you need/want to have it), but why is that such a big deal? As long as the API is internal to this piece of code it's not a problem... and when you want to present API to the "outside world" you often want/need C API anyway...
C vs. C++ vs. ...
Posted Jul 1, 2012 19:32 UTC (Sun) by apoelstra (subscriber, #75205)
[Link]
The flip side of "data not there when you need it" is that you get much smaller scope (and therefore easier analysis, easier optimization, etc), and you also get guarantees that data will not be modified except by functions who specifically ask for it.
But that is a generic argument against OO-style abstractions, not necessarily an argument specifically for C.
C vs. C++ vs. ...
Posted Jul 1, 2012 20:27 UTC (Sun) by Cyberax (✭ supporter ✭, #52523)
[Link]
Again, having code split into small files is just a matter of taste. I prefer my files to be less than 1000-2000 LOCs (especially in plain C), so I can easily navigate them visually. It doesn't affect performance in any way.
C vs. C++ vs. ...
Posted Jul 1, 2012 22:36 UTC (Sun) by juliank (subscriber, #45896)
[Link]
Of course it does, if you have many internal functions, you can declare them static, if they are in the same unit. If you split them over multiple files, the compiler cannot inline them and/or the program needs to look them up at run-time (unless you use ELF symbol visibility).