No one have issues with source code files 5100 lines long? https://github.com/dhewm/dhewm3/blob/master/neo/game/ai/AI.c...
You make it sound like it is a single 5100 line long method. It seems actually very well organised in that file. If you're using any kind of IDE then this wouldn't bug you as you can just jump to the point in the file you need.
Doom3 is the proof that “keep it simple” works
61–70 of 111 posts
Re: Doom3 is the proof that “keep it simple” works
#62Re: Doom3 is the proof that “keep it simple” works
#63"As we can observe many structs are defined, for example more than 40% of DoomDLL types are structs. They are systematically used to define the data model. This practice is adopted by many projects, this approach has a big drawback in case of multithreaded applications. Indeed, structs with public fields are not immutable."
Re: Doom3 is the proof that “keep it simple” works
#64Re: Doom3 is the proof that “keep it simple” works
#65Earlier quoted context omitted.
Not a definitive list, but these are good: The C++ Programming Language, 4th edition Bjarne Stroustrup The C++ Standard Library, 2nd Edition Nicolai M. Josuttis Effective C++, More Effective C++, Effective Modern C++ Scott Meyers http://en.cppreference.com
I would also add Effective STL too. A Tour of C++ by B. Stroustrup is a good start point for a beginner too
Exceptional C++ by Herb Sutter
More Exceptional C++ by Herb Sutter
Exceptional C++ Style by Herb Sutter
And Templates:
C++ Templates: The Complete Guide by Josuttis & Vandevoorde
And of course you need some background in generic & metaprogramming, so add:
Modern C++ Design by Alexandrescu
Advanced C++ Metaprogramming by Gennaro
So you're looking at over ten books. What does this say about C++? Can you think of another language that has a ten book prerequisite?
Re: Doom3 is the proof that “keep it simple” works
#66Earlier quoted context omitted.
What's wrong with this?
Over 150 lines of code in a simple method? C-style declaration of all the variables in the beginning? (Yes, I know what Carmack said about how he written the project; this explains it, but doesn't make it good C++ code.) Unclear flow with just one comment, which doesn't really explain anything?
Notice, though, that each section is pretty straightforward in what it does...basically forEach's.
You could make the argument for greater polymorphism in types, or something like a visitor pattern over collections or something, but honestly this is readable and maintainable code.
More comments at the function declaration would've been nice, but the implementation is pretty straightforward.
Re: Doom3 is the proof that “keep it simple” works
#67Earlier quoted context omitted.
append ?ts=4 to the URL to change GitHubs default 8 character tab to 4 characters wide.
Is that really a GitHub thing? When I view diffs in the command line with Git, it always shows tabs as 8 spaces too.
diff --tabsize=4 ...
vim "+set tabstop=4" ...
http://github.com/.../file?ts=4Re: Doom3 is the proof that “keep it simple” works
#68If you read this article and agreed with it, you should definitely read this next: http://lesswrong.com/lw/dr/generalizing_from_one_example/
But if the argument is "'keep it simple' works for some software projects," one example proves the point. This seems the more generous interpretation.
Re: Doom3 is the proof that “keep it simple” works
#69https://github.com/dhewm/dhewm3/blob/master/neo/game/Target.... This is the "nicest looking code [you] have ever seen" ?
Any critiques in specific?
if ( ent->GetRenderEntity()->gui[ j ] &&
ent->spawnArgs.FindKey( j == 0 ? "gui_demonic" : va(
"gui_demonic%d", j+1 ) ) ) { ent->GetRenderEntity()->gui[
j ] = uiManager->FindGui( ent->spawnArgs.GetString( j == 0
? "gui_demonic" : va( "gui_demonic%d", j+1 ) ), true );
Really?Re: Doom3 is the proof that “keep it simple” works
#70Earlier quoted context omitted.
Any critiques in specific?
if ( ent->GetRenderEntity()->gui[ j ] && ent->spawnArgs.FindKey( j == 0 ? "gui_demonic" : va( "gui_demonic%d", j+1 ) ) ) { ent->GetRenderEntity()->gui[ j ] = uiManager->FindGui( ent->spawnArgs.GetString( j == 0 ? "gui_demonic" : va( "gui_demonic%d", j+1 ) ), true ); Really?