3 ms·
> Point being, writing code that would otherwise be "abstract" in Java-land implies (but rarely explicitly defines!) some rigidity in design with respect to how
by cbsmith 10y ago
> Point being, writing code that would otherwise be "abstract" in Java-land implies (but rarely explicitly defines!) some rigidity in design with respect to how long objects need to be around for different threads to use them.
C++ allows you to have much more tightly defined contracts, which tends to be helpful, but you can have very loosely defined contracts (such as with shared ptr). It just turns out that such loose semantics aren't often found to be helpful in the C++ world.
- humanrebar 10y agoMy point was that you can easily stumble into a tight contract (at least in certain respects) in C++. At any rate, it's something that Java-school teachers like Bob Martin don't tend to cover. And I'm not aware of very comprehensive books on C++ design principles.
- cbsmith 10y agoIt may surprise you to know Uncle Bob has written C++ design books as well. ;-) There are lots of books on C++ design that focus particularly on the semantics of contracts that are comparatively unique to C++ (Sutter, Meyers, Alexandrescu, and Abrams all have a pretty established following). Indeed, I'd argue C++ is one of the few languages where you really need to read a lot of the supporting literature before you are much of a useful coder.
- Ace17 10y agoRobert C Martin - Agile Software Development: Principles, Patterns, and Practices There's now an updated version of this book for C# but the first one deals with C++. This book explains, in details, how to architecture your application around use cases. "Game Coding Complete 5" also talks about moderately large scale C++ high-level design. Of course, it's focused on games, but unlike other game programming books, it deals with things like dependency inversion, abstracting away the framework, data-driven architectures, etc. It's surprisingly hard to find books talking about high-level software architecture ; Amazon is flooded with technology-specific books (things like "Learn <insert framework name> in 7 days", whose lifetime is so short, you wonder, why write a book about this in the first place).