1

I have been coding in java most of the time, and I also studied C and C++ at University. But I have never written a large C++ code from zero made of many files, as I have done in java with a file for each class.

I'd like to know some book or reference with exercises and examples made of many files and classes en C++, so I can face big C++ projects in the future.

Sorry if you feel this question is eternally repeated.

Roman Rdgz
  • 12,836
  • 41
  • 131
  • 207
  • If it's eternally repeated then why post it again? – Nick Feb 14 '12 at 14:03
  • 3
    http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list –  Feb 14 '12 at 14:03
  • Because I'm asking for a certain topic of C++, not looking for any C++ beginner's book – Roman Rdgz Feb 14 '12 at 14:04
  • You are looking for "many examples made of many files" so that you are able to "face big C++ projects" - if you have problems with "facing big C++ projects" then you definitely want to read one of these books from the book list. – LihO Feb 14 '12 at 14:06
  • Thanks Fanael, that's a great list to start with. Anyway, I'm asking because most books start and end with basics, not facing projects involving many files. – Roman Rdgz Feb 14 '12 at 14:10

3 Answers3

0

Large-Scale C++ Software Design, by John Lakos.

phimuemue
  • 34,669
  • 9
  • 84
  • 115
Laurent Couvidou
  • 32,354
  • 3
  • 30
  • 46
0

Frankly, it doesn't matter much which language you're using in the end. Good software design is good software design. I don't think you'll ever learn it from a single book - and most books that talk about that kind of thing are referring to designing large frameworks which I doubt you're doing.

Identify sub-components/functionalitities in your requirements that you can form into separate libaries (static or dynamic, read up on the difference). If you compartmentalize these components into libraries that can act independently of each other then you'll have loose coupling between libraries - and assuming you've correctly identified your sub-components, they should have high-cohesion (everything in a library is closely related).

Try and keep dependencies out of your header files whenever possible regardless of where you're coding - you should read up (even on google) about separating declaration from definition). There's a number of design patterns for this purpose (including PIMPL which I seem to be mentioning alot today).

Read the design patterns book by the Gang-of-Four, and do the above, and you'll be off to a good start. Also, assuming you're decent with C++, Effective C++ by Scott Meyers will talk about some of these topics in very helpful manners.

John Humphreys
  • 37,047
  • 37
  • 155
  • 255
-1

Good design is a key on large projects and it is doesn't matter which language do you use if you follow the OO concept. But for some best practices in c++ you could read this book: http://www.gotw.ca/publications/c++cs.htm

AlexTheo
  • 4,004
  • 1
  • 21
  • 35