|
Re: "No sliver bullet" is in the fine print
|
Posted: Dec 5, 2006 1:36 PM
|
|
> C++ allows for correctness; it doesn't enforce it. That's > the point. His answer is that C++ doesn't stop you from > writing correct code. My car doesn't force me to get into > an accident. That's a much different statement then > saying my car prevents me from getting into accidents. > The reality is that C++ doesn't do much of anything to > o prevent error. If runtime efficiency isn't the reason, > what is the reason?
Runtime efficiency is one reason. This actually matters to some people. Another, to me, is correctly modeling the problem domain. Every system in the world isn't an object and for some problems a strict or nearly strict OO language such as java is more of a handicap than a help. You make it sound as if it is impossible to write elegant "correct" code in C++. To that I say bullocks. Is it harder? In some cases, yes. Besides, when you come down to it "correctness" is nothing more than opinion and, if we're lucky, a consensus opinion.
Modern C++ goes a long way toward helping people not make common errors. Everybody bitches and moans about managing memory as a big deal and the fact of the matter is you don't need to do low level memory management in C++ in the vast majority of cases. You don't have to use raw C arrays, either. The STL provides containers that are efficient and safe. I find C++'s mechanisms as good as or better than most languages, but we've had that discussion already. You don't agree and that's fine.
> And somehow this means we must use C++ to write them?
No. D is an option I mentioned. It has a lot of the features of java you appear to like and most of the raw power of C++. I don't ever remember saying that C++ is what everything should be written in. You seem to have ignored that.
My point was simply that many people's bias against C++ amounts to prejudice. Most of people's gripes with C++ are unfounded or, at best, on shaky ground. Also, I think there is a trend away from lowlevel systems programming and people understanding how computers work. At least this is what I've seen in my experience. If everybody keeps working at higher and higher level of abstraction, who in the world is going to write all the nice memory managed virtual runtimes that applications should be run in.
I can't find the blog, but there was a microsoft blog I read a few weeks ago where somebody was lamenting about how hard it was to find "good developers". They were looking for the sort of people that could actually write the garbage collector for .NET or java. Everybody seems so focused on abstracting everything away that the knowledge of how things actually work under the covers is becoming the domain of a shrinking group. I find this alarming at best. On the plus side, I seem to be pretty valuable to the people I work for because I can find and fix problems that a lot of people seem to have trouble finding simply because they can't imagine how their code could be so slow. The runtime should just automagically make everything fast for them.
> > And the first C++ compiler had to be written in another > language. All advancements in languages have been built > upon a previous abstraction. >
I'm sure that trend will continue. In many cases it is the right choice. That being said there are many people that dip down into assembler to get things done. I don't disagree with you, but sometimes you need to get as close to the metal as possible. Environments like java and .NET completely remove that option.
> > At some point there is a person > > responsible. > > Someone at some point had to write machine code by hand. > This doesn't everyone should.
Again, I don't disagree with that. But if I have to get down to that level it's nice to know I can.
> > > I think most people that use C++ are > > perfectly happy deferring to the compiler and standard > > library as much as possible. I know I am. In some cases > > what is provided isn't good enough, however, and C++ > gives > > you the power to do what you need to do in order to get > > the job done. > > No other language but C++ allows for this and no such > other language is possible? >
I'll say take a look at D again. But, to be honest, right now, no widespread language has the combination of raw power and high level of abstraction that C++ does. This is both its blessing and its curse, as this thread has made amply clear. Many languages have better high level abstractions than C++. C and assembly might let you write more memory and CPU efficient code if you try real hard. C++ (warts and all) combines the two pretty well.
> > Java and its ilk close off some areas to the > > application developer. In most cases that isn't a big > > deal. In some cases it is. > > You forgot to mention the price of tea in China. >
Also the prices of lemons in london.
> > The point of having a human at the keyboard is to solve > a > > human problem. In some cases that does require bit > > twiddling. > > I think that's a the very least an unproven assertion.
Really? The reason I write code every day is to help solve some problem somebody has. If nobody needed the computer to actually do anything, I wouldn't have a job. Sometimes I twiddle bits to make that happen. So at best my assertion is anecdotal. You mentioned that the point of having a human at the keyboard is not bit-twiddling. What do you think the point is, then?
> > > I don't know if that will always be the case > > but given that people design the machines and compilers > I > > expect this to be the case at least for the duration of > my > > life. Besides, some of us find bit-twiddlng to be fun > in > > its own right :-) > > And that last statement is really why I think people cling > to C++. They like being down in the weeds. I've written > machine code and assembler. I felt a sense of great > achievement when I worked it out. There may be times when > someone needs to go back to those levels to start over. > But this is the exception. It's highly inefficient in > n terms of programmer time and it's not special. It's not > what the art of programming is about. It's menial.
I agree that dropping down to that low level of abstraction should be the exception but I think you are very wrong about that being the reason people cling to C++. I don't like regularly getting down into the weeds. But I really like the option. People cling to it because they have the option. People that write games and rendering engines drop down to this level quite often. I consider the work they do very special. If that is menial, is a class that manages database connections really even worth mentioning?
So what is the art of programming about to you?
|
|