Bjarne Stroustrup on the Problems With Programming
Hobart writes "MIT's Technology Review has a Q&A with C++ inventor Bjarne Stroustrup. Highlights include Bjarne's answers on the trade-offs involved in the design of C++, and how they apply today, and his thoughts on the solution to the problems. From the interview: 'Software developers have become adept at the difficult art of building reasonably reliable systems out of unreliable parts. The snag is that often we do not know exactly how we did it.'"
With a little research, nothing could beat MS-Access with its VB. We quickly had working GUIs integrated with business logic. Things were beautiful. PHP was available but the its abilities at the time were very limited.
Sadly, there is still no real answer to MS-Access' programming paradigm in the Linux world. Gambas http://gambas.sourceforge.net/ comes close. So does RealBasic http://www.realbasic.com/. Other wannabe environments are simply wasting time at present, and do not appear to be serious.
I am meant to understand that Kross http://conference2006.kde.org/conference/talks/2.p hp is progressing well, but was not impressed when I tried it.
Having powerful programming environments that are friendly to newbies is OK, but making them actively hostile to power users on the other hand is insane. Those two items aren't mutually exclusive, but Linux programmers tend to think so - sadly.
There's nothing intrinsically wrong with operator overloading as other posters have indicated. One thing I do think C++ could do better is have operators in a family. For instance, == and != have well understood and complementary functions. When we define equality on a type, the definition for inequality is pretty obvious. In the spirit of C++, there should be a way to specify completely different functions for them of course, but generally bool operator!=(const X &x1, const X &x2) { return !(x1 == x2) }; Just like x x. Or we could go further and say that y >= x is the same as !(y x). This is how Haskell handles its operators. Eq types can define equality, inequality, or both.
The good thing about working in software-centric companies (besides understanding the programmer psyche) is that they often don't balk as much at being told something can't be done in a timeframe. Blizzard doesn't blink an eye when it has to delay a game by a year (probably more like 2 or 3 years when compared to internal, non-public set dates). Microsoft finally decided to nuke WinFS once they finally conceded that you're not going to get it within this decade, no matter how much they throw chairs. Google apparently has almost no schedules.
Some say C++ didn't go far enough, in that you can't define arbitary operators. As such, you have a small limited number to choose from and therefore overloading is all you can do. I'd love to be able to define an operator like .= to do string concatenation, but I can't, so I use += and live with the confusion and possible errors that causes.
How we know is more important than what we know.
You know what, this may sound strange, but I would recommend ActionScript for beginning programmers. Why, you ask? Well, aside of the fact that ActionScript is very simple, it's fully integrated with the capabilities of the SWF file format. That means you can make some kind of visual representation of what you're doing extremely quickly, and you won't have to worry about advanced rendering code, since it's all already there. You can have people algorithmically draw lines and shapes and graphs in virtually no time at all. Whereas you'd just be oversimplifying things if you gave people Python and a good library to take care of the visualization part.
Now that there's a free and open source compiler around, I think that schools should start considering it.
Anyway, the typical unsophsticated (software development-wise) customer can't tell the difference between the two. This is made worse when many managers who were supposedly professional programmers themselves can't tell the difference. As far as I can tell, the only way for a programmer to deal with this is to simply BE great and be ready to move on if the customer can't see that greatness. Eventually they'll get somewhere that will appreciate it.
I also cover some of this in another reply.
So where does something like Eiffel fit in? It's all the usual bist to stop you shooting yourself in the foot (a strong static type, garbage collection, etc.) plus added extras to make your code even more maintainable, and even harder to shoot yourself in the foot (design by contract, SCOOP concurrency, etc.) yet when it comes down to it the compiler turns out code on par with C++ for efficiency, and way better then C# or Java. You can say much the same of O'Caml with a very powerful and robust type system (far safer than C++, Java, C#, or Eiffel) and plenty of performance. It's possible to make sharp tools without completely throwing away safety.
Craft Beer Programming T-shirts
Actually, they do plan a major revamp of the Mozilla base. So major that they're going to use a tool to help automate the process.
If I had mod points, I'd gladly give them all to you ; I'm not a programmer by education, but I've always programmed tools since I have a computer. Basic could be abused in the past (in fact it was more or less a requirement with MS-BASIC on 8 bits computers - 48 Kb RAM !) but since OOP has become widespread, you just can't beat that language for day to day scripting, SQL access etc. Even in the mid 80s, if you were lucky enough to have a better PC than the average plastic toy, you could go with Basic-E or CBasic, which were by many aspects precursors to Java.
The sad truth is today's Basics (VB, Gambas...) have an unfounded bad reputation ; you can't really abuse them anymore, and with a bit of care, they make a very good entry point in the programming realm for everybody. And if Linux is to become relevant on the desktop, it needs power users to be able to switch the enormous base of custom applications made in VB for every business out there on Linux. The VB6 converter in Gambas might become soon the killer app of Linux, in that respect, combined with superior DB access and tight KDE integration (yes, you can use DCOP in Gambas).
To me, Gambas, being free software, fills the same spot MBasic was fulfilling on Amstrad CPC or Commodore 64. It gives control to the user, and that is priceless. Since my 8 bits days, I've learned bits of x86 ASM, Clipper, C, C++, perl, and liked the extra power it gave me ; but I've indulged in Gambas for a couple of months, and realisticaly, it's the only way to create a cool looking, desktop integrated application on spare time in a pinch. If I were again the teen I was, I'd like to begin programming with it because it would be the quickest rewarding experience in programming. You get to love programming cool things you can show to the world before you actually begin to like programming correctly for the sake of it.
Fair enough for the most part. (Don't use the ugly parts of boost if you don't want, and please give a concrete example of where collections need to expose a pointer).
But what is really missing from your rant is an alternative. It would be the most beautiful rant in the world if it ended with "And it doesn't have to be this way, CSuperDuperDoublePlus does everything C++ does without the problems!". Except it didn't, which means that C++ is still the language to use for a lot of tasks. Anything CPU intensive for example. There are still plenty of applications where performance really matters. Aside from the usual (image processing, video editing, etc) even any moderately complex program requires better performance than what Java/C#/Python can provide in some codepaths. So if you know of a language that's completely safe and at the same time as efficient as C/C++, you really should have mentioned it.
While I do not think "buffers" are the real problem of C++, I have to agree with "boost-cult" part.
I think the whole think started to sink when Bjarne hastily forced STL to become the part of language standard. STL looks very nice at first, but fails to solve the problem in real world.
In any case, it is a little but stupid to have container library unable to store objects in object oriented language (I know, C++ is called "multiparadigm", but objects are dominant part of language in many problem domains).
This in long term causes all these nice troubles and people wanting garbage collection in language, thousands of attempts to provide reference counted smart for various scenarious etc...
And then of course for some reason many "guru" C++ programmers found a new toy in templates and started all that lambda fun (which can be described as contest of writing better for_each loop).
What a pity. C++ is excellent (core) language, but it is seriously misused. And "C++ experts" live in sort of self-denial, solving problems nobody is really interested in.
Since finding Perl I've written most of my tools in it and these days if I want to develop a GUI quickly I do the logic in Perl, the database on MySQL and the front end in Tcl/Tk.
Granted Perl's a whole new command set for "Power users" to learn and doesn't provide portability for personal VB apps, however for my quick and dirty development of tools that I and others in the company use every day I find the combination untouchable.
The number of available modules for Perl, particularly for administration/network tools, and the simplicity of Tcl/Tk make for very rapid development of tools, granted the abscence of anti-aliased fonts and other eye candy does break the "Pretty is a feature" rule but hey, it's for admins not users.
"Linux is for noobs"-The new MS fud strategy
The languages students need to study are :
Prolog
Miranda/SML/Haskell
Java/C++/C#/Smalltalk/any other imperative with OO
Because these show the different choices in representation that programmers essentially have : declarative, functional, imperative (scripts). OO is a useful concept to describe to students because it gets them used to the ideas of abstraction and forces good programming practice like information hiding.
Later on it would be good if Universities taught web development (Php for example) and database development (SQL, possibly microsoft tools).
Interestingly universities do not teach, and I think rightly, the most common activity that CS grads end up doing in the real world, which is installation, integration, customisation and configuration of COTS products like CRM systems.
--------------------------------------------- "In the end, we're all just water and old stars."
Objective C ???
Red to red, black to black. Switch it on, but stand well back.
There's a good reason why MIT's introductory computer science courses are teach in the Lisp dialect Scheme: so that they can focus on teaching algorithms, modular design and other high level concepts rather than doing the grease monkey work of dealing with manual memory allocation and an old CPU design when the world quickly changes to a more parallelized approach.
I don't feel like it...
So you've been coding in C++ since 1981? That's impressive.
I only have 10 years of C++, but my experience in polymorphism goes back further than that, done in C, pascal, assembly language both inside programs and in operating system extensions. My understanding of re-use goes back to before I started programming and had to amuse myself with 4000-series and 74-series logic ICs and a few LEDs. This sort of experience helps one to consider techniques on their own merit rather than as part of a programming language or fashion trend.
There's a big lack of engineering in software development operations these days: so-called "programmers" or "developers" are really just clerks, accountants and librarians who chose CS for their degree. They know a language and can write it all day but dislike thinking about how the program will actually work.
XP and modern "flat" management techniques don't help either. Everyone has to be a "coder" who can write code but is scum in every way, or a manager with a "wider management view" which is like being smart but doesn't require any actual knowledge or abilities. Such organisations literally force out the engineers, and failed projects result.
A good reason to use some older language like Pascal or FORTRAN would be to avoid the pre-built classes problem.
"The difference between stupidity and genius is that genius has its limits." -- Albert Einstein
Hmm...
:) Not sure where you'd want to throw in a scripting language; or if it's even really neccessary... what skill do you learn from learning a scripting language other than the language itself?
I'd say pascal first as an introductory programming course, then C, then some assembly, then finally C++ or Java.
It's a lot easier to learn sequential programming when you're not busy shooting yourself in the foot... let them hit C after they know what a conditional and a loop are
Maybe in usage, but that doesn't lend itself well to learning. Learning, by definition, is the process of reinventing the wheel so that you understand how the wheel works. They don't teach algebra by presenting the quadratic formula and saying, "Here, use this when solving a polynomial of degree 2" - they lead you every step of the way through the development of the quadratic formula so that you know how it works and why it works. Likewise, programmers learning to program should be writing quicksort implementations rather than ignoring the details because "it's already implemented in a library".
Of course, once you've graduated and are a professional writing a program for somebody else to use, you should reuse what's available as much as possible.
Proud neuron in the Slashdot hivemind since 2002.
Speaking as a professional who doesn't use (or want to use) C++, I disagree. Whilst I agree that there are tiers of languages, and there are plenty I certainly wouldn't want to use on a regular basis, C++ is by no means the only one worthy of serious consideration. Java is one other obvious candidate, also (as much as I hate to say it) C#. And I'm sure we all know a 20+ year pro who uses Perl for everything :)
---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"
I'm curious why you think multiple inheritence in C++ is more trouble than it's worth.
As far as operator overloading is concerned, the intent was to provide the conceptual parallelism you explained. In D&E, he talks about C++ users asking for the capability for things like matrix addition. Using << and >> for stream input and output was an afterthought. Further, I don't think it was leveraging the C compiler that precluded him from overloading operators other than what were already in C. He easily could have supported new operators, as Cfront was not just a preprocessor, it was a full compiler that happened to compile down to C. Since I've never read anywhere (either in interviews, D&E, or TC++PL) why he chose to not allow arbitrary operators, I assume it was because he didn't feel they were necessary. I know that D&E has discussion of an exponent operator, which was eventually ruled out.
Because nearly always composition is a better way to deal with the design problems multiple inheritance attempts to solve, especially as the situation becomes more and more complex. Also, inheritance often implies more than necessary -- multiple inheritance multiply so. You usually are most concerned with guaranteeing an object's behavior when you use inheritance, but you also get an implementation whether you want it or not. This creates unnecessary complexity and problems when you use multiple inheritance simply to ensure that object class memebers provide certain services.
I'm not saying it's never useful of course. But it is never necessary and often a bad thing.
You make some good points. My guess is this: allowing user created operators probably made lexxing difficult or impossible. You wouldn't be able to tell whether a sequence of characters was an operator or something else until you had parsed the operator's definition. You couldn't have a fixed grammar either, which might preclude further parsing even if you had a clever way of guessing that some string is probably an operator.
Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
I hold the exact opposite opinion.
I believe effective learning should be done in a top-down manner, whereby students start from putting building block together, gradually drill down to understanding how the blocks themselves work. This view is echoed in the classic C++ textbook "Accelerated C++".
Real-world programming requires good exposure to design patterns and programming idioms, and effective use of canned routines. As such, colleges should focus on this skillset in order to equip people for the industry. This is exactly the same reason why nowadays colleges no longer teach hardcore assembly techniques like those used in Knuth. It is absurd that colleges these days still make linked list writing mandatory, and design pattern course an elective.
I myself am a real-time system engineer and back a couple years I taught operating system and computer architecture at Hong Kong Univ of Sci and Tech, I have always been of the opinion that the industry does not need a lot of OS gurus. These hardcore stuff is best be left to the graduated and professionals, who choose to develop in these niche areas.
It's not about languages, it's about people. Sure, C will make you track bits and bytes and jiggle with pointers. Everyone should try that and deal with mysterious crashes, etc. And one day switch to Java and track indices in arrays and null pointers and hash codes. But at the end of the day, it's all about people, not languages. If the people are smart, and if they love the field, they will advance no matter what they're taught at school. Very few are those go that far as to learn every new language, and one day reach the level when they just don't care about the tools they use, and cat get any job done with any language at hand.
So, it's about people. We all make errors, we all over-enginner or under-engineer, we all write too complex code because of design errors. We all learn and advance. And not all of us make the best of choices.
So what? This is not just with programming though. Just programming is the most complex task humans do.