Reddit Reddit reviews Modern C++ Design: Generic Programming and Design Patterns Applied

We found 24 Reddit comments about Modern C++ Design: Generic Programming and Design Patterns Applied. Here are the top ones, ranked by their Reddit score.

Computers & Technology
Books
Computer Programming
Microsoft C & C++ Windows Programming
Microsoft Programming
Modern C++ Design: Generic Programming and Design Patterns Applied
Check price on Amazon

24 Reddit comments about Modern C++ Design: Generic Programming and Design Patterns Applied:

u/MrBushido2318 · 20 pointsr/gamedev

You have a long journey ahead of you, but here goes :D

Beginner

C++ Primer: One of the better introductory books.

The C++ Standard Template Library: A Tutorial and Reference: Goes over the standard template library in fantastic detail, a must if you're going to be spending a lot of time writing C++.

The C++ Programming Language: Now that you have a good idea of how C++ is used, it's time to go over it again. TCPPL is written by the language's creator and is intended as an introductory book for experienced programmers. That said I think it's best read once you're already comfortable with the language so that you can full appreciate his nuggets of wisdom.


Intermediate

Modern C++ Design: Covers how to write reusable C++ code and common design patterns. You can definitely have started game programming by the time you read this book, however it's definitely something you should have on your reading list.

C++ Templates: Touches on some similar material as Modern C++ Design, but will help you get to grips with C++ Template programming and how to write reusable code.

Effective C++: Practical advise about C++ do's and dont's. Again, this isn't mandatory knowledge for gamedev, but it's advice is definitely invaluable.

Design Patterns: Teaches you commonly used design patterns. Especially useful if you're working as part of a team as it gives you a common set of names for design patterns.

Advanced

C++ Concurrency in Action: Don't be put off by the fact I've put this as an "advanced" topic, it's more that you will get more benefit out of knowing the other subjects first. Concurrency in C++11 is pretty easy and this book is a fantastic guide for learning how its done.

Graphics Programming

OpenGL: A surprisingly well written specification in that it's pretty easy to understand! While it's probably not the best resource for learning OpenGL, it's definitely worth looking at. [edit: Mix it in with Open.gl and arcsynthesis's tutorials for practical examples and you're off to a good start!]

OpenGL Superbible: The OpenGL superbible is one of the best ways to learn modern OpenGL. Sadly this isn't saying much, in fact the only other book appears to be the "Orange Book", however my sources indicate that is terrible. So you're just going to have suck it up and learn from the OGL Superbible![edit: in retrospect, just stick to free tutorials I've linked above. You'll learn more from them, and be less confused by what is 3rd party code supplied by the book. Substitute the "rendering" techniques you would learn from a 3d book with a good 3d math book and realtime rendering (links below)]


Essential Mathematics for Game Programmers or 3D Math Primer for Graphics and Game Development: 3D programming involves a lot of math, these books cover topics that OpenGL/DirectX books tend to rush over.

Realtime Rendering: A graphics library independent explanation of a number of modern graphical techniques, very useful with teaching you inventive ways to use your newly found 3d graphical talents!

u/andralex · 15 pointsr/programming

I don't have any experience with Clay and have a vested interest in D, so take the following with a grain of salt.

Here are my impressions on Clay vs D2 after having read the brief docs on the wiki:

  • Clay seems to have no take on concurrency whatsoever. In fact even googling for Clay concurrency is quite difficult. D2 tackles concurrency issues directly with a no-default-sharing model.
  • I like Clay's syntax desugaring (what I call "lowering"), but it assigned a name for each operator, which I believe is adverse to generic programming. D2 lowers operators by passing the operator as a compile-time string into the function, which enables further generic processing.
  • Clay's iterators and coordinates seem to be similar to D's ranges. I'm unclear from the documentation provided about the pervasiveness of related entities and idioms in Clay. D2's ranges turned out to be wildly successful. Both use compile-time introspection to assess membership of a type to a concept. For example, in Clay you assess the presence of a member "size" like this:

    [S] SizedSequence?(static S) = Sequence?(S) and CallDefined?(size, S);

    whereas you do the same thing in D like this:

    template hasLength(R) {
    enum hasLength = isInputRange!R && is(typeof(R.init.length) == size_t);
    }

    I don't know how to enforce in Clay that the type of "size" is size_t; I'm sure there must be a way. And indeed the Clay version is shorter.

  • Clay mentions multiple dispatch as a major feature. Based on extensive experience in the topic I believe that that's a waste of time. Modern C++ Design has an extensive chapter on multiple dispatch, and I can vouch next to nobody uses it in the real world. Sure, it's nice to have, but its actual applicability is limited to shape collision testing and a few toy examples.
  • The docs offer very little on Clay's module system (which is rock solid in D2). The use of an antipattern in Clay's docs worries me though:

    import myownlib.test.*;

  • Both languages seem to pay attention to linking with C and assembling applications out of separate modules.
  • D2 is aggressively geared towards allowing its users to write correct code. Clay seems to have nothing else to say beyond a run-of-the-mill exception model.
  • Clay lacks object-oriented programming support, although it does offer a number of palliatives (discriminated unions, for which D2 has powerful library offerings). This design choice seems odd to me because I believe straight OOP is much more important than supporting the obscure multiple dispatch.

    Overall Clay's current offering (judging only by the docs) is very scarce compared to D2's. I found nothing in Clay that's sorely missing in D2, and conversely there's plenty in D2 that I'd sorely miss in Clay.

    Clay looks a lot like the toy language I was working on before deciding to build on D: long on hope, short on bread and butter. In hindsight, I am happy with the decision to start with a language (D1) in which I could take for granted a lot of stuff.
u/TheSuperficial · 6 pointsr/programming

Andrei Alexandrescu's "Modern C++ Design". It was so mind-expanding and well-written, not to mention useful, I was reading it for 2-3 hours a day until I finished it.

u/napperjabber · 4 pointsr/gamedev

Grab a book, find a project. Bunker down and nail it out.

I have a simular background; I learnt AS3, went onto JS/HTML, c#, java, python, c/c++. For my C, I picked up unix networking and for c++ I picked up modern c++ design.

From there, it's just a matter of getting dirty.

u/ClockworkV · 4 pointsr/cpp

"Modern C++ Design" by https://www.reddit.com/user/andralex might not be quite so modern anymore, but it does a good job of presenting the basic building blocks for TMP, especially if you want to do complex stuff with types. Many of the things presented there have since gone into the standard, but it's good to know what goes on in the background.

u/Crazy__Eddie · 2 pointsr/learnprogramming

I have not made anything up. I've described the long-standing accepted definition of the term. You don't just get to claim I'm making stuff up as if it were fact, sir.

> "smart pointer" is not a catch-all for any object with pointer-like behavior.

And that's not the way I described it. A smart pointer is an object that behaves like a regular pointer but is smarter in some way.

> Smart pointer (as opposed to a "dumb" or "raw" pointer) is a C++ structure that behaves almost identically to a common C pointer but it also includes some other capabilities, e.g. throws an exception when it's NULL and someone tries to dereference it, or it destroys its contents automatically when it goes out of scope.

http://www.csc.lsu.edu/~kosmas/smartPointers.html

> In computer science, a smart pointer is an abstract data type that simulates a pointer while providing additional features, such as automatic memory management or bounds checking.

http://en.wikipedia.org/wiki/Smart_pointer

> Smart pointers are objects that look and feel like pointers, but are smarter. What does this mean?

> To look and feel like pointers, smart pointers need to have the same interface that pointers do: they need to support pointer operations like dereferencing (operator *) and indirection (operator ->). An object that looks and feels like something else is called a proxy object, or just proxy. The proxy pattern and its many uses are described in the books Design Patterns and Pattern Oriented Software Architecture.

http://ootips.org/yonat/4dev/smart-pointers.html

> So what's a smart pointer? A smart pointer is a C++ class that mimics a regular pointer in syntax and some semantics, but it does more.

>...

> This is the mantra of smart pointers: You can replace pointer definitions with smart pointer definitions without incurring major changes to your application's code. You thus get extra goodies with ease.

http://www.amazon.com/Modern-Design-Generic-Programming-Patterns/dp/0201704315

And finally http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Smart_Pointer

Although I don't agree with most of the intent and motivation sections in that one and would never implement handle/body in that manner.

u/reventlov · 2 pointsr/programming

First, be prepared to write code that sucks and is unmaintainable for a while. (This could be months or years.)

If you only know Java, then you'll need some C concepts. In particular, you need to become familiar with pointer arithmetic, avoiding buffer overruns, and manual memory management. (C++ has ways (RAII) to make manual memory management less error-prone, but you still need to understand what's going on.)

To learn the basics of the language, read The C++ Programming Language, Special Edition, by Bjarne Stroustrup.

Read a lot of things by Herb Sutter and Andrei Alexandrescu. I particularly recommend Modern C++ Design and Exceptional C++; I'm sure others in this thread can give you some good suggestions.

Finally, start writing code, and get it critically reviewed by someone who really knows C++. (I've known 2 or 3 such people in my career; they exist but are the exception, not the rule. Look for people who can explain all the things I listed, and more.)

(Edited to add The C++ Programming Language.)

u/George3d6 · 2 pointsr/cpp

Well, in that case I would recommend using C++ to do it, if you can compile using a recent~ish version of clang or gcc for your environment and using the standard library (aka the std or the stl) as much as possible, it's a very OO library so by using it you will understand how OO can be helpful and you can look at it's design to understand how to write things similar to it.

If you want books I would recommend Scott Mayer's Effective Modern C++ (if you are familiar with C and/or older C++) or Brine Startrooper's A Tour of C++ if you are not that familiar with programming in general.

Alternatively, if you want a book about OOP design patterns, there are tow classics that come to mind:
Gang of four (http://wiki.c2.com/?DesignPatternsBook)
Modern C++ Design(https://www.amazon.co.uk/Modern-Design-Generic-Programming-Patterns/dp/0201704315)

For more up to date stuff, watch talks, look at code or look for less popular "up and coming" books.

Keep in mind that your goal shouldn't be to use OOP because you want to use OOP but to use OOP because it helps you reason about things.

OOP can easily result in slow code (similar sized data will not be localized, resulting in inefficient access), horrible design patterns (most beginners will make the mistake of writing large objects that have two many responsabilites) and hard to read code and change code (due to, sometimes useless, coupling between data an algorithms).

If you want to see some interesting takes on OOP check out Scala and Akka's actor library, actors are a thought provoking distributed design pattern that is fun to write and Scala is arguably "the purest OO" language that is widely used today.

Overall write code that works and is easy to modify, use a lot of language and libraries to familiarize yourself with as many aspects of technology as possible.

And remember "objects are burritos", they are simply an abstraction that is used by a wide array of programmer and as such they mean different things from different people.

u/arabidkoala · 2 pointsr/cpp_questions

The problem here is that of the three "overrides" of colideWithObject that you defined, only bool collideWithObject(Object* obj) is actually an override. If you put the override keyword at the end of each statement function in Circle (Assuming c++11), you will see the problem. see here

What you are trying to achieve is called multiple dispatch (aka multimethods), which requires some legwork in C++. I remember a good method of doing this described in chapter 11 of Modern C++ Design.

u/ChrisFingaz · 2 pointsr/learnprogramming

Starting this off as saying that I work primarily in iOS and mac environments. I think PCs are great and apple is overpriced but I really enjoy it and I love Swift so whatever.

If you're building applications in Windows most people seem to start with Visual Studio. There's a ton of resources, frameworks, libraries, and a large community for it. At the very least it's probably a good place to start. For C++ development maybe start here: https://msdn.microsoft.com/en-us/windows/uwp/get-started/create-a-basic-windows-10-app-in-cpp

Now for your broader question of application development, I would start with the Gang Of Four for code design. These aren't easy concepts to get right off the bat, it's putting in some reps before it becomes natural. You'll never use just one either, most projects become a mesh of different design concepts and there's way more than 4. I recommend coming up with a simple project to build on your own and then attempting to architect that from a high level before coding. Then actually building it. It's really the only way to learn. For C++ reading maybe check this out (not 100% on this, I don't do much with C++, but seems recommended as an update for the original Gang of Four): http://www.amazon.com/dp/0201704315/

Another book: http://www.amazon.com/dp/0735619670/

it's from this list: http://blog.codinghorror.com/recommended-reading-for-developers/

This all said, don't get bogged down in books. Read enough to feel comfortable starting something then start it.

u/TimMensch · 2 pointsr/programming
  1. If you think that C++ isn't harder to learn than C, then you don't really know C++. Read Modern C++ Design, and a few dozen pages of the C++ FAQ, and if your head doesn't explode, tell me again that C++ isn't harder to really learn than C.
  2. I know the Linus article. I know he's competent. But I still don't agree; I think he's so steeped in his kernel code world that he doesn't see the advantages, at least for application software.
  3. Anyone who writes code in C++ but who doesn't know pointers, can't concat strings, etc., is someone who also really doesn't know C++.

    Someone who doesn't really know C++ can do things in C++ and be productive, but keep them away from writing templates, macros, and/or doing anything with pointers. The right library can protect amateurs from shooting themselves in the foot, at least too often; that's why people talk about using a "subset of the language."

    I'm a game developer. It's still the case that most serious game developers demand C++, and for good reason.

    For reference: I've interviewed dozens of developers applying for a C++ game development job. Most rate themselves 9 to 10/10 in C++, and yet most also choke when I start asking them even slightly interesting questions about the language. Not even the standard (or any other) libraries -- just about the core language. This is all stuff I know like the back of my hand -- and I know that there are things in C++ that I couldn't just get right the first time (see Modern C++ Design for a few examples).
u/skebanga · 2 pointsr/cpp

I would also suggest to follow these up with Modern C++ Design by Andrei Alexandrescu, which really opens your eyes to the power of C++ templates and template meta programming.

u/suhcoR · 2 pointsr/Qt5

Well, this is what most people understand by "modern C++": https://www.amazon.com/Modern-Design-Generic-Programming-Patterns/dp/0201704315; it was published 2001.

Actually Qt offered an equal or even better solution for most features introduced with C++11 alread long before 2011. At least for me C++11 brought little benefit.

u/CSMastermind · 2 pointsr/AskComputerScience

Senior Level Software Engineer Reading List


Read This First


  1. Mastery: The Keys to Success and Long-Term Fulfillment

    Fundamentals


  2. Patterns of Enterprise Application Architecture
  3. Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions
  4. Enterprise Patterns and MDA: Building Better Software with Archetype Patterns and UML
  5. Systemantics: How Systems Work and Especially How They Fail
  6. Rework
  7. Writing Secure Code
  8. Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries

    Development Theory


  9. Growing Object-Oriented Software, Guided by Tests
  10. Object-Oriented Analysis and Design with Applications
  11. Introduction to Functional Programming
  12. Design Concepts in Programming Languages
  13. Code Reading: The Open Source Perspective
  14. Modern Operating Systems
  15. Extreme Programming Explained: Embrace Change
  16. The Elements of Computing Systems: Building a Modern Computer from First Principles
  17. Code: The Hidden Language of Computer Hardware and Software

    Philosophy of Programming


  18. Making Software: What Really Works, and Why We Believe It
  19. Beautiful Code: Leading Programmers Explain How They Think
  20. The Elements of Programming Style
  21. A Discipline of Programming
  22. The Practice of Programming
  23. Computer Systems: A Programmer's Perspective
  24. Object Thinking
  25. How to Solve It by Computer
  26. 97 Things Every Programmer Should Know: Collective Wisdom from the Experts

    Mentality


  27. Hackers and Painters: Big Ideas from the Computer Age
  28. The Intentional Stance
  29. Things That Make Us Smart: Defending Human Attributes In The Age Of The Machine
  30. The Back of the Napkin: Solving Problems and Selling Ideas with Pictures
  31. The Timeless Way of Building
  32. The Soul Of A New Machine
  33. WIZARDRY COMPILED
  34. YOUTH
  35. Understanding Comics: The Invisible Art

    Software Engineering Skill Sets


  36. Software Tools
  37. UML Distilled: A Brief Guide to the Standard Object Modeling Language
  38. Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development
  39. Practical Parallel Programming
  40. Past, Present, Parallel: A Survey of Available Parallel Computer Systems
  41. Mastering Regular Expressions
  42. Compilers: Principles, Techniques, and Tools
  43. Computer Graphics: Principles and Practice in C
  44. Michael Abrash's Graphics Programming Black Book
  45. The Art of Deception: Controlling the Human Element of Security
  46. SOA in Practice: The Art of Distributed System Design
  47. Data Mining: Practical Machine Learning Tools and Techniques
  48. Data Crunching: Solve Everyday Problems Using Java, Python, and more.

    Design


  49. The Psychology Of Everyday Things
  50. About Face 3: The Essentials of Interaction Design
  51. Design for Hackers: Reverse Engineering Beauty
  52. The Non-Designer's Design Book

    History


  53. Micro-ISV: From Vision to Reality
  54. Death March
  55. Showstopper! the Breakneck Race to Create Windows NT and the Next Generation at Microsoft
  56. The PayPal Wars: Battles with eBay, the Media, the Mafia, and the Rest of Planet Earth
  57. The Business of Software: What Every Manager, Programmer, and Entrepreneur Must Know to Thrive and Survive in Good Times and Bad
  58. In the Beginning...was the Command Line

    Specialist Skills


  59. The Art of UNIX Programming
  60. Advanced Programming in the UNIX Environment
  61. Programming Windows
  62. Cocoa Programming for Mac OS X
  63. Starting Forth: An Introduction to the Forth Language and Operating System for Beginners and Professionals
  64. lex & yacc
  65. The TCP/IP Guide: A Comprehensive, Illustrated Internet Protocols Reference
  66. C Programming Language
  67. No Bugs!: Delivering Error Free Code in C and C++
  68. Modern C++ Design: Generic Programming and Design Patterns Applied
  69. Agile Principles, Patterns, and Practices in C#
  70. Pragmatic Unit Testing in C# with NUnit

    DevOps Reading List


  71. Time Management for System Administrators: Stop Working Late and Start Working Smart
  72. The Practice of Cloud System Administration: DevOps and SRE Practices for Web Services
  73. The Practice of System and Network Administration: DevOps and other Best Practices for Enterprise IT
  74. Effective DevOps: Building a Culture of Collaboration, Affinity, and Tooling at Scale
  75. DevOps: A Software Architect's Perspective
  76. The DevOps Handbook: How to Create World-Class Agility, Reliability, and Security in Technology Organizations
  77. Site Reliability Engineering: How Google Runs Production Systems
  78. Cloud Native Java: Designing Resilient Systems with Spring Boot, Spring Cloud, and Cloud Foundry
  79. Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation
  80. Migrating Large-Scale Services to the Cloud
u/ferruccio · 1 pointr/cpp

http://www.amazon.com/Modern-Design-Generic-Programming-Patterns/dp/0201704315 - amazing book, completely changed the way I write C++ code

u/akevinclark · 1 pointr/cscareerquestions

Kind of dated now but still mind expanding: Modern C++ Design by Alexandrescu. Templates can get pretty intense and let you choose what gets done at compile time.

u/thechao · 1 pointr/AskComputerScience

Programming is language agnostic; it sounds like you're looking for breadth rather than depth, so:

u/Truth_Be_Told · 1 pointr/C_Programming

First note that Career/Job/Market is quite different from Knowledge/Intellectual satisfaction. So you have to keep "earning money" separate from "gaining knowledge" but do both parallely. If you are one of the lucky few who has both aligned in a particular job, you have got it made. Mostly that is never the case and hence you have to work on your Motivation/Enthusiasm and keep hammering away at the difficult subjects. There are no shortcuts :-)

I prefer Books to the Internet for study since they are more coherent and less distracting, allowing you to focus better on a subject. Unless newer editions are reqd. buy used/older editions to save money and build a large library. So here is a selection from my library (in no particular order);

u/unknownmat · 1 pointr/softwaredevelopment

Could you post a link to the negative response you received? I would be curious to judge it for myself.

There was a fairly strong anti-OO backlash that I would place in the early 00's up to about 2008. The furor has since died down (or at least I'm no longer seeing anti-OO blog posts like I used to). If you're interested I could probably dig up some more, but off the top of my head:

  • Execution In The Kingdom of Nouns

  • Why Arc Isn't Especially Object Oriented - and in particular "the smartest programmers [Graham knows] are some of the least excited about [Object Oriented Programming]".


    Personally, I'm not a huge fan of OOP. It models some problems very well, such as GUI widgets and simulations. But in most domains it tends to result in a bunch of scaffolding that becomes a permanent part of your code base. It is a crutch for when you poorly understand your problem - objects give you something "concrete" to grasp and this is fine for a first pass - but ultimately you should prefer cleaner and simpler abstractions that more closely map to the problem domain.

    I also think that C++ is a horrible language for OOP. It's not flexible enough and thus requires a great deal of biolerplate to achieve object-like behavior. For OO-tasks I prefer to work in Smalltalk-inspired languages like Python or Ruby. In particular, characteristics of "real" OO languages would be: late-bound, dynamically typed, and introspective.

    Instead, when I work in C++ I prefer to use (what I think of as) "modern style" which was first defined (to the best of my knowledge) in Alexandrescu's book, and is perhaps best embodied by the Boost C++ library style. I realize that this is not everyone's cup of tea. But I think that this is the one area that C++ legitimately shines. It is what I call the "no compromise" style of programming - with the help of template meta-programming libraries you can write your code at a very high level of abstraction, and yet compile it down to extremely efficient code as if it were hand-coded in C to do that specific task. It can be pretty amazing, although it can also be (and probably is) a Turing Tarpit.

    EDIT: Not sure why it really matters but: mid-30's, and I work on automotive infotainment systems. C & C++ are the only languages officially supported on the platform, so despite my dislike of C++, I write a lot of it and it is probably my strongest language.
u/oilshell · 1 pointr/ProgrammingLanguages

Yeah there was nothing in the talk about it.

As far as I can tell, it's a somewhat silly reference to the fact that the influential book "Modern C++ Design" was written in the C++ 98 era.

This 2001 book advocated a clean break from the C heritage in C++:

https://www.amazon.com/Modern-Design-Generic-Programming-Patterns/dp/0201704315

It's heavy on template metaprogramming. I actually prefer "C with classes" for many problems, but it's it's clear that C++11, 14, 17 are going further in this direction.

And I believe that Immer relies on many features from C++11 and 14. Those features enable C++ the language to delegate all its data structures to libraries, rather than being part of the language.

-----

For a completely different and more useful application of the word "postmodern" in programming, I recommend this paper:

http://www.mcs.vuw.ac.nz/comp/Publications/CS-TR-02-9.abs.html

It's very insightful, fun, and in the 15 years since it was written has become more relevant. I haven't blogged about this, but this kind of thinking underlies the shell and the design of the Oil shell in particular. In particular, in large systems, there is "no grand narrative", and it makes sense to opportunistically use models when they are useful, but throw them out when they are not.

There is a tendency among programming language designers to assume that they are at the center of the universe. A big part of shell is about making existing pieces written in different languages work together.

And that includes the operating system. To me, it's obvious that runtime is more important compile time, and too many programming languages are ignorant of the other enormous piece of code that runs when your program runs -- the operating system.

u/gte910h · 0 pointsr/programming

>Classes without template parameters are not in a different type system then those with them.

Many people very strongly metaprogram in C++, using templates to make abstract types that bear no resemblance to traditional C++ classes, doing polymorphism, data hiding and various other cannonical aspects of classes without a class keyword in site. It quite clearly is a different type system, much more esoterically different than the one in ObjC, being compile time. We're not talking "classes with template parameters". It's a second, wholecloth type system. Interfaces (as java would call them) without the interface declaration.

>Also what the hell are "new style" vs "old style" template classes.

An old style template class is a class that works on a datatype or two which is templatized. A new style template class is something out of http://www.amazon.com/Modern-Design-Generic-Programming-Patterns/dp/0201704315 a very popular style in some shops.

>And what the hell are you even talking about with your "weird extra encapsulated ways"?

Class 1 has a private member variable to a second class called a Class1_impl which is a completely different class which implements the internals of Class1. This is an attempt to enforce data hiding from friending.

The reason I listed more than 2 type systems, is because I doubt you can say ALL the listed type systems I have are the same one. If even 2 of them are, C++ has "at least as many" as objective C does (or Java for that matter). If you've NOT encountered these esoterica, I just think you need to work in 2-4 more C++ shops and you definitely will. They're pretty common in my experience.