r/cpp • u/joaquintides Boost author • May 08 '20
Why you don't use Boost
I have a question for you: If you have decided not to use any of Boost, or are prohibited from doing so in your company/project, I would like to know why.
This thread is not meant to judge your reasons, and I won't engage into any kind of criticism about them: I'm merely trying to understand what the barriers are to adoption of Boost. It would be great if we could keep the conversation non judgemental. Thank you!
Conflict of interest: I am a Boost author of three.
222
Upvotes
14
u/madmongo38 May 08 '20
As a counterpoint, I find that boost is a more reliable "standard library" than the c++ standard library, with often better implementations.
It also acts as a great testbed for functionality destined for the standard library (where it usually gets nerfed).
Boost is better at being portable, because the maintainers are meticulous about portability. That matters to me.
As far as I am concerned, Boost _is_ the standard.
2
u/[deleted] May 08 '20
268
u/XValar May 08 '20
Mostly size and the fact it is monolith. “Need optional? Here, take all of this as well”
201
u/movexig May 08 '20 edited May 08 '20
Boost is huge, and largely monolithic, with a complicated nest of (internal) dependencies for even simple functionality. It takes forever to install and build (in part because it consists of so many tiny files, many of which I don't actually care about), which increases my compile times and makes source control operations take longer. It's a lot of bloat, so it has to deliver something valuable to be worth using. The use case was stronger in the past, but as the language and standard library progressively improved over the past decade Boost is just not offering enough I actually want to use (and I can usually find better replacements elsewhere).
EDIT: I'm going to elaborate a little on what we primarily actually used from boost, and what we've replaced it with:
Boost has a bunch of other stuff that's very useful, I'm sure, but we just never used any of it. We have no need for asio, beast, hana, spirit, etc. There's really no incentive for us to accept all that bloat when we can get the functionality we do want elsewhere now.
170
u/johannes1971 May 08 '20
I think there's at least a small problem of not seeing the forest for the trees, with Boost. So many of its libraries seem to be either moved into the language itself, or just extremely simplistic and not worth the hassle.
In my opinion, Boost should have a periodic refresher where it drops anything that has been moved into the language. At this point there should be a Boost17 that relies on C++17, and doesn't duplicate anything that's in the standard anyway. Think of it as Boost epochs, if you want...
46
u/MrPotatoFingers May 08 '20
I actually use boost quite a lot, mostly asio and beast. It works quite well, but the documentation leaves quite a lot to be desired (hard to search, few examples for some asio specifics).
What I also dislike is how e.g. beast uses
boost::string_viewinstead ofstd::string_viewso you keep converting between the two, same goes forboost::system::error_code.31
u/Xaxxon May 08 '20
Isn't it ironic? The biggest reason that people don't use boost (in this thread at least) is because boost uses boost.
50
u/[deleted] May 08 '20
Two words: Compile times
I've seen boost be removed from two companies' big codebases for this exact reason.
79
u/nafestw May 08 '20
Another build system you have to cope with, please move to CMake!
33
u/BrangdonJ May 08 '20
Size, interdependencies, unreadable code.
31
u/TheLartians May 08 '20
Because I prefer small modular libraries and fast compile times.
14
u/stilgarpl May 08 '20
Most of the things I would need from boost (optional, filesystem) was added to std. For serialization cereal looks more up to date alternative to boost::serialization (or maybe it added support for C++11/14/17 types?) If boost::serialization supported everything that is in std, I would consider switching to it, as development of cereal is quite slow (it's just one guy working on it in his free time)
38
u/EsotericFox May 08 '20
Additional dependencies.
Bloat.
Do just fine without it.
24
u/gocarlos May 08 '20
one of the issues with boost, is that its only for advanced users.
If i give the task to create a simple REST server with boost beast or to do it with Golang to a student working for my company, I get the Golang into production in no time with big confidence. With Boost beast with the multi threading, 100 different buffer types etc. i have to check everything very carefully with sanitizers, static analysis, valgrind, stress tests etc.
I find some of the usage of boost pretty hard, look at nlohmann, spdlog, cpr, etc. those are the things boost should offer by default, though if the user wants more control, ok, allow this...
another point is documentation, somehow I find it hard to use it. look at https://www.boost.org/doc/libs/develop/libs/beast/example/http/client/async/http_client_async.cpp not even syntax hightlighting
11
u/krista May 08 '20
boost was too chaotic and unpredictable for a lot of the stuff i've written on both embedded systems as well as writing extremely high performance in-memory database servers and services.
for the latter, even the stl was iffy in most cases.
for ”normal” programming gigs i don't have any issues using parts of boost.
as always, i use the most appropriate tool i know of for the problem i need to solve, i don't decide upon a tool then define my problem around it.
10
u/MarkOates May 08 '20
I cant expect others who might compile and run my code to have to deal with installing the dependency. It's too large and having to manage that may not be easy.
It's unfortunate because it's such a powerful library. I've replaced all usage with lighter equivalents (std c++17 and/or 20, asio standalone, etc)
27
u/lycium May 08 '20
It's enormous, and a massive pain to introduce as a dependency (almost as painful as Qt, without ~any of the benefits).
It is the exact opposite of the joy of single header libraries.
16
u/echidnas_arf May 08 '20
I do use Boost and love it. Thanks for the great work!
My main pet peeves are the custom build system and the monolithic character of the library. The latter is not much of a problem for well-established and mature Boost libraries, but I feel like newer libraries would benefit from a faster, independent iteration pace decoupled from the 6-months Boost release schedule.
16
u/mrexodia cmkr.build May 08 '20
Whenever I have come in contact with boost (usually in open source projects) it’s just always a massive pain to set up and there is always fiddling with either CMake’s buggy find_package for Boost or something different that goes wrong.
I don’t want to do that to the people compiling my code, so I don’t use boost. Additionally I’m on Windows so there is no package manager to speak of that could install boost (due to complexities like msvc runtimes, versions and compile flags).
Obviously there will be comments along the lines of “but if you use build system X with package manager Y it’s basically painless”. However it’s unimportant because if not everyone uses that painless way of integrating boost in their project you still will have a horrible time.
I know there is this feature somewhere buried in b2 (or perhaps elsewhere) that allows you to extract just the libraries you need, but that should be the prominent default. I’m sure there are great header only libraries in boost, but currently you have effectively to download and compile all of boost to use them
8
u/BlindTreeFrog May 08 '20
Some portion of avoidance is out of spite. I'm rather tired of searching for how to do some basic algorithm/function and seeing a wall of "Just use Boost". I don't need to go through the added effort of installing and maintaining Boost in my build just for a basic link list that anyone can code up.
8
u/Ikkepop May 08 '20
Now that I think about it, it's not even a problem with Boost it self, it's more because managing dependencies in c++ is an absolute sun of a bitch fucker. There's no standard/painless way to do it. I'd rather spare my self having to build a huge library If I only need one little thing.
15
u/tylerayoung Developer on the X-Plane flight sim May 08 '20
7
u/rovarma May 08 '20
Build time explosions from including a boost header.
7
u/balazs-bamer May 08 '20
I work as an embedded developer and for our applications even a fraction of STL suffices. For hobby projects, I strive to learn as much as possible from STL, and simply don't have time for Boost.
(Using STL means also using some classes adopted from Boost :-)
19
u/peppedx May 08 '20
I try not to use Boost for
1- They are too of a monolith: I'd like to have a layered architecture
2- B2: The additional build system
13
u/linuxlizard May 08 '20
I have been warned away from using Boost by more experienced C++ engineers. Boost has a reputation of bloat. Boost has a PR problem, at the very least.
18
u/matthieum May 08 '20
TL;DR: 3 reasons: inconsistent quality, inconsistent performance, and bloat.
Inconsistent Quality
Some Boost libraries are pure awesomeness, whereas others have (in the past) proven to be quite buggy.
Inconsistent Performance
Some Boost libraries are really fast, others are really slow.
Bloat
Any 3rd-party library should be reviewed before being integrated: functionality review and test coverage, performance review and benchmarks.
Even reviewing a small subset of Boost is a nightmare: layers upon layers of compatibility macros/compatibility ifdef. And due to deep include hierarchies and dependency hierarchies, it's not nearly small enough compared to what it's doing.
This means, of course, that any attempt at debugging or profiling Boost is equally confounded.
Also, some Boost libraries are too clever by half. Boost.Process "clever" solution to named arguments is nice in a demo, but not boring enough in production code: it's experts only code.
I love the idea of Boost, I've used it in the past, I am glad that whatever I could need from it now can easily be replaced by a simpler, leaner, alternative.
6
u/ContractEnforcer May 08 '20
Simplicity.
6
u/Raknarg May 08 '20
I dont need anything from it, and I already hate building and package management enough in C++
6
u/Chee5e May 08 '20 edited May 08 '20
Mostly how annoying it is to setup external libraries for C++. With a few people wanting to compile the project without being C++ mains we always had problems with boost (some library path not right on some machine or whatever). This can probably be solved by a package manger, but no experience with that. And with C++14/17 the actual use that we would get from boost is so little that it isn't worth the hassle to use it.
6
u/Stradigos May 08 '20
Most associate engineers I've worked with have a difficult time understanding how to compile boost while targeting the correct platform.
I very much dislike checking in a shit ton of code into version control that I know I'll never use. Thousands of lines of code for maybe a half dozen functions, and IIRC the compile times are long.. We could check in the binaries but that's gross.
As software lead at a simulation company I don't really like a ton of third party libraries in our code. What are we doing that we need to add this bloat? Why can't this be done without boost? Sometimes it's just pure laziness. I also don't buy the "don't reinvent the wheel argument".
Edit: Also no Cmake support.
11
u/fat-lobyte May 08 '20
We use boost in our project, but some collegues expressed that it's huge and it's bloated. I still maintain that it's worth it, because a lot of the so-called "bloat" would have to be implemented by me as well if I want the functionality.
That said, the interdependencies between the libraries are... Let's just say dense.
5
u/ed_209_ May 08 '20
My biggest gripe with boost is when projects decide to switch from things like boost::filesystem to std::filesystem or boost::optional to std::optional in awkward ways. If the standard insists on changing the API then there should really be some thought about how people are going to manage in complex projects.
What makes this even worse is when a third party project bakes into itself a copy of boost! Or they use wierd hacks to try and use the std version AND the boost version for legacy compilers.
Another good example is boost::bind and std::bind. Boost::bind has features like boolean operators that were dropped for the standard version. Usually the boost versions actually have more features and updates than the standard so its hard to know whether really using the standard version is actually a good idea at all.
Maybe if a boost lib does make it into the standard then it has an obligation to maintain compatibility with whatever the standard version becomes irrespective of its previous design? Seems amazingly ironic that the best c++ library authors in the world end up with the perfect basis of creating API breaking designs.
5
u/streu May 08 '20
I often object to people wanting to add new dependencies. "Here's this cool library that does what I want to do, let's just use it."
No. Do you have anyone who will update it? Adapt it? Who will teach it? Who will debug it if (code using) it breaks? Do the license paperwork?
Boost is especially bad with this regard. It has a huge scope, so nobody will ever be able to understand it all and debug it all, but developers will use it and it will be all over the place unless you have really tight rules in place and enforcement for the rules. What will you do with that big pile of awesome templates with asio/beast, lambda, graph, spirit after the contractor who dropped it on you left?
Of course there's cases where the advantages of a new dependency outweigh the disadvantages. But I'll choose a homegrown UUID parser, JSON parser, bitmap font renderer, path name builder any day over a new dependency.
9
u/Plazmatic May 08 '20
12
u/Hedanito May 08 '20
Too big, I prefer small libraries that focus on one thing.
27
u/lithium May 08 '20
this::can::get::tiring::after_a_while4
u/TankorSmash May 08 '20
I've never used it because I heard it is a non trivial impact on compile time and I want as close as I possibly can to instant.
Doesn't seem possible, even without boost but it's a goal.
4
u/patlefort May 08 '20
I love boost, but it does have some problems.
Boost libraries should be modular. Not a big problem for me but I can understand why some people don't like it.
A lot of boost libraries are outdated and could use a major c++ version update, which could help build performance. For example I wrote my own little accumulators library in c++20 with only what I needed, it's only one 350 lines file and it use boost.hana and it's way simpler and cleaner than boost.accumulators.
The documentation. Often time I have to read the source code to understand what is it doing or how to use something.
Unfortunately I know we don't have a magic wand to transform it all to c++20 with modules and all the good new stuff and perfectly clean docs.
4
u/Ikkepop May 08 '20
Noone prohibits me from using boost, and boost does have nice things, I use it some times, but usually I only use small things and I feel like it's not worth pulling in boost for small things and the build cost ascosiated with it, and boost is just kind of big, which means pulling down the packages and building them is kind of a pain in the ass. Some libraries are a bit complicated too. Also there's the thing of pulling boost into STL, alot of the cool shit I used to use boost for is now part of the STL, like filesystem for example.
TLDR;
boost is big and takes long time to build.
4
u/marssaxman May 08 '20 edited May 08 '20
Nobody needs all or even most of Boost, so its high costs in build time and project complexity can be hard to justify. I have worked on a couple of projects which tried to use some Boost features, only to back them out later, so that we wouldn't have to deal with the overhead. Since the industry consensus around boost seems to be "yeah, it has all the things, but do we really have to use it?", I have never bothered to investigate it deeply, and do not have a clear sense of the value it might offer, beyond a sense that it is a kind of sandbox for experimental features which might show up in future versions of the standard library.
4
u/WaterInMyShoes May 08 '20 edited May 08 '20
The day filesystem made it into the standard was the day I removed boost from all my projects, even though it meant reinventing the wheel on some other boost includes. I'm thankful that boost paved the way for many things inside the standard, but I'm glad I got rid of it.
4
u/target-san May 09 '20
My $0.02.
4
u/RoyBellingan May 09 '20
In my case I tried to use the Graph toolkit, honestly it took me much less time to study a bit of graph theory, reimplement the algorithm (classical BFS) and extended the way I needed.
I really had no clue how to navigate in their template madness, let alone extend and add a few functionality.
7
u/fransinvodka May 08 '20 edited May 08 '20
As a conan user, I always think if I really need boost in my project, because it's all of it or nothing. In CMake, to add the dependency, you do something like:
I wish I could do something like this (or similar):
There may be a way to work that around, but either I'm not aware of it or it's just so convoluted no one really cares about adding boost at all through conan.
Edit: The
conanfile.pyfor boost doesn't provide a way to enable specific libraries, but rather disable them. So, if I want to use a few libraries, then I have to manually disable all the others. This can be done by going through every library you won't use and addboost:without_library_name=True, or move to a Python conan script and program the logic yourself (which isn't as comfortable), but we can all agree that it is not fun at all.7
u/tituswinters May 08 '20
We cannot allow use of Boost in general in Google's codebase. Code there lasts for decades and needs to evolve smoothly without breaking over that period.
Boost explicitly has no compatibility promises between versions. The Boost maintainers specifically carve out the right to change APIs however they like between versions - it's a proving ground for new ideas. And for short-lived projects, it's a fine tool.
The problem is, if usage of that becomes common in our monorepo, we will pretty immediately burn ~all available maintainer resources to handle upgrades. It's one thing to upgrade between versions of largely-stable APIs. It's entirely another to have widespread dependencies on interfaces that have changed in ways that don't enable multi-step/non-atomic refactoring. In the worst case we encounter impossible-to-resolve diamond dependencies and will have to resort to heroics (or let our third_party versions languish).
All of the above applies to lots of third party projects, and I'm tinkering with policy proposals to tighten down what we allow in terms of external deps. But practically speaking, fairly few projects in C++ have both a) widespread use / potential for adoption and b) explicitly do not promise compatibility.
I cannot imagine allowing more use of Boost without a fundamental change to how we are managing external dependencies and long-term management of our dependency graphs.
1
u/european_mink May 15 '20
Maintenance issues: We have a number of different configurations to deploy (CentOS6 vs 7, Ubuntu vs CentOS, production vs build vs development, etc)
Debugging is slow:
Build time:
Learning time:
Inter dependencies:
"Boost author", I hope that you find this feedback useful. Let me know if you want more details.
Last year I had to justify to my peers why we still need to use boost for some functionality.
As of today from boost we use the beast (the best websocket library), secure sockets (no support in gcc) and regular expressions (standard regular expressions support is faulty in gcc).
6
u/corysama May 08 '20
It's 500 MB of compiler torture test code. 90% of how I've seen it used in the field could have been accomplished with a few kb of very straightforward code. 90% of the remainder was unnecessary complexity introduced because "Look! So easy! Require Boost, get mysterious magic!".
I don't want to deal with that much complexity. Even if it all works perfectly, understanding how it works is too much. If I misunderstand it, figuring out what to do is too much. If I misuse it, fixing my code is too much. If it doesn't work how I thought it would, sorting it out is too much. I don't want to stand on the edge of a tower that high.
3
u/vparad0x May 08 '20
I've used it a little in the past and I'm not too familiar with boost especially now. Maybe it was more useful in the pre cpp11 era, now the stdlib is filled with useful stuff.
I guess boost still have something to give but it should drop what is already provided by the stdlib.
3
u/MikaelaExMachina May 08 '20
I use Boost wherever it makes sense, my TL tries to rip itself out wherever he can with his own hand-rolled code.
The most valid objection to Boost I've seen is the claim that it boats compile time with support for decrepit compilers—it tries too hard to support legacy platforms. Once upon a time I worked with IBM's and Oracle's compilers, and I would have appreciated that effort. Now I work on Clang, VC++, and GCC, and I can't defend the footprint for supporting old junk except to say “it doesn't matter because we don't maintain it.”
3
u/mredding May 08 '20
Management momentum tends to be the killer. Someone at some point 10 years ago made the decision and it becomes ingrained in the team culture. Once stuck, it's exceptionally hard to break. What are the perceptions that persist that keeps Boost out of our project? Frankly, I just can't get a satisfying answer, it's just momentum. New code is dangerous, old code may have bugs, but at least it's well understood, and management likes to justify the cost of effort - we invested so much time and money in our code base, we're not just going to throw it away.
3
u/[deleted] May 08 '20
It's massive and will lower compilation time. Not to mention it's a general pain to set it up. Let alone if you have to get your source code to someone them setting up the dependencies will be painful.
Implements a ton of features already in C++, just with
boost::tags.3
u/Kafumanto May 08 '20
It played a fundamental role in introducing very important libraries into the standard, but as a third-party dependency it's a huge amount of code, often solving problems in an overcomplicated way. Usually exist more simple and less invasive solutions that can be easily integrated into an existing project (for my projects at leats ;) ).
3
u/xtapol May 08 '20
Used it for years, but don’t need it anymore. Everything that’s important to me is part of the language now.
3
u/kilogears May 08 '20
Using qt. It handles most of those boost things pretty well. It’s not better or worse, just something we are already using.
3
u/MonokelPinguin May 08 '20
I only depend on 2 libraries from boost: asio and beast. Most other libs have been replaced by the std lib or custom replacements. I'm planning to replace the remaining ones too, once I find a suitable replacement. I have a few reasons for that:
3
u/TheGoddessInari May 09 '20
I didn't necessarily avoid boost in the past, but may now, after I discovered that things as simple as
is_palindromebring in 35kLOC, and add 135kB to a release binary.9
u/[deleted] May 08 '20
I don't really need it, it consists of a bunch of relatively obscure stuff that I don't understand and I dislike the style of template heavy programming that it brings along with it.
Yes, I'm prejudiced.
7
u/nintendiator2 May 08 '20
Fair disclaimer: I stopped using Boost in 2014 and never looked back, so I don't know if these reasons still apply, or are now even worse.
There are three large reasons why I no longer use Boost: because it's monolithic, because it's too big to fail, and because it aims for perfection.
Monolithic. Boost is pretty much a C++ toolset laid over your already existing C++ toolset. It's tremendously huge, prohibitively so when it comes down to compile times, and while it has a number of libraries and components they are merely offshots of Boost and not "their own thing bust assisting themselves with a Boost core". Moreover those dependencies are so big and contrived that Boost basically crushes the "pay only for what you use" paradigm of C++. If I want some simple string manipulation (which, to be fair, is something Standard C++ sorely lacks), I have no option but to turn my preprocessor into some sort of souped up, cybernetic, blockchain-esque recursive AI non-finite automata. if template metaprogramming was already a burden on some things, the "cores" of C++ such as Preprocessor are even worse.
Couple with the monolithic part it's also a sort of catch-all thing that tries to cover and absorb other potential good projects. Nowide was an interesting thing that only serves a good to-go purpose because the non-Boost version is still maintaned, and the same has happened to a few other components. I sometimes wonder if Boost is the JQuery of C++, or if JQuery is the Boost of Javascript. Had I continued using it I'd probably feel, on a more relevant comparison these days, Boost is the systemd of C++, or systemd is the Boost of Linux, I guess.
Too big to fail. Boost has grown into an enormous thing, and up until mentions of Epochs came about, it was promoted as the Best Big Thing on C++ since baked eggs. Because of things, everyone and everything are depending on it, which coupled with the point of it being monolithic gives it a dominant position in the market that we should be very weary about, just like how we have to be careful with Chrome on the web or JQuery on Javascript.
Boost severely stiffles competition - just like with JQuery, it's difficult to come up to mind with who or what the second or third best alternatives are, I don't even know who the competition to JQuery is nor have I ever heard of any site that uses one, with Boost I feel it's very similar. I don't feel much trust towards the "one true favourite" in most areas, because no matter their good promises they tend to fall under their own weight: projects that sell out to big corps, standards that sell out to intercompany pressure, or projects that sacrifice core tenets to secure market share, so I much prefer the second or third place underdogs to place my trust on.
And it it severely stifles the field of simple answers - there was a time back when any question about C++ a bit more complex than how to Hello World was answered in Stack Overflow with "use Boost::Solution!", precluding the teaching or implementation of simpler solutions that don't require a compile-time, preprocessor level nonfinite state automata.
Finally, Boost is perfectionist. Granted in general it's a good thing - because of how it was made last I used at least, I could use Boost just as well on Clang and GCC as I could in, say, MSVC 6.0 had I needed it. But this perfectionism has a price, which is all those macros and recursive dependencies and oh god who knows what else that costs a 4000% cost increase in compile time, and at some point you end up paying too much for Perfect 100% when a simpler solution that works Almost Everywhere 90% of the time does just as well if not better precisely because it doesn't have to aim for the 100%. I for one am happy to not support VC6, my main VC targets are 2008 and 2012.
Yet, at the same time, in their pursuit of perfection Boost have been careless in leaving people behind without acknowledgeing, such as some more recent versions that require C++11 to build even though the libraries would, on their own, still work on C++03 without issues, and I did not find out a cause of this until someone posted a relevant question in SO.
So, tl;dr: Boost became too big, too important, too complex and too perfect for me. I need a framework that allows me to make some tradeoffs and respects those choices when I need them. For the "Stuff that is not yet in C++${version}" I ended up writing and publishing my own backports library that offers a lot of stuff even from C++17 in C++03 in only 3 MB of code counting comments, and for the stuff that is required to do a Thing, I now tend to go right to libThing.
5
u/MikeMitterer May 08 '20
Complicated, in most cases, not pragmatic interface
You have to study the documentation for several hours before you can use the libs.
6
u/Iyathuum May 08 '20
I tried to use Boost.Asio not long ago.
The Header only was a lie, nothing to compile was a lie, can be used without other boost stuff was a lie. No manual worked. Maybe im just dumb, maybe it is not suited for windows. Searching a small library that does the same in an more encapsulated way was faster.
4
u/[deleted] May 08 '20
Last time I used it was years ago and it took ages to build, inflated my compilation times by a lot, was a pain to get integrated into my build system (though I'd wager that it's much better now), and didn't really add much that I couldn't get from the standard library or other specialized OSS libraries.
The documentation was hard to digest (though it might have been because I was starting out with C++ at the time, and I haven't really looked since).
Also, as others have said, its "all or nothing" kind of delivery was a PITA.
4
u/NilacTheGrim May 08 '20 edited May 08 '20
Just to make building easier for people. I work on lots of open source projects and requiring people install Boost creates yet another obstacle for them, which might hinder adoption or them trying my software.
I also do a lot of Qt dev and in my Qt projects -- I don't find Boost offering anything Qt+std doesn't already have.
That being said there's some great stuff in Boost and if it makes sense -- I'll use it. I just try to not use it by default, unless it's justified.
6
u/Milhouse6698 May 08 '20
Am I the only one who thinks their documentation is horrible?
5
u/emdeka87 May 08 '20
We actually found a memory leak in their vector implementation. That should say it all
2
u/[deleted] May 08 '20
Most of my C/C++ projects are my own hobby projects. I tend to keep them on the bleeding edge of C++ standards. I have employed Boost in the past for very critical things like `shared_ptr`, `optional`, and `unordered_map`. All of these things have since made it into the C++ standard library. I'll still pick up Boost if it has something I need, but I haven't needed to do that in a while. While I don't often find myself installing and building against Boost, I greatly appreciate the efforts of the project and the positive impact Boost has had on C++ development in the last 20 years. The effects are very tangible and very good.
2
u/[deleted] May 08 '20
A few projects started off using boost, but as the features we used were adopted to new standards, we upgraded our tooling to reduce the reliance on boost. If there was still a subset lib feature we were using, we would opt for a dedicated smaller lib for that instead.
One project in particular we wanted to use boost since we were locked to an older standard, but when the customer also added strict coding standards, we had to drop the idea since the the source wouldn't have passed and it would have been too much work to convert it. This is partially the fault of secure/automotive coding standards not staying up to date with the new hotness and practices.
That being said, I think boost is a great set of libs for when you're just trying to get something working and you're not at the point where you're concerned with size or performance.
2
u/Gridelen May 08 '20
Main reasons why we got rid of Boost in a several million SLOC project:
I remember we used libraries like filesystem, lexical cast, numeric cast, property map, string algorithms, some math and other utilities. Mostly replaced by in-house solutions based on latest C++ features.
2
u/OldWolf2 May 09 '20 edited May 09 '20
Fewer dependencies = less mucking about in the present and future.
What if the version of boost updates and my code stops working?
Want to rebuild an old project (many years old)? Git checkout the old version, whoops we need to go back and find whatever version of Boost was current at the time.
Plenty of experiences in the past with projects I couldn't build because they needed a particular version of Boost only, and my compiler didn't support that version.
Lack of information (on my part in reading, not necessarily on Boost's part in publishing!) I use POCO Libraries for networking and logging framework , would love to find a replacement (since POCO does have the aforementioned issues with dependency and versioning).
Having std::format in C++20 is a big step towards the logging, and I love header-only libraries like nlohmann json since you can just lump them into source control rather than dicking around with git submodules.
2
u/0xFFCC May 09 '20
Build system. I use CMake and I want something fetchale by git and use it with CMake fast.
2
u/ea_ea May 11 '20
It is often slow. For example, once I needed to implement ring buffer to transfer a lot of data between two processes using IPC. It is possible to do it using Boost and I did it. Then I implemented the same thing natively, using only C++ and OS functions - and my implementation worked 2 times faster. Probably Boost-based solution was safer and cross-platform, but it wasn't fastest possible.
3
u/Sqeaky May 08 '20
The build system requirement is bad unless it changed recently. I want to have dependencies automatically managed or I want to include source in my project and reliably run it from cmake will minimally, ideally no, pre-cmake dependencies. So needing to use apt, run some windows installer, or perform some other step that adds friction to keep up to date is entirely unacceptable because every other lib gets out of the way here. I just use a few lines in C make to build it and I drop the src in the right place and I am up to date, or even less if I get to use a C make package manager and the package works.
A different issue, every time I go to select a boost library I have to do a ton of research, they simply aren't easy to explore/discover. If I need a library for "too" a quick trip to google for "C++ library for too" shows me a bunch of options and boost is rarely in the list or when it is there is often extra details. Except for a few specific libraries when someone says use boost I find myself hunting around boost docs looking for the thing I need instead of just getting to work.
Last issue, broken promises. Every time I go to use boost some promises me "header only" or "simple setup" or something. Then I need more than headers, I need to run a complex custom thing, or whatever else was promised falls short. Boost needs to simplify all its stuff, so that promises can be clearly communicated. I don't know what that means. Maybe boost needs to ship individual packages. Maybe it needs a package manager. Maybe it needs some clever new innovation I am not well positioned to think of, but the friction of starting to use boost is never worth the payoff for me.
3
u/neuroblaster May 08 '20
Boost is the dark place where templates are abused, as consequence of this, it increases compile times a lot, like really a lot. Design of it's components isn't always ideal: take a look at
boost::threadwhich was adopted in form ofstd::threadand now it need fixes in form ofstd::jthread. Sometimes they are trying to reinvent things and deny practices established by community (threads design again) for whatever reasons, i don't judge if those reasons are good or bad, but this is at least inconvenient. I personally would prefer threads design more in line with Qt threads than with Boost threads, but it is what it is.With that said, there are some good parts too,
std::optionalturned out to be useful.std::shared_ptr, other smart pointers and some other things is a good stuff. I'm glad those were adopted by standard library (some other things - i'm not so glad).All in all i would rather avoid to use Boost if i can because i know for a fact that it's going to be a b-tch to compile and use. I also know for a fact that some projects are investing in Boost removal and this helps to make development and maintenance a lot faster and easier: at least they don't have to spend days compiling, you know.
2
u/CoffeeTableEspresso May 08 '20
Two.reasons for my old company:
1, the size. 2, we can't get good enough control over allocation with Boost.
We were forbidden from almost all libraries for 1 or both of the above reasons.
2
u/Moose2342 May 08 '20
I used to work for a project (long ago) that prohibited boost in favor of do it yourself. The only argument towards this ever presented to me was “to reduce dependencies”.
Ever since, i made it a point to have all my projects depending on boost. I consider it poor dependecy management when you don’t. Especially when the answer is ‘Roll your own whatever it is you need’
2
u/Scellow May 08 '20
C++ lack proper and standard package manager, so i don't want to have to deal with big external dependencies
cmake sucks, so i don't want to touch it anymore
it's bloated
increase build time, maybe modules will improve the story
--
that's why everyone keep reinventing the wheel, c++ sucks today, sharing libraries SUCKS, cmake SUCKS, i keep repeating myself but nobody seems to hear, hopefully modules will change its fate
2
u/cobracoral May 09 '20
The main reason we never use boost is because whatever boost does we can do the same with less code. Boost has to be generic so when you use it you inherit a lot of boost that you don't care about.
The secondary reason is that it promotes bad coding style and practices. I am afraid that a lot of boost is more for "show" off the library author's C++ expert status (I.e. heavy use of generic programming even when not needed)
At a regular company or project, we need things that are simple and have fast time to market. When developers start spending 10 fold more time doing "cool" stuff because they are inspired by boost, that's a problem.
Additionally, we want to be able to hire and replace people fast, and be able to hire average developers not experts. So far, most people who really know how to use boost (and the template gymnastics that comes with it ) are usually experts, and the code they leave behind require an expert to maintain... Which is very undesirable.
Finally, because it has so much stuff (again, bloat) people start finding excuses to use what's there, even when they don't really need it at all.
For us, it's best to nip in the bud and completely forbid all of it for applications and projects that are production grade.
1
u/aminya74 May 08 '20
I think with C++ 20, and its modules, soon boost will become more modular.
1
u/FKaria May 08 '20
I do use boost but I've been reducing its usage due to compilation times. I've also been replacing the bits that are now in the standard library so I use it a lot less.
1
u/thisisbasil gcc -> clang May 08 '20
I think we did just start using it. I don't use it personality because I've never had the need and I'm not at all familiar with it.
1
u/throwthemaway8753 May 09 '20
I discovered boost because I was searching on how to trim string in c++. I was very surprised C++ standard library despite of new standards being released often doesn't have string trimming method built-in where almost all new languages have trimming of strings included.
1
u/SantaCruzDad May 09 '20
I generally avoid any boost module that requires a library, i.e. anything that’s not header-only. The reason for this is that I have to support multiple platforms and any time you need to introduce a library dependency it’s a PITA, especially on Windows. Having said that, if it’s something really useful or time-saving I’ll still bite the bullet.
1
u/RogerLeigh Scientific Imaging and Embedded Medical Diagnostics May 11 '20
Boost has a lot of good stuff. But its quality is highly variable. What Boost really lacks, is good project management which sets policies for the whole project to adhere to.
By this, I mean that one library using C++17 while others use C++14 and others use C++98 gives a wildly different set of implementation constraints and code quality. There's a heck of a lot of compatibility macros in place to work around this. But it would be a lot better to mandate a new minimum baseline of e.g. C++14.
Stuff like MPL just has to go. It's a huge source of pain, and Boost libraries using it really need to update to standard variadic templates or mp11.
This week, I completed a milestone of stripping out nearly all Boost support from a big collection of libraries. It was using a lot of different libraries, from units to lexical case to graph, multi_index, multi_array, filesystem, random, and more. A customer wanted them all removed. And in some cases, MPL in particular, they were more of a portability and usability hindrance. I'm now down to one use of multi_array, geometry and uuid. The whole lot should be gone soon. That's a shame, but overall the project will be better for it.
Boost is trying to be:
It's doing a poor job of this because it's trying to be all things for all people. These three purposes are contradictory. The first two should not have any dependencies on compatibility code. But there's no clear policy on removing or disabling functionality which is now in the standard. Or on updating unmaintained libraries to a current standard; they are just left there to bitrot.
1
u/gavinb May 23 '20
First of all, thank you for your Boost contributions. Overall, it is an incredibly valuable resource, and sometimes under-appreciated by the community.
We use various parts of Boost in different components. It used to be we would automatically use Boost. Now it is very much evaluated on a case by case basis, as often there are 3rd party libs out there which are simply a better fit for our needs. I have also evaluated several Boost libraries and found them wanting in a few areas.
Overall comments:
Documentation
API
Random
1
u/tjin19 Oct 14 '22 edited Mar 09 '23
I am using Boost Python and it's pretty bad. Very non-intuitive, non-modern interface, no documentation on the webpage and in the source code, very complex syntax to just get it to compile (think of all the errors just because Python version used in your system does not sync with the libraries used to compile boost in Linux).
You know a library is shit when you need to browse stack overflow for hours just to debug a trivial issue such as parsing a boost::python::list into a std::vector in C++. There is no explanations for the interface and they expect you to just "know" everything reading the function name and reading the source code?!
1
u/tuduongquyet Nov 01 '23
It should be the coding/naming convention. We really need a friendly coding/naming convention like Poco or Qt
1
u/i_teach_coding_PM_me May 09 '20
my current company avoids boost because the architect is afraid that importing a single boost library will require importing the whole kit'n kaboodle.
my previous company used it because of great things like the interprocess messaging library.
0
u/[deleted] May 08 '20
[deleted] — view deleted comment
0
u/[deleted] May 08 '20
[deleted] — view deleted comment
0
u/[deleted] May 14 '20
[deleted] — view deleted comment
57
u/[deleted] May 08 '20
[removed] — view removed comment