15 ms·
Embracing Modern C++ Safely, Book Review
- Iwan-Zotow 4y agoTitle itself is an abomination
- maccard 4y agoThere's absolutely nothing of sustinence in this book review - they give the book 5/5 despite having not actually read it, and the only comments on the individual topics are on the length of the chapters. This is really a terrible review.
- deleted 4y ago[deleted]
- Koshkin 4y ago'substance'
- bombcar 4y agoSustenance could also work - as a review it’s like a meal made of cellulose. Lots of action but no energy.
- Sakos 4y agoI'm not sure if you stopped too early or if you have a grudge against the author or what. > I’m still reading this book, and I haven’t read all the pages (1300+ pages!). Yet, I’ve seen all of chapters, read half of them and picked those related to my recent work, tasks, or blog posts. I’m impressed with the level of detail and the quality the authors put into this material. The book has become my primary “reference” for those C++11/14 parts. With further detail below that.
- ncmncm 4y agoThe review tells you what you need to know: this is not a good book.
- SuperV1234 4y agoThe review states the exact opposite.
- ncmncm 4y agoVery unconvincingly.
- avgcorrection 4y agoThis is an elementary school book analysis-level review.
- maccard 4y agoIndeed, that's a much better way of phrasing it.
- SuperV1234 4y agoThis comment seems a bit intellectually dishonest to me -- as an author the review was really useful to pinpoint improvements for future editions. The author of the review also clearly states that the book was read and provides an unique opinion and perspective over what the book offers. It is also completely false that the review only comments on the length of the chapters. Have we read the same review? Or did you stop before "My Views" and the pros/cons? :)
- rob74 4y agoMy mental image of C++ is a tool which is great when used by an expert, but has lots of sharp edges which can cut you if you're not careful - so not something I would apply the verb "embrace" to...
- Koshkin 4y agoHence this book.
- sgeisenh 4y agoCollaboration on a C++ codebase can be interesting. One of the most common approaches that organizations use is to choose a subset of the language and discourage committing code that doesn't conform to that subset. This limits the sharp edges and in particular makes it easier to identify where they might exist. Perhaps the most common rule is the prohibition of exceptional control flow. This can seem really limiting at first, but encoding the possibility of errors using the type system and forcing callers to handle errors explicitly is really powerful.
- colejohnson66 4y agoIf I have to use a subset of a language to avoid shooting my feet, why not just use a language without footguns?
- faitswulff 4y agoNot every project can be a greenfield project.
- deltaonefour 4y agoI agree but C++ is so ingrained that tons of greenfield projects end up using C++ because of libraries and because too many people are used to it.
- ncmncm 4y ago
- photochemsyn 4y agoIf I had cash to burn I might keep buying computer programming books, but as it is it's just become easier to use Google to research compsci topics in every area. For example, if I get confused about constexpr functions in C++ I can just Google with upload dates restricted to the past four years and up pops, for example, a nice learncpp page with just about everything I need to know for basic uses. That said, I downloaded their sample pdf and the nice thing is the code they present is very well commented and so it's easy to read. They seem to take a 'read the code to learn the subject' approach, which I appreciate. Note that it takes a slightly conservative approach: > "Only the passage of time can distill the programming community’s practical experience with each feature and how well it fared, which is why this book discusses features added up to C++14, even though C++20 is already out." Maybe I'm missing something but they don't seem to offer the book as a searchable PDF? There seems to be a Kindle edition and paperback only. Worried about piracy or something? Otherwise it might be a useful reference, I guess.
- deleted 4y ago[deleted]
- stu2b50 4y agoThey're not really for the same purpose. The internet is great for finding documentation and reference material, but for larger, cohesive concepts like the book this post is about is on, especially since it's somewhat fringe, you will likely only be able to find bad blog spam on medium, which will be far inferior in quality.
- criddell 4y agoBooks are great for when you don’t know what you don’t know. Scott Meyers’ Effective C++ books were hugely valuable to me for that reason.
- egl2021 4y agoSame for me. Back in the day I learned C++ by reading each item in Effective C++ and studying Ellis and Stroustrup until I (almost) understood everything that Meyers mentioned in the item. It was slow going...
- rad_gruchalski 4y agoUhh, reminds me that I need to read it. Got it recently and looking forward to the content. The review makes me even more hungry!
- ncmncm 4y agoNo one needs to read this book outside a subset of people who work at Bloomberg.
- SuperV1234 4y agoHi! This book is not targeting Bloomberg employees only, it is written for the broad audience of C++ developers who have previously used modern standards, or C++03 developers that want to learn C++11/14 in an effective and safe way. Would you mind explaining why you believe that the audience for this book is limited to a specific company? Concrete examples would be appreciated.
- lain98 4y agoI cant afford these books.
- arunc 4y agoSomeone needs to write a book with the list of books to learn C++ the correct way. It's definitely unaffordable.
- jb1991 4y agoThere is a community-curated list of the best C++ books on Stackoverflow.
- UmbertoNoEco 4y agohttps://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list https://stackoverflow.com/questions/388242/the-definitive-c-... One of the good things of the language being so all and pervasive is that there is a lot of very good learning materials.
- Koshkin 4y agoSome time ago it occurred to me that the price you pay in time and effort absorbing the material from a book like this one is usually incomparably higher than the price of the book itself.
- deleted 4y ago[deleted]
- ncmncm 4y agoGood news! You do not need this book. Moreso, you will do better without it than with it.
- SuperV1234 4y agoI can assure you that most (if not all) C++11/14 developers that have some prior experience with those standards will find our book useful in various possible ways. If you don't want to take my word for it, check out the acknowledgements in the book itself -- it has been thoroughly reviewed endorsed by many top-notch ISO committee members and C++ experts.
- W0lf 4y agoGiven that I am working professionally with C++ (meaning I earn money by writing code in this language) I find it remarkable, that I appreciate and actually think it’s a useful book for my daily work. 1300+ pages of detailed language features just to somewhat get by and feel sufficient competent that my code does what I intended to do. Looking behind my back there is a shelf of another 30+ books full of C++ (Meyers, Sutter, Alexandrescu, Langr, Feathers, Stroustrup, Lakos etc) that I have read page to page. However, I am certain that any sufficient C++ developer can embarrass me by showing me a corner of this language I have never experienced before. It just never stops. The things I have to keep in mind while coding a solution for the actual problem at hand can be astounding. But then, I really like coding in it as there are these rare cases when I’m coming up with an elegant and straight to the point solution. I think I have some kind of Stockholm love-hate relationship with this tool of choice.
- k0k0r0 4y agoNot a professional here - by my own standart at least - however I also program in C++ for a living (among other languages). Definitely Stockholm-Syndrom in my case. Was the first language in which I was forced to work on some larger codebase. Since then I can't take the complexity of any other object-oriented language serious. All of them are basically a subset of C++.
- andi999 4y agoHow relevant was Lakos book in your opinion?
- W0lf 4y agoAn opinionated thorough demonstration on how to write C++ at scale. I didn’t agree one all aspects, though I have to admit it was the first book on C++ that clearly stated _how_ to actually design stuff both on a physical as well as on a logical level. Something which most other books on C++ won’t get into. All that being said I think it was pretty relevant for medium to large codebases
- ncmncm 4y agoNot at all. It has exactly one obviously useful piece of advice: don't make circular dependencies between libraries. In practice, that means organizing in layers. Most of us don't depend on many libraries where the authors of the libraries know one another, so it is easy to follow, even by accident. It has lots and lots of obsolete advice, though.
- tfigment 4y agoI was kind of hoping this was updated Modern C++ Design by Andrei Alexandrescu. That was my favorite C++ book and at least I thought it didn't use the STL in Loki at all. It was the better templating design though heavily at the mercy of compilers at the time.
- SuperV1234 4y agoSomewhat tangential, but Andrei Alexandrescu was fundamental for this book -- he reviewed the entirety of it, providing a lot of suggestions and improvements, and also helped write a few sections :)
- blinkingled 4y agoIs any new code being written in C++? Apart from adding to existing C++ based projects like Chromium and maybe supporting legacy trading/financial services code bases what else is C++ being used for where all the modern new features would be helpful? I haven't seen any job postings needing C++ lately but I am sure some niche jobs exist. Feels like instead of learning the complexities of modern c++ people might just be better off using Rust or any of the other safer programming languages for new projects.
- aaaaaaaaaaab 4y ago
- roxaaaane 4y agoThere are 80,000 jobs mentioning or requiring C++ and 4000 mentioning or requiring Rust. I understand more "modern" startups will tend to pick Rust but saying you "haven't seen jobs needing C++" is a plain lie. source:indeed.com
- throw_m239339 4y ago> Is any new code being written in C++? Apart from adding to existing C++ based projects like Chromium and maybe supporting legacy trading/financial services code bases what else is C++ being used for where all the modern new features would be helpful? All Adobe products heavily use C++, Most Digital Audio Workstations heavily use C++, All 3D authoring software heavily use C++, Most new core Blender code is now C++ instead of C. Of Course, most game engines are C++ based as well. So this is just the consumer space. There are domains where there is simply no alternative to C++ in terms of features and speed. Rust maybe, but I don't know enough about Rust to formulate an opinion. No need to say that C++ is absolutely here to stay.
- oncewas 4y agoI think what's hard for people to realize is, people who like rust usually aren't saying "is rust going to replace it"? Like cheesey blogs by hype artists say crap like that, but really having both is obviously beneficial to the programming community.
- Animats 4y agoThe trouble with "Modern C++" is that nothing gets deleted from "Classic C++". Too much legacy code. They're trying to compete with Rust while remaining backwards compatible. That generates so many special cases that you need a 1300 page book. Learn to embrace the pain. And yet converting code to Rust is hard. It is very tough to convert object-oriented C++ code to Rust. The models are too different.
- Sakos 4y agoUnfortunately, the real world often gives us constraints that we can't change and we have to work around. We should absolutely use Rust or other "safer" languages where we can. But if we can't, for whatever reason, it makes sense to try to make the best of the hand we're dealt. That means regardless of what new developments are made in other languages, it's necessary to figure out how to use existing tools/languages like C++ safely.
- arinlen 4y ago> The trouble with "Modern C++" is that nothing gets deleted from "Classic C++". This is not exactly true. For example, with the introduction of smart pointers, manual memory management is kicked out of C++'s happy path. This makes code far simpler to reason about and safer. Sure, you can still use new and delete, but since C++11 you better have a very good reason to use those. Nevertheless, it doesn't make sense to complain about not deleting stuff from C++ when a) until recently C++ was repeatedly criticized for having an extremely spartan standard library, b) since C++98 basic features were added to C++ such as support for parallel and concurrent programming, c) there is no feature that gathers anything resembling a consensus on beig worth taking out of the standard. I'd add that pseudo-standard libraries for C++, such as Boost and POCO, have been popping up and growing in both scope and adoption. This reflects a clear need felt by the C++ community to increase the scope of it's standard components.
- Animats 4y agoThere are too many APIs that still want raw pointers.
- avidphantasm 4y agoExperienced Python, C, and Java programmer here (am also learning Rust on the side). Recently picked up a C++ project at work that targets C++14. I know caveman C++ from my time at University 20+ years ago. My god is there a galaxy of complexity in modern C++. I get the need for some of it (e.g., smart pointers), but for new projects, I can’t see a good reason not to use Rust at this point.
- oncewas 4y agoNo joke. I used C++98 for a job a while back and got comfortable with it, I asked "hey why don't we use c++14"(this was years ago). The answer was basically, modern c++ is too complex to keep code bases sane without spending a week writing rules and having dozens of meetings, so they opted for the 20 yr old version. More recently I've learned rust. I haven't missed c++ at all. Even the more modern stuff I've learned later on...
- ncmncm 4y agoNot knowing anything about the language as it is today does not recommend your judgment as to how it compares to other languages.
- bobbyi 4y agoWhy is "final" an unsafe feature?
- ncmncm 4y agoIt is not. But virtual functions have strictly limited usefulness. If your go-to organizational feature is class hierarchies, you are probably not programming well.
- SuperV1234 4y ago'final' only partly relates to virtual functions, you are forgetting or ignoring the use of 'final' on classes. Also, 'virtual' functions are extremely useful to define interfaces that separate teams can implement and consume independently. Variants and algebraic data types are not the answer to anything, and it is not "outdated" to use 'virtual' where appropriate, despite what your other comments might imply.
- ncmncm 4y agoThere is nothing unsafe about final classes, either. Non-final classes could be risky, but not enough to worry over. Virtual functions are a mechanism that has legitimate uses but makes a poor organizational basis for a program.
- SuperV1234 4y ago> There is nothing unsafe about final classes The book agrees with that statement. If only you had taken 5 minutes to read a few pages before starting to beg strangers on the internet to not buy something that could improve their career just because one of the authors hurt your feelings sometime in the past... > Virtual functions are a mechanism that has legitimate uses but makes a poor organizational basis for a program. This is what I would consider "filler", much like the rest of your posts. Opinions presented as facts, without any sort of source, example, nuance, or elaboration.
- ncmncm 4y ago
- ncmncm 4y agoThe book reviewed is essentially backward-looking. It treats C++11 and newer features as inherently suspect. Its suspicions of newer features are based on superstition. You should not buy or pay attention to recommendations in this book unless obliged by employment at Bloomberg, and often not then. The book covers only up to C++14 because that is the latest Standard that Bloomberg has managed to field. They got to use C++11 only a couple of years back. Code written at Bloomberg is not, as a rule, good code. The BDE library much (but not all) Bloomberg code relies on is, while nominally open source, not used outside Bloomberg, for reasons. (When BDE group were directed to start reviewing outside pull requests, all discussion was of how to find time to reject whatever might come up. They need not have worried.) This is not a good book unless what you need is a doorstop.
- SuperV1234 4y agoHi, I'm one of the authors of the book. Our analysis of C++11/14 features aims to be as objective as possible. Could you please provide any example of what you consider "superstition"? Keep in mind that the book was heavily reviewed by multiple members of the ISO committee and experienced developers such as Andrei Alexandrescu, Sean Parent, Nina Ranns, Alisdair Meredith, and more. There's zero chance that "superstition" would have made it true their review, and I'm eager to see what you come up with :) Your post is also spreading falsehood. Bloomberg has been using C++17 for several years already, and many teams nowadays use C++20 and even C++23 features. We target C++14 because we find it intellectually dishonest to claim to know the best use cases and pitfalls for features unless we have had multiple years of experience with them in the real world. Your opinion seems quite biased, I take it that possibly you had some bad experiences at Bloomberg, which can happen as in any other large company. Still, I'd be happy to hear your feedback and improve the book if you provide some concrete examples of "superstition".
- ncmncm 4y agoI remember when this book was a 12-page polemic vainly ginning up arguments for limiting use of any language features newer than C++03. I thought it had been rightfully abandoned. Instead it hypertrophied as all Lakos work does. Anything starting from that premise was bound to lead nowhere good. The 1300-page size will anyway help limit its influence, just as has the gross inflation of Lakos's other output.
- TeeMassive 4y agoIf you're working (i.e. getting paid) for coding in C++, you're either working on old legacy code base or you don't because modern new projects have other viable options now that offers both bare metal speed and high level functionalities.
- PaulDavisThe1st 4y agoI get paid to write C++. Approximately 610,000 lines of C++. Typically hundreds of commits per month, sometimes thousands. If that's a legacy code base, I'm happy to keep it. You'd be insane to imagine rewriting this in any other language.
- dxuh 4y agoI really wish that not every submission about anything C++ related would devolve into a full-on discussion about Rust. It keeps happening everywhere. Why do people have such problems with someone else using C++ for whatever they are building?
- SuperV1234 4y ago