6 ms·
On exceptions, I respectfully disagree. Even if you don't use exceptions in C++, just allowing them (and thus supporting them) imposes a cost, both in terms of
by cletus 5y ago
On exceptions, I respectfully disagree. Even if you don't use exceptions in C++, just allowing them (and thus supporting them) imposes a cost, both in terms of extra code but more importantly on the programmer to make sure what they write is exception-safe.
For a large number of people, exceptions is essentially interchangeable with "output log message and exit".
> And if there was such a rule, then Abseil wouldn't exist.
You misunderstand me. What I call "leaf nodes" don't (or shouldn't) create their own templates. By "leaf nodes" I mean, say, the payments logging team. They're created by specialists. Specifically, abseil is created from "//base", which is a mature battle-tested set of libraries at this point.
Likewise, anyone can create something in base or just modify something that's there but any such addition or change is going to go through an awful lot of scrutiny and testing.
That's the point.
- kllrnohj 5y agoYou don't start by building something general in a base library. You start by solving your local problem, and if that turns out to be a general problem it should then be promoted to a base library. Battle-tested set of libraries started out their life as random utilities in "leaf nodes" - otherwise they wouldn't be "battle-tested". See also https://blog.codinghorror.com/rule-of-three/ https://blog.codinghorror.com/rule-of-three/
- tsimionescu 5y agoThose are two well-known approaches to problem solving: GP is proposing top-down, you're advocating for bottom-up. There are pros and cons to each, and in the end it is more of a matter of preferences. Just to give an example of someone else advocating for top-down problem solving, Bjarne advocates strongly for designing the libraries that you will need before writing specific code for your problem. He has some example videos where he goes through a code review taking some piece of procedural business code and showing how it should have been written to take advantage of existing libraries and creating new ones before.