5 ms·
The people who built my house likely never took Strength of Materials during their civil engineering undergads, they just follow the building codes and nail tog
by pedrocr 17y ago
The people who built my house likely never took Strength of Materials during their civil engineering undergads, they just follow the building codes and nail together pre-made pieces (sometimes very large pieces) of house.
The problem with this kind of analogy is that a builder starts with a set of well-defined plans drawn up by some architect or engineer and then executes the house to those specs. The only design document that lives up to that standard when it comes to programming is the full source itself. The part the homebuilders do is what the compiler/linker/toolchain do.
There's a classic essay about this called "What is software design?"
http://www.bleading-edge.com/Publications/C++Journal/Cpjour2.htm http://www.bleading-edge.com/Publications/C++Journal/Cpjour2...
- chromatic 17y agoThe problem with this kind of analogy is that a builder starts with a set of well-defined plans drawn up by some architect or engineer and then executes the house to those specs. I've worked in construction, and a handful of my good friends work in construction of various types. We often laugh at the comparisons between software development and construction. I've certainly never seen a job where the plan worked without modification from beginning to end, and many projects begin with a pile of change orders.
- loup-vaillant 17y agoGood link. I have to disagree, however with the assertion that C++ was a step in the right direction. C++ tries to bridge a gap between low-level design and high level design. I think this was a wrong choice to make, because it made it incredibly complex and hard to use. Many projects don't need to worry about some low levels aspect of the design (if at all): memory management, for instance, can mostly be left to compilers and linkers. When we really need to, we can locally use really low level languages, like C.
- jemfinch 17y ago> Many projects don't need to worry about some low levels aspect of the design (if at all): memory management, for instance, can mostly be left to compilers and linkers. And in properly written C++, it is.
- loup-vaillant 17y agoNo it is not. More precisely, I don't see how you could avoid manual memory management in any significant C++ project. Here's why: The only memory that is automatically managed in C++ is the stack. (If you disagree, please know that I will be very difficult to convince.) So, "properly written C++" literally means "C++ code which doesn't uses the heap at all". That's probably not what you meant. Relaxing this rule a bit, you could code in a RAII fashion. That way, the users of properly written objects won't manage the memory themselves. The implementation of those, however, still have to. A prime example is the STL. Plus, I'm not sure RAII all the way down is "properly written". See, such logic is quite copy-prone, affecting the code's efficiency. You use C++ for it's performance, right? So you have to manage the memory manually at some point. Or you could use smart pointers. They mitigate the need for manual memory management, and allow sharing. But even then, you might want to (manually) pay attention to loops in the pointing chains.
- jemfinch 17y agoRelaxing this rule a bit, you could code in a RAII fashion. That way, the users of properly written objects won't manage the memory themselves. Which is exactly my point: between the standard library and smart pointers, many projects will never have to touch any details of memory management. The implementation of those, however, still have to. A prime example is the STL. Of course. But you only need one standard library, and many projects can use it. Don't forget your original claim, which I quoted in my previous post: "Many projects don't need to worry about some low levels aspect of the design (if at all)." It's absolutely true that many sizable projects written in modern C++ never have to consider the low-level details of things like memory management, since those details have been pushed into the libraries they use. Plus, I'm not sure RAII all the way down is "properly written". See, such logic is quite copy-prone, affecting the code's efficiency. There are ways to mitigate that impact, if it becomes a performance issue, but it rarely does. Or you could use smart pointers. They mitigate the need for manual memory management, and allow sharing. But even then, you might want to (manually) pay attention to loops in the pointing chains. That's only a problem for self-referential data structures, of which there are few not already implemented for you in the standard library.
- JoeAltmaier 17y agoDistinguish between architects,designers and coders. Different skills needed at each level of solution design.