Slashdot Mirror


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.'"

605 comments

  1. In my experience... by Wizard052 · · Score: 3, Informative

    ...at a university I know, they start teaching you programming in...Visual Basic. I can imagine the effect that has on the poor confused heads here who never eventually grasp other languages (including VB).

    Maybe if they started with something like Pascal or something...but thats just not 'modern' or cutting edge nowadays...

    I think this is the case in many institutions leading to low quality coders.

    1. Re:In my experience... by bogaboga · · Score: 4, Interesting
      In my case, we were presented with a problem and asked to "produce" a possible solution in a month. From the tools we had, VB was the most obvious. No body dictated what we should be using in our solutions.

      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.

    2. Re:In my experience... by atomicstrawberry · · Score: 4, Informative

      My university started everyone out on C. Having seen some of the horrible code that some students produced even in the final year, I'd say that the problem lies deeper than the language they started out on.

      Though I'd hate to have started with Visual Basic all the same.

    3. Re:In my experience... by omeg · · Score: 2, Interesting

      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.

    4. Re:In my experience... by americangame · · Score: 4, Insightful

      Well in my experience they had me learning C on Unix, then Bjarne Stroustrup (along with another professor) taught us C++. I must say that learning a programming language from the creator isn't the best way to do so, as he will begin to go into the extreme detial of how a pointer in C++ works with no regard for the fact that it might be too much information for the first week of class. But it is a great way to scare the ever living piss out of freshmen in college that are considering to become computer engineers.

    5. Re:In my experience... by Wizard052 · · Score: 3, Insightful

      Actually, I like VB. I believe it's good for what it's for- RAD and if properly used (as applies to any tool). But too often its seen as some kind of panacea, at least in this part of the world, for IT education. It's probably the power of the Microsoft brand (if not the product(s) ) at work here...

    6. Re:In my experience... by Garridan · · Score: 5, Insightful

      VB is a rapid prototyping environment. And just like an RP machine, it makes a flimsy product that you can send back to the drawing board without much expense. But you don't ship a product you've made on an RP machine -- it's crap. You take your prototype, and make a real product out of it using sturdy materials. Same goes for VB. You make something that works the way you expect, then you make it work in a real language. Good thing about VB is that you can replace pieces at a time with DLLs compiled from C++. If that isn't a part of the VB curriculum, it's a waste of time.

    7. Re:In my experience... by QuantumG · · Score: 1

      Meh, these days VB is just as sturdy as C#. Not that I'm saying that is sturdy.

      --
      How we know is more important than what we know.
    8. Re:In my experience... by arivanov · · Score: 4, Insightful

      Exactly.

      C, C++, Java and god forbid VB should be prohibited by law for university courses and any person teaching them during the first 2 semesters in CS should be prosecuted for child abuse. Pascal (even without the object oriented extensions) remains the best language for teaching the first years in CS. Once students are past their data structures course and know how to deal with linked lists, pointers, objects hashes and the like you can switch to C, C++ or Java with minimal fuss. Before that its outright criminal. In fact the total amount of hours spent till the point when the students can produce something that will pay their daily bread will most likely end up being less than the required when teaching directly in C/C++.

      There was a very good article on the subject by Joel called The perils of Java schools and I tend to agree with it 100%. In fact I will extend its reasoning further to C and C++. Probably the most important part of teaching a data structure course is to teach it in a language that has a clear syntax and "one way to get it right" for pointers, linked lists and the like. C and C++ are insufficiently clear and unambiguous. Java simply does not allow you half of the things you need to do in that course.

      Many people advocate for the usage of Java and especially VB from the perspective of "look how fast can I learn to program in these". That is irrelevant as far as university courses are concerned. What is relevant is will the student learn to produce literate, commercially viable code or not. If he has been subjected to VB - never, Java or C++ - not bloody likely, C - it may work but it will be anything but readable for the first 10 years of his career.

      --
      Baker's Law: Misery no longer loves company. Nowadays it insists on it
      http://www.sigsegv.cx/
    9. Re:In my experience... by weicco · · Score: 5, Informative

      I've worked in project that was/is probably the most largets VB project in the world. It started in 93 and I don't think they are going to end it soon. I personally hate VB, it's not-so-strongly-typed variables, funny rounding rules and so on, but I wouldn't say that all you can do with it is crap!

      The software we were making just works. It has worked for 13 years and keeps working. Maybe it could be little faster if written with some other language and tools or it might have more fancy UI blaablaablaa but it doesn't need those. And rewriting those hundreds of thousands lines of code... Let's just say that I wouldn't like to be in that team.

      --
      You don't know what you don't know.
    10. Re:In my experience... by Anonymous Coward · · Score: 0

      Well, that's all good if you start out with students who are completely blank. But at my uni around half of the students know some programming already when starting out.

      And Pascals use of symbols and syntax is fucked up.

    11. Re:In my experience... by RAMMS+EIN · · Score: 4, Insightful

      I don't think the main issue is which language you start with. What's important is that you teach people multiple paradigms and multiple languages, so that they are aware of them and their strengths and weaknesses.

      --
      Please correct me if I got my facts wrong.
    12. Re:In my experience... by Antiocheian · · Score: 1

      Interesting.

      You would recommend basic ActionScript instead of LOGO for schools, right?

      Could you post a small piece of ActionScript code that could be learned in 1 hour of teaching?

    13. Re:In my experience... by bar-agent · · Score: 1
      But at my uni around half of the students know some programming already when starting out.

      And then you've got to un-teach everything they learned wrong. It's easier for them to make a clean break from past bad habits if you give them a whole new language to play with. It doesn't even have to be Pascal; depending on what you want them to learn, Logo might be better. :)
      --
      i'd hit it so hard, if you pulled me out you'd be the king of britain [bash.org]
    14. Re:In my experience... by $pearhead · · Score: 5, Insightful

      I disagree. Programming isn't something you learn from someone else. Programming is something you learn by yourself. Of course, you can get excellent help/lectures/tips/advice/insights/whatnot at an university for example, but my point is that in the end you have to sit down and think and then write some code (and figure out why it doesn't work) by yourself. I would say it doesn't matter if you start with Visual Basic or Pascal; if you haven't got the ambition/derive/whatever to really sit down by yourself and figure things out, you will never be a (good) programmer.

    15. Re:In my experience... by aztracker1 · · Score: 1

      Well, there's java (iirc there's a f/oss database in java that ibm bought out).. there's also SQLite + java, or mono, or python... As far as an integrated package, Access offers a lot.. I haven't done much with OOo's database though.

      --
      Michael J. Ryan - tracker1.info
    16. Re:In my experience... by Anne+Honime · · Score: 3, Interesting

      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.

    17. Re:In my experience... by SwedishPenguin · · Score: 1

      I was under the impression that Java was the most popular first language at universities nowadays?
      I'm a first year CS student at the Royal Institute of Technology in Stockholm, and we're using Java as our first language. (though not really first for most of us)
      It's a pretty good first language IMO since it teaches object oriented programming without the need for all the manual memory management of C++.

    18. Re:In my experience... by aztracker1 · · Score: 1

      Well, ActionScript is roughly JavaScript... the issues with ActionScript, and why I don't think it is well suited, neither is JavaScript for that matter as a first language (and JS was mine back in 1995), comes from the fact that the Flash API is a horrible mess, AS3.0 will help that a *LOT*, but for now, is only available in Flex.

      Simply put, though AS can be semi-strongly typed, as a developer tool, flash is a total PITA. Also, typical use of Flash + AS may include syntax from prior versions /movieclip/subclip etc... this collides with JS's use of /.../ to be a literal RegExp (which is another issue with flash's AS). The API and tools layers are inconsistant at best. Results can be irratic. and code tends to get sprinkled throughout the UI (though it doesn't *need* to be, instead of btnGo.onRelease = new function() {...} it gets put into the UI, attached to the button. Making it hard to trace through, the button is not such a great example, but actions in sub-movies are a better one. Let alone dealing with XML (improper unicode/utf support)...

      If one is starting out, a language and environment that have consistancy is probably best.

      --
      Michael J. Ryan - tracker1.info
    19. Re:In my experience... by sillybilly · · Score: 1

      Exactly. Moreover practice makes the master, but interesting practice at that, not boring. There is nothing like learning while having fun. Just look at little kittens.

    20. Re:In my experience... by jonwil · · Score: 1

      A better option might be the new Turbo Delphi product. It comes in the free "explorer" flavor that as far as I can tell does everything that one would need for courses like this. Also, it can target both .NET and win32.
      Delphi combines the best features of Visual Basic (make GUIs quickly etc) with the best features of Pascal (including the strongly typed nature). Oh and it has none of the bad features of C/C++ (if it does have them, I havent seen them)

    21. Re:In my experience... by illuminatedwax · · Score: 1

      Everyone knows the only language to start CS majors out in is Scheme. SICP should be everyone's freshman textbook.

      --
      Did you ever notice that *nix doesn't even cover Linux?
    22. Re:In my experience... by omeg · · Score: 1

      The first hour of teaching should be used to familiarize the pupils with whatever software they'll be using. If you're using the Flash IDE, you've got the advantage of being able to draw movie clips to use for the visualization. If not, the teaching should be about simple, weakly typed code at first.

      A fibonacci generator comes to mind, but that's overdone and not impressive for your average pupil. Maybe a program that takes grades from students and calculates a class average, as well as whether an individual student did better or worse than the average and whether the student passes the course.

      The movie clip drawing API could be taught, in its simplest form, in one class. The one that comes after the basics.

    23. Re:In my experience... by Skrynesaver · · Score: 2, Interesting
      I'm of a similar background, self-taught in QBasic, Turbo Pascal, Perl, C, C++.

      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
    24. Re:In my experience... by sgt101 · · Score: 4, Interesting

      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."
    25. Re:In my experience... by Anonymous Coward · · Score: 0

      BASIC doesn't exist anymore. It has been replaced by a java-clone Virtual Machine. Thus, there should be no more need to just prototype with it and later move to another platform for sturdiness, right?

      And then the real problem appears: although you now have a strong platform to develop quality apps, you will soon find out that the reliability with VB# is not here either. What's the problem then?

      Well, it's the people, stupid!
      BASIC was not just an interpreter. It's a market, it's a sociological group. It allows quick & dirty development of unmaintainable screen dialogs at low wage costs. And the same kind of people are now supposed to use the "new" BASIC# using the same skills.

      If you want quality, hire java or sharp# programmers. It's not just the platform, it's the people!

    26. Re:In my experience... by Anonymous Coward · · Score: 2, Funny

      No! No! No! You are posting to slashdot remember? Your post should be a pontificating rant about how all development should be done in C/C++ (or better yet assembler) punctuated with the occasional sneer at VB developers. You would get bonus points if you could some how disparage Web Developers and fit in a whine about AJAX.

    27. Re:In my experience... by Anonymous Coward · · Score: 0
      rewriting those hundreds of thousands lines of code.

      You mean like converting it from VB6 to VB.NET? I thought microsoft themselves killed off VB.

    28. Re:In my experience... by Anne+Honime · · Score: 1

      From what you wrote, you really really really should give Gambas some consideration ; while certainly a bit "young" to fill all your needs, you'd be amazed at what it can do for you now, and a casual look at the dev list would give you an inside glimpse of how it's going to be truly amazing soon.

      At the moment, Gambas can use perl regexp, raw sockets (tcp, udp, icmp, local), embeds libcurl (http, ftp, smtp, [soon] telnet), can work as a CGI with apache, can act as a standalone server, has xml / xml-rpc / xsl native capabilities, integrates seamlessly with MySQL, Postgresql, sqllite, firebird ; and this is only a small subset of Gambas abilities. In fact, it's dead easy to write a C++ wrapper around any shared library to use it with gambas.

      It may sound like proselytism, but I've been really stunned by the power of Gamabs and the easyness of programming with it.

    29. Re:In my experience... by redragon · · Score: 1

      I don't think he means that we don't know how it works (VB Voodoo).

      I think he means that by the time a system is designed and "completed", we don't actually know how the whole system came about. Why we made the decisions we did. Why were the design decisions we made the ones we did? What did we try that didn't work? What API's did we have to work around to get the thing to work in the first place? Remember stepping through the debugger looking at the return values from that one library, that wasn't doing what you thought it would, but you figured out what it was handing you back? That's what he's getting at. Sure in a large project there isn't anyone that knows about how the whole darn things works, but that isn't the point.

      This is honestly where I think good social science research can be of use to software developers. Or at least social scientists with a flare for the technical. My current research on video game development would certainly support what Stroustrup is saying here.

      --
      - Sighuh?
    30. Re:In my experience... by jbolden · · Score: 1

      If you want to teach paradigms (which seems to be your intent) you probably should teach OZ/Mozart OZ in the classroom , which is a multi-paradigm language designed for education. Further it has a standard text which walks you through all the major paradigms over the course of about a year. That way you are only teaching syntax once, setting up one environment.....

    31. Re:In my experience... by namekuseijin · · Score: 2, Interesting

      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...
    32. Re:In my experience... by ThosLives · · Score: 1

      I think you're correct. After all, if you know how to program, then the language with which you program doesn't matter. I would argue that if you cannot learn a new programming language for base use in, say, a week, you don't know how to program. (By base use I mean the basics - not the little tricky subtleties that every language has.)

      I think it's more a matter of thinking logically and mathematically, and knowing algorithms, and knowing safe practices, than the particular syntax of a language. I definitely agree with Stroustrup's thoughts that a language needs to be as free as possible and trust that the user of the language knows what s/he's doing. I think it's a shame to make things cater only to the lowest common denominator - this applies to programming, driving automobiles, politics, finances - everything. It pains me greatly that all too often - especially in the USA, that the lowest common denominator seems to win more often than the experts.

      --
      "There are a dozen opinions on a matter until you know the truth. Then there is only one." - CS Lewis (paraprhase)
    33. Re:In my experience... by Anonymous Coward · · Score: 0

      While Java doesn't have explicit pointers, it does have references. Linked data structures are commonly built in Java, they're pre-rolled in the Collections framework, but you can implement them from scratch too.

    34. Re:In my experience... by Lodragandraoidh · · Score: 1

      Here is what I have learned that hasn't let me down over the years:

      In school:
      Highschool - Basic (interpreter - not VB), Fortran
      University - RISC assembler, C++, Java, Perl, awk/sed, sh(shell)

      On my own:
      x86 assembler, C, Python + Zope (after getting frustrated with various Java frameworks)

      Today I do integration work for a major Fortune 500 company; statistical agregation from hetrogenous systems, installation automation, backup and recovery automation, content management system configuration and administration, and revision control management for our internally built applications and libraries.

      --

      Lodragan Draoidh
      The more you explain it, the more I don't understand it. - Mark Twain
    35. Re:In my experience... by Flodis · · Score: 5, Insightful
      VB is a rapid prototyping environment. And just like an RP machine, it makes a flimsy product that you can send back to the drawing board without much expense. But you don't ship a product you've made on an RP machine -- it's crap. You take your prototype, and make a real product out of it using sturdy materials. Same goes for VB. You make something that works the way you expect, then you make it work in a real language. Good thing about VB is that you can replace pieces at a time with DLLs compiled from C++. If that isn't a part of the VB curriculum, it's a waste of time.
      Sigh... To me, this sounds like a typical rant from someone who doesn't have any actual experience.

      Anyway... I think the problem may be that VB is too easy to use. People who would not be able to write the makefile for their 'Hello World' program in C++, are able to write working but very rickety/ flimsy VB programs.

      I happen to make a living as a computer consultant. This means I get to see a lot of different organizations and their in-house software... This means a LOT of VB code... And of that VB code, a lot (maybe 90%) is written by people who may know their business but don't have a clue about programming. I can definitely see how that would create the reputation that VB programmers are bad, but not how it makes the LANGUAGE bad.

      As for stability, I can promise you that some of my VB programs are a hell of a lot stabler than the memory-leaking SEGF/GPF-ing C++ hacks they replaced. In case you didn't know - it's perfectly possible to write shitty C++ code too. It's just that you have to get above a certain level to even get the compiler to work, so most of the would-be self-made computer wizards turn to something easier instead.. Like VB.

      The big question here is: Is it better to have a flimsy but functioning VB program or a defunct makefile? I'm not sure of the answer myself. A defunct makefile is a 5-minute job to fix, whereas some of the VB messes I've seen would literally take years to get straightened out. (I hate people who think they can program just because their $h!+ compiles.)
    36. Re:In my experience... by Anonymous Coward · · Score: 0

      I'm not so sure about that. We have a few front-ends to n-tier systems made in VB. Portions of it are even simply databound to Business Objects (using ObjectDataSource) - no code at all. And it's been working really well (scaled far better than I would ever have thought too).

      People keep seeing VB 2005 (.NET) as your "grandather's" VB3 or such - which surely did suck. While I much prefer other languages (C#, Java, etc), VB often is good enough for the job.

      Anyways, I'm not saying it's the universal solution to everything or anything like that, but it's hardly "just a prototyping tool" - which absolutely NEEDS to be re-done in a "better" language afterwards.

      Unless you were talking about the old VB (non-.NET), in which case you can ignore anything I just said.

    37. Re:In my experience... by Anonymous Coward · · Score: 0

      If everyone knows that, your comment should be modded -1 Redundant!

    38. Re:In my experience... by try_anything · · Score: 2, Insightful

      It's better not to encourage the belief that one language can be good for everything. Students invest themselves in that belief quite strongly anyway just because of wishful thinking.

      They also acquire the belief that unfamiliar syntax is a serious barrier to learning a new language. Forcing students to learn a few languages with different-looking syntax might help. The superstition seems to be reinforced by the fact that their every attempt to learn a new language lasts about two weeks, so giving them brief exposures in a class about programming language concepts would only reinforce it. Better to teach a language by making it the official language of a certain class and requiring that all programs for the class be written in it.

    39. Re:In my experience... by Anonymous Coward · · Score: 0

      I heartily agree - a diversity of experience amongst radically different 'things' is one of the best parts of any higher education course.

      Graduates should be able to draw on their higher education and realize that the problem they are faced with is 'nothing like' anything they ever directly studied, and yet they can still use their experience to study the problem and find solutions.

      This applies to high school too (though in that case the diversity is often not as great). I studied Latin at high school for three years. Why ? Because Latin was at that time a requirement for entry into Oxford and Cambridge Universities (this was a government funded school too). At the time I 'put up' with it but somewhat grudgingly. Twenty years later I was living in Hong Kong and spending a lot of time in China and started learning small amounts of Mandarin and Cantonese. My Latin experience came back to me when I realized that the Chinese dialects are nothing like the modern European languages that are derived from Latin and have such 'features' as a plurality of tenses (which Chinese dialects diminish and replace with expressions of 'completion' or 'tomorrow').

      Studying languages like Haskell or Miranda (which I studied at University) make you realize that common procedural (and common OO) languages like Pascal, VB or C++ are 'nothing like that'.

      Higher Education should also be most careful to be clear when they are not (or actually are) vocational institutions. University courses in particular are not vocational but they do a great disservice to their students if they leave them with the impression that they now have useful 'real world skills'.

    40. Re:In my experience... by Lord+Ender · · Score: 1

      Pascal? How about Python or Ruby.

      When they graduate, they would have experience with a useful language. And when they are 1st year, they can actually learn computer science (algorithms) instead of wasting time managing memory allocation and pointers.

      At my school, we used a language invented there, which was like C++ but without pointers, etc. It had built in, easy-to-use stacks, queues, lists, etc. It wasn't perfect (Python might have been) but it was better than sprinkling *'s and &'s until things worked (which is what the students at C and C++ schools do).

      --
      A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
    41. Re:In my experience... by CaptainPinko · · Score: 1

      don't forget Scheme and VHDL or Verilog and a RISC assembly.

      Went through all those a have benefited greatly.

      --
      Your CPU is not doing anything else, at least do something.
    42. Re:In my experience... by MrSteveSD · · Score: 1

      VB is a rapid prototyping environment.

      VB does let you develop quite rapidly, but no more rapidly than most languages that have built-in GUI builders. The language lacked some important features such as inheritance, but it was still possible to write good applications. The problem is that because VB was easy to use, management would often employ morons to use it. I'm talking about VB6 here, not the new VB.NET (which I don't use).

      As for rewriting your VB apps in a "real language" like C++, well, VB is a real language. It manages it's own objects using reference counting (the new VB.NET uses Garbage collection) and you really need something like that for rapid business development. I shudder to think of all the memory leaks that would arise in an equivalent C++ program.
    43. Re:In my experience... by Alioth · · Score: 2, Insightful

      Grrr.

      If that's a computer science course, or any other degree that purports to teach fundamentals, that's so wrong it's not even wrong.

      You have to learn the fundamentals, not use ready made components. Indeed, I'd advocate at least some assembly language programming, because this forces you to think HOW the machine actually does things. It needn't be x86 or anything particularly fancy - but something that will at least teach the student on an absolutely fundamental level what happens when you get a buffer overflow that starts overwriting the stack.

    44. Re:In my experience... by TheLongshot · · Score: 1

      As a corollary to this, using the creator's book as a textbook for learning C++ isn't a good idea either. I had a hard time making heads or tails of anything and ended up failing the course. Course, it being the early days of C++, there weren't many options.

    45. Re:In my experience... by DuckDodgers · · Score: 1

      And of course, students can't get too focused on the language itself instead of the concepts because the demand for Scheme developers just doesn't quite match the demand for Java/VB/C++ developers.

    46. Re:In my experience... by zzyvits · · Score: 1

      I always thought that the best way to intoduce someone to computer programming was through Assembler. Why? First, you really have to manage what your program is doing. Second, if you are able to write code using Assembler, then you can write code using any other language, and it will seem easy.

    47. Re:In my experience... by ultranova · · Score: 1

      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.

      OO does not force information hiding; you can just declare everything public. Some OO languages - like Python - don't even allow information hiding at all.

      Anyway, start them from as simple and straightforward language as possible - preferably shell scripts - and then move to assembler and from there to BASIC, C and onward. The last thing you want to do is teach them OO without them having any idea what problem OO was supposed to solve. Heck, before they'e had a merry go with BASIC's GOTO and manually managing variable names in a long program, they propably won't really get the idea of procedures, local variables and stack.

      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.

      IMHO these aren't subjects for the university at all, but rather for - whatever it is that you Americans call it, the school that teaches the people who build and maintain of pipes and electric lines and such ? After all, installation - and even programming - aren't computer science, they're computer-related practical skills. Actual Computer Science would be Boole's algebra and such.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    48. Re:In my experience... by rubeus · · Score: 1

      I'm a student on internship right now and while I agree that learning to uses languages of different perspectives is important, I don't think it is the university's duty to teach students any particular language. I think students should learn how to be computer scientist; they should gain the ability to learn on their own. It all goes back to giving someone a fish or teaching them how to get one themselves, right? I actually want to take more classes on language theory; I don't find it very productive to go to class to learn any one language, that should be something one does independently in my opinion. Teaching web development is also not something I would want to pay tuition for. I mean just what kind of universities are you talking about?? Maybe you are referring to some type of vocational schooling instead?

    49. Re:In my experience... by namekuseijin · · Score: 1

      yes, that's exactly why they use Scheme, a language with barely any syntax at all and a very minimum native library.

      --
      I don't feel like it...
    50. Re:In my experience... by tehcyder · · Score: 2, Funny
      No! No! No! You are posting to slashdot remember? Your post should be a pontificating rant about how all development should be done in C/C++ (or better yet assembler) punctuated with the occasional sneer at VB developers. You would get bonus points if you could some how disparage Web Developers and fit in a whine about AJAX.
      You forgot about acting horified at the mere name "COBOL", and also possessing the ability to imply that you are simultaneously a thirteen year old multi-millionaire programming superstar whilst also having been around to help Alan Turing with his soldering and probably Einstein with some of his more difficult sums.
      --
      To have a right to do a thing is not at all the same as to be right in doing it
    51. Re:In my experience... by Anonymous Coward · · Score: 0

      As a computer engineer at Virginia Tech, we learn C++ first. Of course we then scoff as the CS majors who learned java first then fail to EVER free memory in all the programming classes we take together. It utterly disgusts me when professors do not enforce good memory practice. Honestly if I was hiring people the first thing I would do is give the people a simple test like "create a function that allocates a class to pass data back to main" just to see if they even considered putting a delete at the end.

    52. Re:In my experience... by Garridan · · Score: 1

      Naw, I've got plenty of experience, both in the corporate and open source environment. My two biggest complaints about VB are the limited support base (windows) and performance (shitty). No dynamically typed language is going to beat C++. Also, like Bjarne said, you can write just about *anything* in C++. Can you write device drivers in VB? Can you write a multi-threaded webserver? My bet is that if you can, it'd be an ugly ugly beast.

    53. Re:In my experience... by metamatic · · Score: 1
      Pascal (even without the object oriented extensions) remains the best language for teaching the first years in CS.

      I disagree. Modula-2 is a better Pascal than Pascal.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    54. Re:In my experience... by Pulse_Instance · · Score: 1

      the new VB.NET uses Garbage collection For clarification purposes .NET uses garbage collection and VB uses .NET, someone please correct me if I'm wrong but now it doesn't really matter if you are using VB.NET, C#.NET or C++.NET it is all the same damned thing with a different syntax. Although the syntax for VB makes my eyes bleed.
    55. Re:In my experience... by MrSteveSD · · Score: 1

      Yes you are absolutely right. They all use the CLR, which uses Garbage collection. Reference counting had some problems in that if you had objects pointing to each other (e.g. a parent and child in a tree being aware of one another) reference counting could not automatically clear them up.

    56. Re:In my experience... by arivanov · · Score: 1

      And here is where you are wrong.

      The idea that they need to know a "usefull" language within the first 2 years in university is a dreadfull misconception. They need to learn to think right and the language is nothing but a tool to help doing so. Dijkstra programming truths http://www.cs.virginia.edu/~evans/cs655/readings/e wd498.html have some good thoughts on the subject. Once a person can think right there comes a point where he/she can start using a "usefull language" in 15 minutes after reading the syntax description.

      Further to this, both Ruby and Python are strictly object oriented and with built in memory management. You cannot really use them to teach students low level memory handling, pointers, internals of a hash or the like. These simply get lost in translation, though not as fully as with Java using which for teaching should be a criminal offence. The overall result is that you close whole areas of CS to students for no good reason and frankly I stop wandering why do we have biologists writing filesystems and mathematicians writing device drivers.

      --
      Baker's Law: Misery no longer loves company. Nowadays it insists on it
      http://www.sigsegv.cx/
    57. Re:In my experience... by nule.org · · Score: 1

      I hate to comment whenever Java discussions arise, but I do a fair amount of writing stand alone Java programs. I use NetBeans which does great work for GUI building in Swing, and for the database I'll use HSQL, or Derby (that's the former IBM Cloudscape product of which you speak). Both are fantastic databases that offer real network access and that means your application can go from stand alone to networked by simply changing the JDBC URL connection string. Then to make development really move fast I use Hibernate to turn all my SQL objects into Java objects and then I don't even have to worry about writing any SQL.

      These apps are fast, attractive, stable and portable. Java gets unfairly panned about the wrong things far too often around here.

    58. Re:In my experience... by jgrahn · · Score: 1
      After all, if you know how to program, then the language with which you program doesn't matter. I would argue that if you cannot learn a new programming language for base use in, say, a week, you don't know how to program. (By base use I mean the basics - not the little tricky subtleties that every language has.)

      And you obviously don't mean the underlying concepts that make any important language unique and useful, either.

      I recognize that there are more useful skills than knowing a language, and that you shouldn't learn The One Language and then live out your career in fear that it will become a useless skill ... But I can guarantee that even with a small, elegant and extremely high-level language (say, Python) you will write significantly better programs after eighteen months than you did at twelve months.

    59. Re:In my experience... by ir · · Score: 0

      I found The C++ Programming Language to be very easy to read. And unlike other books, it actually taught you proper C++, not "C with Objects."

      --
      Irina Romanov
    60. Re:In my experience... by littlewink · · Score: 1
      ... I think the problem may be that VB is too easy to use.


      Then what do you think of HTML?
    61. Re:In my experience... by orim · · Score: 1

      Yeah, we had a professor hand us a 70-page assembly program and said - this is supposed to be a primitive compiler that can compile a language with these specs. Debug it and give me the finished version.
      Ha! That was fun! Total detective work. :)

      A lot of the work as a programmer is like that - even excellent programmers make mistakes, and the bigger the codebase, the harder it is to find the bug. Add to that the interactions on the part of the OS/framework/3-rd party code that are frequently no fault of the programmer, and you have constant debugging work on your hands. No matter how good you are.

      You have to think, even when you think you're done.

      --
      "If you could only see what I've seen with your eyes..." - Roy Batty
    62. Re:In my experience... by BritneySP2 · · Score: 1

      Yes! Let's write a device driver in HTML! Or XSLT.

    63. Re:In my experience... by BritneySP2 · · Score: 1

      How about teaching the first-semester students using the creepy (MIT) Scheme. That's what I would call "abuse".

      Imperative programming is still by far the most natural, practical - and popular (which is also important) - style of programming, and that is for a reason; teaching C.S. using exotic languages is indeed crippling the minds, which should be made illegal.)

    64. Re:In my experience... by Flodis · · Score: 1
      Naw, I've got plenty of experience, both in the corporate and open source environment. My two biggest complaints about VB are the limited support base (windows) and performance (shitty). No dynamically typed language is going to beat C++.
      I wasn't disputing your computer experience. I was just whining about your remark sounding like someone without much VB experience.... And since you apparently think VB is dynamically typed, it seems I was right. VB is COM. COM doesn't know dynamic typing. The best it can do is UNIONs... Which happen to be a C/C++-construct, but that doesn't make me want to call C dynamically typed...

      Also, like Bjarne said, you can write just about *anything* in C++. Can you write device drivers in VB? Can you write a multi-threaded webserver? My bet is that if you can, it'd be an ugly ugly beast.
      You could say the same about Java, and C++ .NET, but I don't hear you arguing that they are just prototyping languages and the code should be thrown away.

      But you do have some points - C++ is without a doubt a lot closer to the metal than VB, and no. I would not want to attempt to write a device driver in VB... However, I feel the same about writing user interfaces and reporting applications in C++. If you think C++ is good for that, then you should really give VB a try.

      As for a web-server, I think a multi-threaded web server with reasonable performance would be perfectly possible to write in VB. VB5 to be more specific. VB6 broke the possibilities for free-threading, and VB7 is .NET (memory hog and sub-stellar performance).

      By the way, did you know that VB5 used the same back-end compiler as Visual C++ 6.0? Yup... That must be where the shitty performance comes from.
    65. Re:In my experience... by Pulse_Instance · · Score: 1
      Yeah there are a couple other problems with the garbage collection in the CLR that I have found, haven't had them explained to me yet but when I've written apps that consume large amounts of memory and objects very quickly GB/minute or more, the garbage collection seems to fall apart and the application never gets rid of the memory you've used. I'm still not willing to entirely say that this wasn't a programming error but after ensuring that all references had been set to null all threads had been terminated and their references set to null amongst other things I still had the same amount of memory leaking. I had multiple peers review the application and they all agreed there was nothing more to do. There were no objects pointing to each other in the application either. Interestingly enough I was asked if there was a solution to this problem during a job interview a little while ago because they had been fighting with it for a long time too. The only solution I have ever come up with for this problem was to not use a garbage collector and use a language where you control memory allocation and deallocation.

      This wasn't really on topic at all but you mentioned the GC not working in a situation and that brought my rant to mind. Maybe someone actually does know the solution to the problem though if so I would be really interested in hearing it.

    66. Re:In my experience... by MrSteveSD · · Score: 1

      No, I was talking about a problem with reference counting. Reference Counting was the method that VB (or more correctly the underlying COM) used to manage its objects. I don't know about problems with Garbage Collection, but I have had no problems so far. You can force the CLR to collect all the garbage with a function call, and I have seen an applications memory drop accordingly. I think the method is something like "GC.Collect" but I can't remember.

    67. Re:In my experience... by Pulse_Instance · · Score: 1
      GC.Collect() is the proper method to attempt to force garbage collection in .NET, however, MSDN has something very interesting to say about that particular method.

      Use this method to attempt to reclaim all memory that is inaccessible. However, the Collect method does not guarantee that all inaccessible memory is reclaimed. All objects, regardless of how long they have been in memory, are considered for collection; however, objects that are referenced in managed code are not collected. Use this method to force the system to attempt to reclaim the maximum amount of available memory. I always get a little scared when I read language like "attempts" and "does not guarantee" in MSDN. Sorry about the previous rants, Garbage Collection is something that occasionally bothers me just a little bit.
    68. Re:In my experience... by StikyPad · · Score: 1

      CATS ARE NOT MICE!

      Oh, right.

      Well they're not that either.

    69. Re:In my experience... by aztracker1 · · Score: 1

      I have to agree, I'm honestly more of a C# guy (I have come across enough situations of JNI vs. p/invoke that it makes more sense to me), that and ASP.Net ... However, for general UI utility development, and targetting f/oss platforms, or cross platforms, Java serves a niche very well. Some will suggest python, however, I haven't really used Python at all, which some seem to love for this role..

      To each their own I guess...

      --
      Michael J. Ryan - tracker1.info
    70. Re:In my experience... by Garridan · · Score: 1

      Been a long time since I've used VB -- I think it was VB3 back then. It'll stay that way, since I'm a linux guy, but I guess it's good that the language is making some progress.

      And I do say the same thing about java, c#, and their ilk. Finally, so what if VB5 used the same back-end compiler as VC++6? When translating down to C++, there is not a 1-1 correspondance between lines of C++ and lines of VB -- otherwise, they'd be the same language. The compiler doesn't kill the performance, the extra instructions do.

    71. Re:In my experience... by Flodis · · Score: 1
      Been a long time since I've used VB -- I think it was VB3 back then. It'll stay that way, since I'm a linux guy, but I guess it's good that the language is making some progress. And I do say the same thing about java, c#, and their ilk. Finally, so what if VB5 used the same back-end compiler as VC++6? When translating down to C++, there is not a 1-1 correspondance between lines of C++ and lines of VB -- otherwise, they'd be the same language. The compiler doesn't kill the performance, the extra instructions do.
      Yeah, I started on VB3 myself, so if that's your only experience, then.. Well.. VB3 was interpreted bytecode, and didn't even have classes... Things have moved a long way since then, so if that's your only experience, then it was like 12-15 years ago, and then you really shouldn't be slamming it now.

      Re-visiting the discussion about the back-end compiler; The only extra instructions used by VB5 compared to C++ is that VB5 objects are reference counted... But if you're that particular about speed, you should use C instead of C++ to avoid vtable indirections. Or are you referring to the fact that VB5's language contains a lot of pre-packaged, optimized and ready-to use commands? I guess you're not using class libraries or SOs then either. They're also pre-packaged, optimized and ready to use. I think you're confusing it with VB3 and 4 being interpreted bytecode.

      On a different note, I can probably come up with more scathing criticism of VB than you, because I know where its ugly bits are... For example, you have to jump through hoops just to make efficient bit operations - there are no shift operators. Writing your own window procedures are a hack. Lots of stuff in core libraries weren't thread-safe, so you really had to use caution when using free threading (VB5). And VB6 broke the free threading completely... etc. Most of it has to do with not being able to get down to the metal even when you have legitimate reasons to.
    72. Re:In my experience... by Schraegstrichpunkt · · Score: 1

      I always get a little scared when I read language like "attempts" and "does not guarantee" in MSDN.

      At least now it's being documented.

    73. Re:In my experience... by tehcyder · · Score: 1

      Miaow.

      --
      To have a right to do a thing is not at all the same as to be right in doing it
    74. Re:In my experience... by EastCoastSurfer · · Score: 1

      Actually, I like VB. I believe it's good for what it's for- RAD and if properly used (as applies to any tool).

      I'm posting to /. and I agree completely. Of course I'm only talking about VB6. With VB.net, it's pretty much c# with more syntax. I still don't think there are many easier or faster ways to provide quick data entry or data views into a database than VB6.

    75. Re:In my experience... by EastCoastSurfer · · Score: 1

      Also, like Bjarne said, you can write just about *anything* in C++. Can you write device drivers in VB? Can you write a multi-threaded webserver? My bet is that if you can, it'd be an ugly ugly beast.

      Pick the right tool for the job. VB isn't the right tool for a multi-threaded web server as much as c++ isn't the right tool to build a front end, database data entry program. Sure you could do both in either language, but it wouldn't make much sense to.

    76. Re:In my experience... by nule.org · · Score: 1

      It's nice to get a friendly, informative reply instead of a flame when I post about Java for once. Thank you.

      C# is interesting, but kind of out of the question for me since I deploy many solutions on Linux, OS X and Solaris. (I know about Mono, but I don't really trust it yet.) I used to have a love affair with Python, but the more I used Java the more I became fond of having a strict, static language. Python objects also have always given me a hokey feel (passing self as an argument to methods always bugged me), but was a breath of fresh air after learning OO programming with Perl (I still have nightmares of return bless $self, $hash;). The other nice thing about Java and about the .net stuff too if I understand correctly, is the many features that make it suitable for the enterprise, like EJB3, JSF and JMS. Then I can take my (hopefully well-coded) business logic and hibernate entities, toss them behind a JSF application and there you have an enterprise-style web-app.

    77. Re:In my experience... by aevans · · Score: 0

      And laws like gravity and thermodymaics aren't Physics, they're just descriptions of practical applications of Physics. Stuff like black holes, super string theory, and unicorns should be taught at university. If you want to know how the universe works, or what formulas you need to use to build a bridge, go to some vocational school where they teach small engine repair and word perfect.

    78. Re:In my experience... by DragonWriter · · Score: 1
      It's better not to encourage the belief that one language can be good for everything.


      (1) I don't see that using Oz/Mozart to teach a year-long sequence covering programming paradigms necessarily encourages that belief to any extent not justified by reality. Further, it avoids teaching the equally misguided belief that one language = one programming paradigm. Nor does it prevent, in the course of the overall CS curriculum, forcing students to be exposed to multiple languages with different syntax, and the strengths and weaknesses of particular syntax structures in expressing particular programming paradigms.

      (2) Inasmuch as, e.g., Oz/Mozart does support declarative, imperative, functional, and OO paradigms (and concurrent programming in the context of those paradigms), why is it necessary to artificially instill the idea that one well-designed tool cannot be broadly applicable merely because most programming languages are, by either deliberate design or design failure, more narrowly focussed?
    79. Re:In my experience... by try_anything · · Score: 1

      I'm talking about brainwashing, and here you come in with truth and rationality ;-)

      It may be true about Oz (and Common Lisp, for that matter) but the sad fact is that people will believe it about C or Java or Perl or whatever language they're comfortable with, simply because it gives them an excuse not to learn another language. It's much more valuable to teach them something they won't accept without a forced demonstration (that learning new languages is feasible and often worthwhile) than to teach them something that they'll naturally believe anyway, and in fact will be much too eager to believe (that a single language can be extremely versatile.)

    80. Re:In my experience... by bobkoure · · Score: 1

      When/where did you go to school?
      I had some dealings with Bjarne in '83 or 84 (I forget which) while working at Cullinet. He was trying to get us to switch to C with cfront (pretty nearly what C++ became).
      I remember him as being a really great guy - who could put you to sleep in a meeting in about five minutes.

    81. Re:In my experience... by americangame · · Score: 1

      He came to Texas A&M University within the past few years. Someone forgot to tell him that people with his level of prestige and knowlege only teaches graduate level courses. Well, he decided he wanted to teach a freshman introductory course and of course no one is going to tell someone with his level of prestige and knowlege no to anything he wants to do.

    82. Re:In my experience... by DragonWriter · · Score: 1
      It may be true about Oz (and Common Lisp, for that matter) but the sad fact is that people will believe it about C or Java or Perl or whatever language they're comfortable with, simply because it gives them an excuse not to learn another language.


      I certainly would agree that computer science students should have a curriculum that encourages them to recognize the diversity of different approaches in language design and syntax and have some practical experience with the advantages and limitations of different approaches, and that it is therefore important for people to be exposed to many languages with different syntax (and substantially different kinds of syntax.) Oz/Mozart allows studying different paradigms in the context of one language (its largely designed for that), and I think it would be quite good as a vehicle for a survey of programming paradigms. But at the same time, I think that it would be good for a CS curriculum to expose students to languages that do things differently. Throughout the curriculum, it would be good to have people exposed, in appropriate contexts, something like Lisp, C and C++, Prolog, Smalltalk, Java, JavaScript, Python, and SQL as well as a couple varieties of assembly language (not necessarily those exact languages, but something like that range.)
    83. Re:In my experience... by socalian45678 · · Score: 1

      I agree 110%, but mainly because both languages provide an interactive environment lacking in Pascal (my first taught language) and C. TI-Basic (my first language) had one, and it enabled me to teach myself programming as a runt.

    84. Re:In my experience... by Anonymous Coward · · Score: 0

      Those funny rounding rules are actually the International Standard rounding rules. Certainly you fault Microsoft for following standards before you fault your school for teaching you the improper methodology for rounding?

      2.5 rounded is 2
      3.5 rounded is 4

      That is according to IEEE 754.4.

    85. Re:In my experience... by foxwizard · · Score: 1

      Obviously you didn't look very hard, because MS' own Visual Foxpro offers the RAD and high-level features of VB with a much better Data access and processing engine than Access has ever dreamed of. Of course, high level languages seem to be verboten today; There seems to be an elitist quality to the advocacy of C-type languages, and the failure to incorporate something like Cambridge Basic and all its derivatives into the Linux world. With these langauges and a solid foundation in Logic and Symbolic Logic, students can focus on solving the problem rather than on the mechanics of the language syntax. Those who want to advance in proramming then have the skills necessary to move to Java, C++, etc. In learning Java, I was told it was a high level language, a statement that is true only from the perspective of Assembly and C. IMHO, I can program to solve business problems and re-use code and be as eloquent as time permits; or I can focus on elegance, re-use and architecture and miss solving the business problem. And I say this, not as a flame, but as an observation wanting to be correted, the Linux world seems to eschew solving the problem in favor of elegant code. Of course, that's just another liberal arts major who became a (talented) programmer based on logical thinking speaking. FWIW.

    86. Re:In my experience... by aztracker1 · · Score: 1

      Yeah, C# and Java have a lot more alike then different... I guess I prefer MS's approach (if not their politics)... Mono is prety cool, and seems to be stable enough on linux, I haven't used it outside of linux myself. A few distros are now including some mono based utilities (Beagle, F-Spot, etc) on the default install, which is pretty nice. ASP.Net 2 support is coming along pretty nicely. Most f/oss java utilities have c#/mono counterparts now. And if you ever have to make calls to/from dll/so libraries C# is a blessing.

      My biggest issue with java is the PITA to get it working outside of Solaris and Windows... sometimes it's better than others, but keeping up with the current runtime isn't so great/easy. One down side to Mono is it doesn't have a lot of the "enterprise" features built into .Net on the microsoft side... but there are equivalent (some imho work better) options. I kind of with MS wasn't so late to the table with ajax support (atlas), still not in a full release. Anthem.Net is really nice, and I like it a lot, but the whole field will change when MS actually releases their ajax stuff (out of beta).

      Yeah, it is nice to have a discussion on .net and java without a holy crusade coming forth.

      --
      Michael J. Ryan - tracker1.info
  2. ... but doesn't remember how he did it?? by jarich · · Score: 2, Funny
    "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."

    So he doesn't remember how he created C++ huh? That explains a ~lot~!

    ;)

    1. Re:... but doesn't remember how he did it?? by EvanED · · Score: 1

      If you actually think that's true, read The Design and Evolution of C++. A very interesting account of the development of the language. If he forgets something, he can go back and read his book.

      Only problem with it is it leaves off at 1993 or so, just as the ISO process was getting to its feet.

    2. Re:... but doesn't remember how he did it?? by jarich · · Score: 2, Funny
      Only problem with it is it leaves off at 1993 or so, just as the ISO process was getting to its feet.

      Ah ha! I thought so!

      (It's humor! Come on... laugh with me!)

  3. Problems with Programming by pchan- · · Score: 5, Insightful

    I wouldn't take programming advice from a guy who overloads the bit-shift operator to perform I/O.

    1. Re:Problems with Programming by _merlin · · Score: 4, Insightful

      That's the outflow of an inherent problem with allowing operators to be overloaded. People will inevitable make them do different things on different types, making it impossible to know what an operator does without knowing something about the types of the arguments.

      Of course, there are arguments for the other side, two. One is that people will create similarly named methods on different objects that do completely different things, and ambiguous operators are no worse than ambiguous method calls. Another is that in cases where the normal operation of an operator is meaningless, it should be acceptable to overload it with different functionality.

      Overloading the bit shift operator on I/O streams is a case of the second way of thinking: a bit shift makes no sense on an object, so why not use it for something else.

    2. Re:Problems with Programming by 2short · · Score: 4, Insightful

      Why, because you've been confused by that? Because anyone has ever been confused by that ever? So you see:

      cout << "You are a bazooty head";

      and you think, obviously, that is supposed to shift the bits of the standard output stream left by "You are a bazooty head"?

      I wouldn't even call it an overloaded operator except in an overly technical sense. It's an operator that means two different things, and while that may in general be a bad idea, in this case the possible contexts for those meanings are so different, it's not anything close to a problem.

      Now I'm sure people will deluge me with examples of cryptic, intentionally obtuse code that dumps the results of shift expressions directly to streams, and thus abuses this construct to create confusion. That's not the point. In decently written code, it's not a problem.

    3. Re:Problems with Programming by compact_support · · Score: 2, Interesting

      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.

    4. Re:Problems with Programming by QuantumG · · Score: 4, Interesting

      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.
    5. Re:Problems with Programming by EvanED · · Score: 1

      There somewhat is. There's a namespace inside std that includes templated functions for ==, !=, >, >=, and = is !; == is !; etc.)

      It's not very fine-grained unfortunately; like you can't specify "I want to provide the other operators for this type but not this type" I think.

    6. Re:Problems with Programming by EvanED · · Score: 1

      Oh holy hell... stupid less than signs. You think the forum software could see that "hey, the user wrote < but didn't follow it with a legal html tag... he probably meant that < to be literal," but no, that would be too easy. Oh well, that's what the preview button's for. This is what I meant to say:

      There somewhat is. There's a namespace inside std that includes templated functions for ==, !=, >, >=, and <=. (I forget what you have to do to get it; a quick Google search doesn't come up with it, and the book that I know talks about it is in my office.) If you define operator<, it will be able to infer any that you don't provide. (>= is !<; != is < || >; == is !< && !>; etc.)

      It's not very fine-grained unfortunately; like you can't specify "I want to provide the other operators for this type but not this type" I think.

    7. Re:Problems with Programming by Tablizer · · Score: 1

      There's nothing intrinsically wrong with operator overloading as other posters have indicated.

      That is one of those holy-war philosophical issues that programmers will never agree on. Another one is static typing versus dynamic typing.

    8. Re:Problems with Programming by misleb · · Score: 2, Insightful
      Overloading the bit shift operator on I/O streams is a case of the second way of thinking: a bit shift makes no sense on an object, so why not use it for something else.


      Especially when you can make it do something intuitive (if only visually). I mean, "" looks like "I/O" to me. It looks like the are sending the item to teh right towards/into the item to the left. Makes sense to me.

      If only the rest of C++ was the intuitive. ;-)

      -matthew
      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    9. Re:Problems with Programming by epee1221 · · Score: 1
      Especially when you can make it do something intuitive (if only visually). I mean, "" looks like "I/O" to me. It looks like the are sending the item to teh right towards/into the item to the left. Makes sense to me.
      When I first looked at C++ code (only having programmed in BASIC), sure I understood what cout << "foo"; meant. I got really confused when I saw bar << 3; and found out that it didn't set bar's value to 3.
      --
      "The use-mention distinction" is not "enforced here."
    10. Re:Problems with Programming by Anonymous Coward · · Score: 0
      Some say C++ didn't go far enough, in that you can't define arbitary operators.
      That is a cool feature of other languages (such as OCaml). But C++ is hard enough to parse as-is, that I can't imagine how much harder it would become if that feature was added.

      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.
      This is even worse than the bitshift example because your operator.=(string,string) would have no corresponding operator.(string,string). The '.' operator cannot be overloaded, for good reason.
    11. Re:Problems with Programming by epine · · Score: 4, Insightful

      I've been involved in more threads than I wish to recall slinging mud at C++ and there is always a strong representation from the crowd who aren't willing to invest the time to understand the object they are criticizing. The criticism fundamentally boils down to: why should a language force me to think?

      The fact of the matter is that the conceptual challenge of writing pointer-correct code is isomorphic to other forms of resource-correctness which one must still confront in whatever saintly language one employs. When I worked with microcontrollers (fairly hefty ones), in actual practice I never lost any sleep over pointer correctness. However, I did sweat bullets over real-time response in my nested interrupt handlers. Pointers were small potatoes compared to fundamental challenges posed by the design of the hardware we employed. A few small changes to the hardware design would have saved enormous challenges in the software layer. No language would have spared me that challenge.

      Certainly overloading can be abused. Has it ever caused me a problem? Never. Excess delegation in an object-oriented framework? Nightmares.

      Another post blames C++ for having an accretion-based design process. Oh, that stings. It was an explicit design approach to gain real-world understanding of one feature before designing the next. The two areas where the C++ design process got ahead of itself were multiple inheritance and templates. The former Stroustrup has confessed was perhaps a misguided priority. The later was caused by discovering that templates were an exceptionally fertile mechanism very late in the standardization process. C++ templates evaluate at compile time as a pure functional language. What makes templates difficult is that they are too much like other languages (e.g. Haskell) that the same people go around praising.

      If one fully understands the cascade of implications of the original decision to take a relatively hard line on backwards compatibility with C, there isn't much in C++ that strikes me as "could have been vastly better". OTOH, I've come to the opinion that for someone who lacks that deep historical perspective, the overhead involved in mastering all the syntactic quirks that stemmed from that root is excessive. I don't regard C++ as a language that justifies the learning curve unless the person is suited to the kind of challenge involved in writing a real-time correct interrupt handler on a random piece of hardware that wasn't necessarily designed to make this easy.

      Just the other day I commented out a section of PHP code in website skin (a language I use irregularly) to roughly this effect:

      <!--
      <markup> ... </markup> <?php require ("somefile.php"); ?> <markup> ... </markup>
      -->

      somefile.php executed regardless and emitted an HTML comment which closed my open comment in the first line above, leaving my closing comment exposed in the rendered document. Sigh.

      At the end of the day, I find it extremely obnoxious the sentiment that some kind of pure language design can save us from this misery. There is no salvation to be found among programmers who brag mostly about thinking less.

    12. Re:Problems with Programming by QuantumG · · Score: 1

      It's 2006, we shouldn't have any trouble parsing natural language, let alone programming languages by now. There's good tools available, it's just absurd.

      --
      How we know is more important than what we know.
    13. Re:Problems with Programming by Sartak · · Score: 1

      n 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)

      Perl lets you to do this. You just overload the <=> operator and it'll figure out what to do for all the others (==, !=, <, <=, >, >=). And, of course, you can have $a < $b mean something entirely different from $b >= $a, but that'd just be zany..
    14. Re:Problems with Programming by 2short · · Score: 4, Insightful

      As a former co-worker once put it "C++ is a professionals language"; while this sounds at first like snobish looking down ones nose at other languages, it's not. If you're going to be spending much of your productive work hours over some significant chunk of your career writing code, C++ may be the language you want to do it in. If not, it's probably not.

    15. Re:Problems with Programming by misleb · · Score: 1
      When I first looked at C++ code (only having programmed in BASIC), sure I understood what cout << "foo"; meant. I got really confused when I saw bar << 3; and found out that it didn't set bar's value to 3.


      How confused were you when you found out that cout << "foo" wasn't setting the value of cout either?

      -matthew
      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    16. Re:Problems with Programming by El+Cabri · · Score: 1

      That's the outflow of an inherent problem with allowing operators to be overloaded. People will inevitable make them do different things on different types, making it impossible to know what an operator does without knowing something about the types of the arguments.


      I don't thinnk it is : the point of operator overloading is that the operators would do the same "semantic" thing on abstract type as they do on built-in types. Typical example of this would be using '+' to add complex numbers, or '*' to dereference an iterator. So yes, overloading '' for I/O is an abuse, and by the way, the "flow operator" style not only does not prove very useful in practice, but has not been replicated in any other, later, serialization, pretty-printing or I/O interface of for example Java or .NET.

    17. Re:Problems with Programming by aztracker1 · · Score: 1

      ... ...
      -->

      try ... ...
      ?>

      One of the things I am *very* happy they added with asp.net is server-side comment tagging...

      --%>

      IMHO asp.net's tagging (which is similar to cold fusion) is leaps and bounds better than php and classic asp.

      --
      Michael J. Ryan - tracker1.info
    18. Re:Problems with Programming by jcr · · Score: 3, Insightful

      The criticism fundamentally boils down to: why should a language force me to think?

      No, the fundamental criticism is: why does C++ introduce so much complexity for so little benefit? It's not like Stroustrup didn't have plenty of examples of better work at the time. He can't claim that he made his mistakes because he wasn't familiar with the literature.

      Another post blames C++ for having an accretion-based design process.

      No, I don't blame the accretion, I blame the people who allowed it to continually adopt new misfeatures to try to work around the previous mistakes.

      Oh, that stings.

      Hey, if Stroustrup suffers a little bit of "stinging" for the thousands of man-years of pain he's caused to a generation of developers, I'm not going to shed a tear for him.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    19. Re:Problems with Programming by aztracker1 · · Score: 1

      Okay, my example got mangled.. :(

      --
      Michael J. Ryan - tracker1.info
    20. Re:Problems with Programming by jcr · · Score: 1

      Damn straight. Just because of that cute little parlor-trick, a hell of a lot of newbies and third-rate professors alike got the idea that it was a good thing to do.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    21. Re:Problems with Programming by jcr · · Score: 1

      In decently written code, it's not a problem.

      In decently written code, you don't overload arithmetic operators for I/O.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    22. Re:Problems with Programming by Carewolf · · Score: 1

      The problem is natural languages are ambiguous. We really don't want ambiguous programming languages.

    23. Re:Problems with Programming by 91degrees · · Score: 1

      There somewhat is. There's a namespace inside std that includes templated functions for ==, != ...

      Useful. But surely the == operator is less efficient. C# automatically gives you a += operator when you overload + but doesn't do the same for comparisons. This would be quite simple to implement in any given language. A > B is equivalent to B
      It's not very fine-grained unfortunately; like you can't specify "I want to provide the other operators for this type but not this type" I think.

      Well, having an operator you don't need isn't going to cause any real problems and you can still override them. Although that isn't always going to behave quite how you'd like. This is my favourite gripe with C++. Templates and ovrrides have the wrong precedence. If you have a template function or operator, and you provide an explicit implementation for a certain class, C++ still uses the template for subclasses.

    24. Re:Problems with Programming by Anonymous Coward · · Score: 0
      making it impossible to know what an operator does without knowing something about the types of the arguments.


      Shit. You actually have to know something about the types you're using?

      Doesn't seem like much of an argument to me. I'd hope that everyone knew about the types they were using. Even if you get your operator right, you're going to slip up somewhere.
    25. Re:Problems with Programming by LiquidCoooled · · Score: 1

      All it takes is one dereference and automatic conversion and the datatype is not what you expected.

      --
      liqbase :: faster than paper
    26. Re:Problems with Programming by LucidBeast · · Score: 1

      I've sometimes thought about this overloading. I rarely use it, because I can't remember after a while have I overloaded stuff, but for some solutions it would be fun, but perhaps not practical to have unlimited number of overloaded operands. Maybe the notation could be somthing different like operand_name: class pseudo_string { public: ... static operator pseudo_string plus(const pseudo_string& other1,const pseudo_string& other2); assignment_operator pseudo_string equ(const pseudo_string& other1); }; then you could use it in code pseudo_string a("my"); pseudo_string b(" my what"); pseudo_string c; c equ a plus b; // c now equals to new string "my my what" this propably is subject worn out in other forums though.

    27. Re:Problems with Programming by Anonymous Coward · · Score: 2, Insightful

      You hit the nail on the head with: "The criticism fundamentally boils down to: why should a language force me to think"... the problem (and it's a doozy) with C++ is that it forces you to think about the language, not about the problem you're trying to solve. I cry when I see someone farting around with templates and eight different programming abstractions just so they don't have to use cast on a pointer, when the pointer code would have been ten times easier to understand and maintain. Examples of C++ masturbation are endless on any real-sized project, the language provides far too many different ways to accomplish basically identical tasks, and nobody can agree on one aesthetically pleasing subset to stick with. C++ turns genious programmers into incomprehensible sages of the minutia, and mediocre programmers into outright dangerous ones who cause more regressions than forward progress (this is experience programming in ~million-line C++ projects for the last 25 years talking).

    28. Re:Problems with Programming by GreatBunzinni · · Score: 2, Informative
      That's the outflow of an inherent problem with allowing operators to be overloaded. People will inevitable make them do different things on different types, making it impossible to know what an operator does without knowing something about the types of the arguments.

      You mindlessly claim that allowing people to make operators do different things on different types is a bad thing. Do you actually know what's good about supporting operator overloading? It's the ability to make operators do different things on different types. Now that's a pickle for you. Care for an example? Let's take a class that represents complex numbers. Tell me what's bad about being capable of doing something like:

      Complex c1(0,1);
      float f = 1.0f;
      Complex c2 = f*c;
      Complex c3 = f + c;
      Complex c4 = f/c;
      That piece of code is only possible thanks to operator overloading. The same applies to vectors, matrices, tensors, etc... Heck, what about those extended precision/range number classes? Where would they be if it wasn't possible to overload the basic algebraic operators?

      So it is easy to see, at least to anyone which has at least a basic grasp on C++, that operator overloading is obviously a good thing. Heck, where's the bad thing about being capable of defining operators on a data type?

      OTOH, if you have a problem about the way some coders use operator overloading (i.e., doesn't match your personal taste) then put the blame where it should be put: the coder's decisions. No one forces anyone to use, for example, a multiplication operator to concatenate strings or an addition operator to insert objects into a list. Stroustrup isn't holding a gun to that coder's head, for God's sake. Yet, to some people the use of those operators for those particular tasks is a nice thing to have.

      So please don't claim that a feature is bad or broken just because you fail to realize it's usefulness and potential.

      --
      Slashdot, fix your code or at least hire someone who is competent at it to do it for you.
    29. Re:Problems with Programming by GreatBunzinni · · Score: 1

      Indeed. And there are plenty of legitimate uses for that, too. Take tensors, for example. The tensor is a very legitimate mathematical concept with widespread use, from engineering to theoretical physics and one of it's properties is that it has two types of multiplication: the "regular" multiplication and the contracted multiplication. Another example consists of the inner and outer product from vector calculus. Due to C++s inability to define arbitrary operators it isn't possible to define both operations as operators, which ends up cluttering the source code.

      --
      Slashdot, fix your code or at least hire someone who is competent at it to do it for you.
    30. Re:Problems with Programming by dwandy · · Score: 1
      It's 2006, we shouldn't have any trouble parsing natural language
      1. In generic terms the most common problem I see is loosely defined stuff. (example: I can't stand languages that let you declare variables on the fly and don't enforce types. Maintaining and debugging this kind of sh!t is brutal and imho just pure laziness on the part of the programmers that author it.)
      2. We humans can't parse our own languages with any degree of certainty (that's why we pay lawyers so much money and still end up at war with one another)

      These two points make me very wary of any kind of "natural-language" system for general purpose computing. (I'm not saying it can't have very purpose in very narrow scopes, like dialing a phone for example).

      --
      If you think imaginary property and real property are the same, when does your house become public domain?
    31. Re:Problems with Programming by sasdrtx · · Score: 1

      Yep. And the fact of the matter is, nearly every operator in C++ has two different meanings depending on context.

      Like assembly language (or say, English), C++ provides a vast landscape for the programmer to be able to express himself in many creative ways. Unfortunately, at this time, most people employed as programmers today are not skilled or disciplined enough to write correct, readable, maintainable, and efficient programs. Java, Pascal, and VB at least keep these people from making utter monstrosities.

      Wait, I might be wrong about that.

      --
      Most people don't even think inside the box.
    32. Re:Problems with Programming by dutchd00d · · Score: 1

      I wouldn't take programming advice from a guy who doesn't know the first thing about pointer declarations in C. "int *ptr" does not mean "ptr is a pointer to an int", it means "*ptr is an int". That simple mistake leads to stupidities like writing it "int* ptr" and the subsequent confusion when "int* a, b" doesn't do what you expect.

    33. Re:Problems with Programming by quigonn · · Score: 2, Funny

      Can you bring a concrete example? In my C++ programming, I never had to cast a pointer, except for maybe a dynamic_cast or two. In my experience, the shitty and ugly code comes from programmers who learned C++ in the early 1990s and didn't have a closer look at modern C++, with features such as RTTI, exceptions, and a usable standard library including (most importantly!) a string class (I have seen so many inferior own implementations of this, it's unbelievable).

      --
      A monkey is doing the real work for me.
    34. Re:Problems with Programming by TrixX · · Score: 1

      you could give it a try to Haskell (functional) or Eiffel (imperative OO), both allow you to define more-or-less arbitrary operators (not completely arbitrary to avoid messing up parsing).

    35. Re:Problems with Programming by Anonymous Coward · · Score: 1, Interesting

      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.

    36. Re:Problems with Programming by hey! · · Score: 4, Insightful

      I wouldn't take programming advice from a guy who overloads the bit-shift operator to perform I/O.


      Well, in the real world we have these things which often seriously limitthe elegance of our designs. They're called constraints.

      In the case of C++, Stroustrup wanted to add extensions to C that would turn it into a complete object oriented programming language. With the hindsight of years of experience, some things that were then thought to be critically important turned out to be of only marginal value. Multiple inheritance for one thing. Another thing was allowing object classes to act as "first class types", which implies the need to create and overload operators. However, given the state of knowledge at the time, they were reasonable goals.

      So, Stroustrup needed to implement operator overloading. He also chose to implement C++ as a preprocessor that converted C++ into C. There were some undesirable consequences of this, but for the most part it was a good decision for the language. What he accomplished at one stroke was creating a complete and highly capable object oriented programming implementation available on a vast number of systems. The big advantage of C is that is small size made it the most portable language ever; piggybacking on it brought much of this advantage to C++, with minimal effort (another real world constraint).

      IIRC, one of the undesirable consequences of his implementation approach was that it was much more convenient to limit C++ operators to tokens that are recognized as tokens in the C compiler. This means that to allow classes to be first class types, the operators we define on those classes were "overloaded" C operators.

      From a design standpoint, this kind of "overloading" is a totally different kettle of fish from normal operator overloading. "Overloading" proper implements a kind of conceptual parallelism: floating point addition is analagous to integer addition, even though it has a totally implementation. True OO operator overloading plays the same role in expressions that polymorphism does in method calls. The C++ use of existing C operators to implement new concepts (e.g. I/O) is a pure kludge.

      This is what is known in the real world as a trade-off.

      We thought, back in 1979, that making classes first class types with their own operators was pretty important. Stroustrup needed to implement it then, but he also wanted to piggyback C++ on the existing C compiler for the reasons noted above. This trade-off satisfies both constraints at the cost of some aesthetic inelegance. Redefining the bitwise shift operator for I/O is conceptually inelegant, but it gets the job done and creates no confusion in practice. This is also a good trade-off.

      In retrospect, Stroustrup could have left certain of the features of C++ out, becuase either they have proved more problematic than they are worth (e.g., multiple inheritance) or they are not really as useful as people thought they were going to be (operator overloading). Perhaps what we really needed was more like Objective C. But C++ became the dominant systems programming language, and Objective C did not. Speaking as somebody who worked through the era of C++'s rise to dominance, this is a direct result of Stroustrup's choice of trade offs. C++ was more widely ported. And C++ was a convincingly complete implementation of nearly everything we thought was important to have in an OO language at the time.

      There is no doubt that C++ is a work of genius -- what's more a rare mix of pragmatic ane theoretical genius. If you need proof, consider that after twenty five years, C++ remains an indispensable systems programming language, if not the indispensible language. You can hardly fault Stroustrup if it is not quite what we'd come up with today.
      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    37. Re:Problems with Programming by akuzi · · Score: 1

      > As a former co-worker once put it "C++ is a professionals language"; while this sounds
      > at first like snobish looking down ones nose at other languages, it's not. If you're
      > going to be spending much of your productive work hours over some significant chunk of
      > your career writing code, C++ may be the language you want to do it in. If not, it's
      > probably not.

      Yeah that's true. and i think it applies (perhaps to a lesser extent) to Java and C# too.

      I find a lot the 'casual' programmers i know, eg. students, sysadmins, DBAs, hobbbiests and so forth who may work on scripts here or there, school projects, personal projects or whatever often have quite a different view of software development, and tend to not understand the value of the complex OO type-safe languages and frameworks. I'm not saying there's nothing to criticise, but just that i have noticed the trend.

    38. Re:Problems with Programming by Vexorian · · Score: 1

      Why? You make it sound as there was actually a reason not to do it. But I am unable to see it.

      --

      Copyright infringement is "piracy" in the same way DRM is "consumer rape"
    39. Re:Problems with Programming by rp · · Score: 1

      I must say I can't follow your argument.

      Your PHP example is a prime example of stupid language design, called for by (non-)programmers who only see the stupid way of mixing two languages (in this case, PHP and HTML): namely, mixing them arbitrarily at the source code level, instead of the analysed syntax tree level. This is a prime example of what better language design *can* fix.

      For example, the use of <?php ?> inserts might be restricted so severely that they could never break the resulting output document's validity *by design*. So better language design *would* fix your misery. I don't know about you, but I have an application here of 74 PHP scripts full of tag soup and I'd love to have a syntax checker tell me whether all 74 of them are guaranteed to spit out correct HTML at runtime no matter what inputs I call them with. Yes, indeed, that would mean I have to "think less", if by "thinking" you mean running View Source results from browsers into a HTML validator until the frequency of syntax errors approaches zero. But smartness in a language often isn't popular; most PHP (non-)programmers will reject it as "too hard" and "too restrictive" and "unnecessary". They don't what to think about it!

    40. Re:Problems with Programming by Anonymous Coward · · Score: 0
      Silly. You're shifting stuff into and out of an I/O stream.

      For WORDS, you're gonna shift bits.

      For I/O, you're gonna shift anything that can enter/exit the stream.

      What's so hard about understanding that?

    41. Re:Problems with Programming by Anonymous Coward · · Score: 0

      Yes you can - sort of. Read my article about it in CUJ: http://www.ddj.com/dept/cpp/184402076.

    42. Re:Problems with Programming by 19thNervousBreakdown · · Score: 1

      Preach on! I cry when I see a pointer cast other than what you named, the occasional dynamic_cast and very very rarely, a const_cast or reinterpret_cast. What really makes me weep my way through a bottle of Jack Daniel's though, is seeing a C-style cast. Nonononononononono no NO! Bad!

      --
      <xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
    43. Re:Problems with Programming by Sax+Maniac · · Score: 1

      I think you'll be pleased to hear that arbitrary overloading is already in the works!

      --
      I can explanate how to administrate your network. You must configurate and segmentate it, so it can computate.
    44. Re:Problems with Programming by poot_rootbeer · · Score: 1

      <!--
      <markup> ... </markup> <?php require ("somefile.php"); ?> <markup> ... </markup>
      -->
      somefile.php executed regardless and emitted an HTML comment which closed my open comment in the first line above, leaving my closing comment exposed in the rendered document. Sigh.

      As well it should have. Why should the begin-comment token in one language (HTML) prevent the execution of directives in another language (PHP)?
    45. Re:Problems with Programming by 19thNervousBreakdown · · Score: 1

      No, the type is int*. The syntax of multi-variable declarations in C and C++ is simply wrong (and stupid), and shouldn't be used. This is coming from the man himself if you've ever read The C++ Programming Language.

      From the way you described it, you would think that the variable name is *ptr, and that the declaration allocates memory for an int and that it is initialized pointing to a valid int.

      --
      <xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
    46. Re:Problems with Programming by Jesus_666 · · Score: 1

      1.) The STL could be more complete. I'm currently in the process of hacking up an std::vector to behave like an std::map because I need a non-sorting map and the STL doesn't provide one. Yes, I know about hash_map, but it's non-standard and thus hinders portability.

      2.) Everyone who uses inline PHP deserves every bit of pain the runtime inflicts on them. While the ability to use inline PHP (thus turning PHP into a useful preprocessor) is useful in certain scenarios it should only be used when you explicitly need a preprocessor and nothing else. Dynamic web pages are better done by using templates. Even a simple combination of file_get_contents() and str_replace() produces code that is much easier to maintain than the horrible mess inline PHP tends to generate.

      --
      USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
    47. Re:Problems with Programming by Anonymous+Brave+Guy · · Score: 1

      There is indeed a deep "programming philosophy" problem with the I/O streams idiom. However, it's got nothing to do with "abusing" the operator overloading. The problem is that it fundamentally ties up some data (the order of output elements) in code.

      On a superficial level, this makes stream-based code harder to maintain. This is obviously a bad thing.

      On a deeper level, it makes localisation a nightmare for those producing internationalised applications. I have worked on a few of these on varying scales, yet never seen a commercial application making serious use of all that locale-driven stuff in the standard library -- not once. However, these applications have invariably had powerful, home-grown string formatting and format customisation logic as part of their code base. In a world where huge amounts of end-user software is now distributed in multiple geographical locations and (human) languages, I view this as one of the biggest drawbacks of C++'s standard library, and an area where almost every other recent language has a better idiom.

      So, while tipping my hat to those responsible for a neat idiom, I still think that in the 21st century that idiom should die, along with the entire C++ I/O stream and locale system. Scripters prefer printf. People writing serious, industrial-scale applications often prefer much more powerful and customisable frameworks. And there just aren't that many people in the programming world between those two groups who care about strings and such.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    48. Re:Problems with Programming by Duhavid · · Score: 1

      IO is shifting bits.

      Anyway, he couldnt invent new symbols very well, so what should
      he have done?

      --
      emt 377 emt 4
    49. Re:Problems with Programming by maxwell+demon · · Score: 1

      There somewhat is. There's a namespace inside std that includes templated functions for ==, !=, >, >=, and = is !; == is !; etc.)
       
      It's not very fine-grained unfortunately; like you can't specify "I want to provide the other operators for this type but not this type" I think. You can specify it (you can even specify that you only want some of them, e.g. only operator!=). It's just not straightforward:

      namespace helper
      {
          using std::relops::operator!=;
          using std::relops::operator>; // etc.

          struct use_relops {};
      }

      class MyClass: helper::use_relops
      { // ...
      };

      Now, the templates from std::relops will be found through Koenig lookup for expressions involving MyClass instances (or instances of classes derived from MyClass), but will not be found otherwise (unless you've brought them into the current scope through another way, of course).
      --
      The Tao of math: The numbers you can count are not the real numbers.
    50. Re:Problems with Programming by maxwell+demon · · Score: 2, Insightful
      Except that for operator overloading, I've never seen any argument which cannot be used for named functions as well. Indeed, I've only ever seen one argument: Operators not doing what the operator symbol suggests are confusing. Of course they are, but that's the same with functions:

      bigint add(bigint a, bigint b)
      {
        bigint result;
      // code setting result to the product of a and b
        return result;
      }
      --
      The Tao of math: The numbers you can count are not the real numbers.
    51. Re:Problems with Programming by EvanED · · Score: 1

      Useful. But surely the == operator is less efficient.

      True, but if you need it to be more efficient than you can define it yourself. (You might have to do != too; I don't know if != is defined in terms of the C# automatically gives you a += operator when you overload + ...

      That seems backwards from the way you'd do it in C++. One idiomatic way to implement + is copy one of the arguments, += the others to the copy, then return it. The reason you do it that way instead of the other way around is because it avoids the creation of temporaries.

      Though maybe the GC of C# would make that much less of an issue...

    52. Re:Problems with Programming by binford2k · · Score: 1

      What did you expect would happen? Why would an HTML comment affect the PHP interpreter?

    53. Re:Problems with Programming by radish · · Score: 2, Interesting

      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"

    54. Re:Problems with Programming by Kupek · · Score: 3, Interesting

      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.

    55. Re:Problems with Programming by 2short · · Score: 2, Informative


      Which is why I said C++ may be the language you want; certainly there are other candidates. I'm saying I would not reccommend anyone use C++ on an irregular basis. If you're a biologist who does some coding on the side, don't use C++; and don't be surprised if it seems unsuited to your needs.

      By analogy, I'm a coder who occasionally does some welding in the garage on weekends. Professional welders would scoff at my hobbyist-level equiptment, and be insanely frustrated by its limited capabilities. But were I to use their equiptment, I would quickly reduce my project to a bubbling pile of slag, and probably set something on fire.

      I know sys-admin types, who use a lot of Perl for the myriad little bits of programming they have to do. For real software development, Perl is not an option.

    56. Re:Problems with Programming by Alioth · · Score: 1
      Since no one has posted this yet, sorry, I'll have to. I was on a major C++ project for 7 years - I enjoyed developing in C++ (yes, including operator overloading which was VERY USEFUL, and people who moan about operator overloading simply just don't get it), but I must admit this spoof always brings me a smile - and will do for anyone who's been on a large C++ project because it comes awfully close to the truth :-)

      Interviewer: Well, it's been a few years since you changed the world of software design, how does it feel, looking back?

      Stroustrup: Actually, I was thinking about those days, just before you arrived. Do you remember? Everyone was writing 'C' and, the trouble was, they were pretty damn good at it.. Universities got pretty good at teaching it, too. They were turning out competent - I stress the word 'competent' - graduates at a phenomenal rate. That's what caused the problem..

      Interviewer: Problem?

      Stroustrup: Yes, problem. Remember when everyone wrote Cobol?

      Interviewer: Of course, I did too

      Stroustrup: Well, in the beginning, these guys were like demi-gods. Their salaries were high, and they were treated like royalty..

      Interviewer: Those were the days, eh?

      Stroustrup: Right. So what happened? IBM got sick of it, and invested millions in training programmers, till they were a dime a dozen..

      Interviewer: That's why I got out. Salaries dropped within a year, to the point where being a journalist actually paid better..

      Stroustrup: Exactly. Well, the same happened with 'C' programmers..

      Interviewer: I see, but what's the point?

      Stroustrup: Well, one day, when I was sitting in my office, I thought of this little scheme, which would redress the balance a little. I thought 'I wonder what would happen, if there were a language so complicated, so difficult to learn, that nobody would ever be able to swamp the market with programmers? Actually, I got some of the ideas from X10, you know, X windows. That was such a bitch of a graphics system, that it only just ran on those Sun 3/60 things.. They had all the ingredients for what I wanted. A really ridiculously complex syntax, obscure functions, and pseudo-OO structure. Even now, nobody writes raw X-windows code. Motif is the only way to go if you want to retain your sanity..

      Interviewer: You're kidding...?

      Stroustrup: Not a bit of it. In fact, there was another problem.. Unix was written in 'C', which meant that any 'C' programmer could very easily become a systems programmer. Remember what a mainframe systems programmer used to earn?

      Interviewer: You bet I do, that's what I used to do..

      Stroustrup: OK, so this new language had to divorce itself from Unix, by hiding all the system calls that bound the two together so nicely. This would enable guys who only knew about DOS to earn a decent living too..

      Interviewer: I don't believe you said that....

      Stroustrup: Well, it's been long enough, now, and I believe most people have figured out for themselves that C++ is a waste of time but, I must say, it's taken them a lot longer than I thought it would..

      Interviewer: So how exactly did you do it?

      Stroustrup: It was only supposed to be a joke, I never thought people would take the book seriously. Anyone with half a brain can see that object-oriented programming is counter-intuitive, illogical and inefficient..

      Interviewer: What?

      Stroustrup: And as for 're-useable code' - when did you ever hear of a company re-using its code?

      Interviewer: Well, never, actually, but....

      Stroustrup: There you are then. Mind you, a few tried, in the early days. There was this Oregon company - Mentor
      Graphics, I think they were called - really caught a cold trying to rewrite everything in C++ in about '90 or '91. I felt sorry for them really, but I thought people would learn from their mistakes..

    57. Re:Problems with Programming by cbciv · · Score: 2, Insightful
      That's the outflow of an inherent problem with allowing operators to be overloaded. People will inevitable make them do different things on different types, making it impossible to know what an operator does without knowing something about the types of the arguments.

      Bad programmers will fuck up in any language. Pruning features from a language won't stop this. It will only hamstring good programmers.

    58. Re:Problems with Programming by radish · · Score: 2, Informative

      Completely agree, on rereading I realise I misunderstood the last line of your post as implying that if you don't want to use C++ you're not a professional. Mea culpa :)

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

    59. Re:Problems with Programming by hey! · · Score: 3, Interesting

      I'm curious why you think multiple inheritence in C++ is more trouble than it's worth.


      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.


      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.


      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.
    60. Re:Problems with Programming by epee1221 · · Score: 1
      How confused were you when you found out that cout << "foo" wasn't setting the value of cout either?
      My attempted interpretation of bar << foo; was something like, "put foo into bar." Putting something into cout would mean printing it; putting something into a variable would be a value assignment.
      --
      "The use-mention distinction" is not "enforced here."
    61. Re:Problems with Programming by tchuladdiass · · Score: 1

      As far as parsing user defined operators, the way I'm planning on solving it once I add it to my language (lang2e.sourceforge.net) is to have a patern match operator, such as "&numB", where num is replaced by a numeric value, "B" means it is a binary operator (others would be H or T for prefix / postfix unary operators). Then you define an alias at the top of your code, possibly using a preprossor directive. So the C++ equiv for the previous post's example would be "#define .= &1B", so every instance of .= is replaced by &1B before going to the parser. The parser then knows that the pattern &numB is a binary operator, with a user defined handler.
      Of course, I've got a little ways to go on my interpreter before I can get to this stage (i.e., I need to introduce structures and object tags first, but that is a job for next week). Also, need to work on this format a bit, so that it can represent precedence (unless I deside to always assume highest or lowest precedence).

    62. Re:Problems with Programming by mrsbrisby · · Score: 1
      At the end of the day, I find it extremely obnoxious the sentiment that some kind of pure language design can save us from this misery. There is no salvation to be found among programmers who brag mostly about thinking less.
      Almost every LISP programmer has heard the suggestion of a "lisp without parenthesis", and shrugged it off as if the problem with LISP-acceptance were the parenthesis! The parenthesis never bothered me! I %-bounce all through my LISP programs! Why if I didn't have parenthesis....

      I remember looking at a mess of C++, bouncing with etags through a bunch of files, and we had two recursive routines; but one was const. The problem was that the compiler decided the const-one wasn't recursive, and generated to error as a result. The non-const one worked under some assumptions that simply were wrong. All the while cursing this !@#$@#$ of overloading, as well as the coding of the person who wrote the original file.

      The reality is that the original programmer was new to C++, and while you can say that nobody ever really gets tripped up by operator/function overloading, people still do. LISP has its macros, and Perl has its line noise- every language has that feature that some demand is necessary, and others cry foul to.

      So when we write C++, we avoid overloading- and mark up code heavily where overloading occurs (and surprise may lurk!). If overloading didn't exist, our lives would be easier because you wouldn't be able to use it either. It would never show up in foreign code on our doorstep and we would never have to track down bugs in it.

      See, having all of these different capabilities in C++ (even the weird ones) means that anyone who needs to know C++ needs to know all of it. After all, we might have to look at someone elses code one day, and we need to know how all of its internals work. Especially the weird bits. And because C++ is a moving target (with no conforming compilers), it's hard to know C++. When I first was exposed to C++ in 1994, namespaces didn't exist in any compiler yet, and templates worked a little bit differently (in the available compilers)- so I not only have to know the C++ as specified, but how GNU C++ works, and how Turbo C++ works, and now Visual C++ works, and how each and every version of them worked, bugwise.

      I think in that light it should be much easier to see why lots of people have come to the conclusion that C++'s "goodness" comes simply from the large number of people who can list it on their resume.

      But like Windows, nobody really knows it as well as they'd like to think, and only its greatest appologists can pretend it hasn't caused more problems than its solved.
    63. Re:Problems with Programming by nuzak · · Score: 1

      Scala also lets you define arbitrary infix operators. In fact any method that takes two args can be used infix. It just has to be a legal method name (so it probably won't be punctuation characters).

      Haskell requires you to start your own infix operators with a : for no apparent reason I can understand. You can always use the backtick operator to make any binary method infix though.

      How's it work in Eiffel?

      --
      Done with slashdot, done with nerds, getting a life.
    64. Re:Problems with Programming by Anonymous Coward · · Score: 0

      > I'm curious why you think multiple inheritence in C++ is more trouble than it's worth.

      I'd say it's mostly the implementation that's the problem, namely that the value of this will be different depending on which base class you point at. Also known as the "this this is not that this" problem. We end up with ridiculous run-time casting like COM's IUnknown because of this infuriating behavior.

    65. Re:Problems with Programming by Anonymous Coward · · Score: 0

      Google for "Syntactic Aspartame" for an article which appeared in the last issue of the C/C++ Users Journal, which covers exactly this subject. With this, you can write

      Vector c = a cross b;
      double d = a dot b;

      and it will even compile.

    66. Re:Problems with Programming by misleb · · Score: 1
      My attempted interpretation of bar << foo; was something like, "put foo into bar." Putting something into cout would mean printing it; putting something into a variable would be a value assignment.


      Well, that would seem strange since = is the obvious choice of a assignment. Anyway, I would chalk your misunderstanding up to lack of experience with more advanced programming languages at the time. I still think using << for both bitshift and I/O is reasonable and intuitive. Just because something is intuitive doesn't mean that it is necessarily obvious to just anyone.

      -matthew
      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    67. Re:Problems with Programming by DulcetTone · · Score: 1

      I always expressed this as, "C++ is a gutter language"

      --
      tone
    68. Re:Problems with Programming by 2short · · Score: 1

      "In decently written code, you don't overload arithmetic operators for I/O" In a persuasive argument, you don't just blindly re-assert the point someone has just refuted.

    69. Re:Problems with Programming by julesh · · Score: 1

      What's wrong with a C-style cast? Simply consider it a shorthand notation for a const_cast or reinterpret_cast, depending on situation.

      Frankly, there's no better way of truncating the result of a floating point operation than x = (int) (f / 2.3);. and "reinterpret_cast" is just too verbose when what you really want is bits = *(int *).

    70. Re:Problems with Programming by 2short · · Score: 1

      "this is experience programming in ~million-line C++ projects for the last 25 years talking"

      You wrote a million line C++ project two years before Stroustrup claims to have invented the language, eh? You should sue that guy for taking all the credit; but I guess if you admitted inventing C++, it would be harder to criticize. Best lay low, and level vauge critiques of programmers that could apply equally well to any language.

    71. Re:Problems with Programming by julesh · · Score: 1

      The difference is that with a limited set of operator symbols to choose from, it's very tempting to use one that bares little resemblance to what your operator actually does. There are substantially more plausible function names, so the temptation to use one that is inappropriate is smaller.

    72. Re:Problems with Programming by 2short · · Score: 2, Insightful

      Well, quite a few of us see the benefit (and frankly don't think it's all that complex). If you don't, don't use it; nobody is holding a gun to your head. Nobody is holding a gun to the head of the many, many programmers who do choose C++. C++ is a wildly popular language; if you can't figure out the reason why, that doesn't mean there isn't one.

    73. Re:Problems with Programming by 2short · · Score: 1

      Which is an unrelated sentiment that we could also discuss, if you bothered to explain what you meant by it.

    74. Re:Problems with Programming by TrixX · · Score: 1
      Some extracts from class INTEGER (yes, INTEGERs are objects):

      prefix "+": like Current
      -- Unary plus of `Current'.
      prefix "-": like Current
      -- Unary minus of `Current'.
      infix "/" (other: like Current): REAL
      -- Division by `other'.
      infix "//" (other: like Current): like Current
      -- Quotient of the euclidian division of `Current' by `other'.
      -- The corresponding remainder is given by infix "\\".
      --
      -- See also infix "#//".
      Essentially you can use as an operator name any of the predefined operator names (usual arithmetic, comparison, and, or, not), and some custom names which are any sequence of "operator symbols" (most non-blank non-alphanumeric symbols ) which is nont predefined: you cann not define "--" which starts a comment, nor "=" which has a default meaning. But you can use ">>" "===" , "||", "&|@@#~+^".
    75. Re:Problems with Programming by BritneySP2 · · Score: 1

      If math, for example, stuck with the natural language, we'd still be in the ancient Egypt era (as far as math is concerned). It turned out, it was the abstract (algebraic) notation that was the key, at some point. This may be just as important in programming.

    76. Re:Problems with Programming by Listen+Up · · Score: 1

      I misinterpreted what he was saying too. I spend %100 of my time developing in Java and just recently was tasked with a project developing in C#. The outright benefits of using these languages over C++ is staggering and development is a complete joy compared to C++. Nothing against C++ personally, but I would round the 'professional languages' into Java, C++, and C#.

    77. Re:Problems with Programming by QuantumG · · Score: 1

      Are you trying to suggest that mathematical notation is unambiguous to parse in the same sense as programming languages? If you are, I hate to be the one to tell you, but you're wrong. Imagine if mathematical notation had been restricted to simple LALR grammars like most programming languages today are.. sure, we'd be able to more easily parse mathematics, but what would restrictions like that do to mathematicians? Ask any mathematician and they will tell you how hard it is to maintain a productive flow of conciousness.. adding more restrictions could only harm that. I wonder what harm these arbitary restrictions we've placed on programming languages have done to programmers.

      --
      How we know is more important than what we know.
    78. Re:Problems with Programming by BritneySP2 · · Score: 1

      No. I am just saying that often "less natural" means "more successful". Natural languages were designed by, well, ancient people (to put it politically correctly), so they are not necessarily suited for today's practices.

      And, I do not see any problem making mathematical notation non-ambiguous. This is what the mathematical logic, as the foundation of mathematics, has essentially achieved (incidentally, by switching from the use of the natural language to using formalized notation. Therefore, I see no point in going back to natural languages (unless, maybe, you want to teach programming those who lack the ability to use symbolic notation - which, I am afraid, would do no good to them, to you, or to programming).

    79. Re:Problems with Programming by QuantumG · · Score: 1

      Yeah, I don't think we're talking about the same thing. I'm saying that the completely restrictions placed on the grammars of programming languages by the so called "fast" parsing algorithms keep getting in the way of making language constructs that are perfectly reasonable. General parsing algorithms are available and run just as fast as the so called fast parsing algorithms for these reasonable grammars, but they are harder to implement, and less well understood, so language designers avoid constructs that require them. This makes for languages that are unreasonably restrictive.

      --
      How we know is more important than what we know.
    80. Re:Problems with Programming by pclminion · · Score: 1

      So, your argument is that operator overloading is helpful because of... math, math, math, math, and math? Your examples are cute and all, but why do they justify giving the programmer such ridiculous arbitrary control over what should be very well-defined programming constructs?

      Whoever came up with the idea of using > as IO operators on stream objects is insane. What's wrong with saying:

      cout.write("Hello, there are ").write(7).write(" days in a week");

      Oh right, it doesn't look cute enough.

    81. Re:Problems with Programming by 2short · · Score: 1

      What's a non-sorting map? I once wrote a VectorMap template that let me insert things with automatic sorting like a map, but then iterate across them with the efficiency of a vector, but I don't see what a map is without sorting. Just curious; I don't disagree with your general point; it would be nice to have something more complete than STL.

      Boost is a candidate, but whether you can find what you need in there and understand it faster than you can write it yourself...

    82. Re:Problems with Programming by Dan+D. · · Score: 1

      Don't forget the Boost libraries! Its so fancy, its like programming java (but I'm too blue collar for that :)

      --
      People who quote themselves bug the crap out of me -- Me.
    83. Re:Problems with Programming by Jesus_666 · · Score: 1

      A non-sorting map is an associative array that leaves the entries in the order in which they were inserted, akin to a vector<pair<K, V> > or a PHP array (the difference to a vanilla map only becomes evident when iterating over it). In fact, my implementation is a subclass of vector<pair<K, V> > that performs uniqueness checks and entry location for the [] operator by iterating over the whole thing, performance be damned.

      By the way, there's another sorely needed feature: More legible STL error messages. It's a bit ridiculous when the source in question occupies 1.5 KiB and the error messages generated because of one typo build up to more than two kilobytes (and subsequently take minutes to decypher). Also, template errors have the nasty habit of appearing out of order, which complicates debugging further.


      As for Boost: I have considered using it, but my project is already dependent on two different build toolchains (CMake because I use it and the autotools because I use libintl); I don't want to add a third one (Boost Jam, neccessary to build Boost) unless it's really neccessary.
      There were other options, such as Google's sparse_hash_map, but I wanted something that behaved as much as a vanilla map as possible.

      --
      USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
    84. Re:Problems with Programming by scotch · · Score: 1
      Consider that casts should be avoided, and when you need them, you should be careful and clear. If you don't know why, I probably can't help you, but consider these two issues:

      1. clarity
      2. grep-ability

      --
      XML causes global warming.
    85. Re:Problems with Programming by Anonymous Coward · · Score: 0
      Frankly, there's no better way of truncating the result of a floating point operation than x = (int) (f / 2.3);

      Try int(f / 2.3) - shorter syntax, no cast.

      and "reinterpret_cast" is just too verbose when what you really want is bits = *(int *).

      These are the dangerous casts and you should keep these buried in some library layer. You really want to do these hardly ever.

    86. Re:Problems with Programming by CKW · · Score: 1

      > "Stroustrup isn't holding a gun to that coder's head, for God's sake."

      No, he's handing the loaded gun to the guy that wrote the code before me, and to the other team-members I have to work with on the product.

      What's that? You work all by yourself in a tiny white box? You're going to work in that box by yourself forever? You never ever have to look at anyone else's code? No one else in the world will ever have to look at your code? (Especially not a junior coder?)

      Yeah right. There's an age old engineering principle - if your code is so fancy that only a blooming genius will understand it...

    87. Re:Problems with Programming by julesh · · Score: 1

      You have a point... most of my work goes into writing that kind of library. :)

    88. Re:Problems with Programming by GreatBunzinni · · Score: 1
      So, your argument is that operator overloading is helpful because of... math, math, math, math, and math?

      ...which comes in handy because, whether you like it or not, whenever someone writes code that person is applying mathematical concepts, whether the coder is aware of that or not.

      Your examples are cute and all, but why do they justify giving the programmer such ridiculous arbitrary control over what should be very well-defined programming constructs?

      I wasn't aware that enabling the programmer to write code as he sees fit is somekind of a downside. Tell me, what exactly is wrong about having the freedom to use whatever tool we believe better expresses our ideas?

      Whoever came up with the idea of using > as IO operators on stream objects is insane. What's wrong with saying:

      cout.write("Hello, there are ").write(7).write(" days in a week");

      Oh right, it doesn't look cute enough.

      It isn't a matter of "looking cute" but a way to enable coders to make their code easily readable, unlike that garbled "uncute" mess you just posted there. Let's compare the following:

      cout.write("Hello, there are ").write(7).write(" days in a week");

      cout << "Hello, there are" << 7 << " days in a week";
      What piece of code is easier to read? Not sure? What about this piece of code:

      cout += "Hello, there are" + 7 + " days in a week";
      This one is also easier to read, easier to write and doesn't use the So, as it is easy to see, operator overloading is a very useful tool to have. The only downside was that C++ doesn't went far enough with it.
      --
      Slashdot, fix your code or at least hire someone who is competent at it to do it for you.
    89. Re:Problems with Programming by pclminion · · Score: 1

      Nice troll.

      ...which comes in handy because, whether you like it or not, whenever someone writes code that person is applying mathematical concepts, whether the coder is aware of that or not.

      Programming in general is mathematical, sure. That doesn't mean we need to usurp the meaning of mathematical operators to express algorithmic concepts that could easily be expressed WITHOUT diluting the meaning of the operators. I consider the math-based examples acceptable because they do NOT dilute the meaning of the operator -- addition of vectors is analogous to addition of reals, for instance.

      But how about using '+' for string concatenation? One of the basic properties of addition is that it is commutative. Therefore, string("Hello") + string("World") should give the same result as string("World") + string("Hello"). But it doesn't. The addition operator has been perverted.

      I wasn't aware that enabling the programmer to write code as he sees fit is somekind of a downside. Tell me, what exactly is wrong about having the freedom to use whatever tool we believe better expresses our ideas?

      Because most programmers suck and shouldn't be allowed to play with power tools. Writing code however you feel like it is fine until somebody else has to deal with it. In the real world, programmers should be as restricted as possible in what they do and how they do it.

      What piece of code is easier to read? Not sure?

      One piece of code is more verbose. That's all.

      And look at your silly example to work around my objection to left-shift IO operators:

      cout += "Hello, there are" + 7 + " days in a week";

      This piece of garbage just shows that you have no idea how the language works. You can't override operators for basic types. The above piece of code doesn't work, and never could be made to work.

    90. Re:Problems with Programming by scotch · · Score: 1

      Well he did give an example of an iterator, which is not math. And generic programming (yes, with math types and iterator types) would be pain in the ass without operator overloading. I don't see how operator overloading as a concept could bother any professional c++ developer for more than about 1 day. Seriously, it's just not that big of a deal. Sure, it's abuse, but what isn't. What's your story? Did operator overloading molest you as a child?

      --
      XML causes global warming.
    91. Re:Problems with Programming by GreatBunzinni · · Score: 1

      Nice troll.

      Just because what I said goes against your obstructed notion of reality it doesn't mean it is a troll.

      I do not know how the use of operators "diludes" the meaning of the operators. A mathematical operator is a symbol which represents a mathematical operation. If the operator is used to represent a type of operation which is equivalent to the "default" operator behaviour then obviously only good can arise from that. Where's the problem with that?

      But how about using '+' for string concatenation? One of the basic properties of addition is that it is commutative. Therefore, string("Hello") + string("World") should give the same result as string("World") + string("Hello"). But it doesn't. The addition operator has been perverted.

      Well, now you are being silly. Or at least demonstrating that you do not understand the basic concept of what an operator is. You see, in that statement you are mixing up the notion of a binary operator (which is what C++ supports) with the notion of a commutative operator, which is an operator which was designed to hold the commutative property. Probably your notion of what an operator really is was clouded by a very limited math knowledge which doesn't go beyond highschool algebra, if it goes at all that far. After all, that idea can only persist in someone's mind if that person never dealt with operators associated with any set other than the real numbers set. You see, the operator represented by the "+" character isn't always a commutative operator. For example, one of the legitimate math uses for an operator which is represented by the "+" character is topology's path concatenation operator. That operator isn't commutative and, funny enough, it is an operation which is pretty much equivalent to the string concatenation operation.

      Because most programmers suck and shouldn't be allowed to play with power tools. Writing code however you feel like it is fine until somebody else has to deal with it. In the real world, programmers should be as restricted as possible in what they do and how they do it.

      Oh now I see. "Programmers should be handed very narrowing, limited tools because if they aren't, they may write code which I'm not able to understand." Guess what. The world doesn't revolve around you. Just because you can't get around reading other people's code it doesn't mean that everyone should be stripped of every useful tool due to your inability to understand their use. You are the one who must get up to speed, not slow down everyone around you in order for things to become manageable by you.

      What piece of code is easier to read? Not sure?

      One piece of code is more verbose. That's all.

      One piece of code (i.e., your example code) is needlessly cluttered, clutter which is eliminated by the use of operators. And whether you like it or not, the C++ world is packed with code which, if it wasn't for operator overloading, it would be needlessly harder to read, write, understand and debug. But just because you have a hard time following simple concepts like operator overloading no one should use that. Right.

      And look at your silly example to work around my objection to left-shift IO operators:

      cout += "Hello, there are" + 7 + " days in a week";

      This piece of garbage just shows that you have no idea how the language works. You can't override operators for basic types. The above piece of code doesn't work, and never could be made to work.

      Nice strawman but I'll bite.

      Quite the contrary. Your pathetic attempt of a personal attack just went to, once again, demonstrate your limited understanding of the C++ language and also your limited capability to follow a simple, direct train of thought. You see, that example was

      --
      Slashdot, fix your code or at least hire someone who is competent at it to do it for you.
    92. Re:Problems with Programming by CKW · · Score: 1

      > When I worked with microcontrollers (fairly hefty ones), in actual practice I never lost any sleep over pointer correctness. However, I did sweat bullets over real-time response in my nested interrupt handlers.

      So, because something else 10 times closer to the hardware is hard and required tons of "sweating bullets" - there's no reason what-so-ever to use Software Engineering principles to eliminate "bullet dodging" in anything else. Anyone who wants to reduce the "sweating bullets" and "bullet dodging" is therefore a whiny baby?

      > There is no salvation to be found among programmers who brag mostly about thinking less.

      We don't want to think less, we want fewer bullets flying by our heads so we can spend more time thinking hard about other things.

    93. Re:Problems with Programming by scotch · · Score: 1
      cout += "Hello, there are" + 7 + " days in a week"; This piece of garbage just shows that you have no idea how the language works. You can't override operators for basic types. The above piece of code doesn't work, and never could be made to work.

      LOL, if I show you how it can be made to work, will you publicly announce to all of slashdot that are preposterous little person who never lets his ignorance get in the way of his strong and unwavering opinions? Maybe a simple retraction that you don't know what the fuck you are talking about WRT C++?

      --
      XML causes global warming.
    94. Re:Problems with Programming by jcr · · Score: 1


      The problem is in using the same operator for semantically different operations. This is not like using "+" for both integer and floating-point addition. Stroustrup's example of using the left-shift for I/O was nothing more than a parlor trick, and it led a generation of C++ victims into some very bad habits.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    95. Re:Problems with Programming by jcr · · Score: 1

      If you don't, don't use it; nobody is holding a gun to your head.

      I don't use it. Is that a reason why I should refrain from criticising it? I don't smoke cigarettes either, should I avoid discussing their health implications when the subject arises?

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    96. Re:Problems with Programming by ozone_sniffer · · Score: 1

      Hey, if Stroustrup suffers a little bit of "stinging" for the thousands of man-years of pain he's caused to a generation of developers, I'm not going to shed a tear for him. Oh, you refer to the developers which did not program in C++? I guess they must have been in great pain ...
    97. Re:Problems with Programming by pclminion · · Score: 1

      Yeah, I would. I'm safe, because the code can't be made to work. You cannot redefine an operator on basic types. "Hello, there are" + 7 just adds 7 to the pointer to "Hello, there are", yielding a pointer to "there are". Then this pointer is added to... another pointer? Nope, sorry. It can't work.

    98. Re:Problems with Programming by scotch · · Score: 1
      You are of course right, my humblest apologies.

      --
      XML causes global warming.
    99. Re:Problems with Programming by user2048 · · Score: 1

      > cout << "You are a bazooty head";

      A better example of the problem is

        current << size;

      In that context, is << a shift operation or an output operation? You can't tell.

    100. Re:Problems with Programming by pclminion · · Score: 1

      And now, just because you decided to say something stupid like "The above piece of code doesn't work, and never could be made to work", I'll leave you with this little teaser: isn't it possible to write a class which implements both the "+=" and "+" operators? Isn't it possible to write that class so that their objects handle writing to the standard output? And finally, what stops anyone from using "cout" as the identifier of an object of that particular class?

      Get back to me when you figure out how to get past the part where "Hello, there are" + 7 actually does the right thing. You'll never make it work. Remember that += is lower precedence than +, so "Hello, there are" + 7 is the first subexpression which will be evaluated. Notice that this subexpression is composed SOLELY of basic types in the language (pointer to char, and int). You cannot overload an operator which takes only built-in types.

      Yes, the += and + operators can be overloaded, but they can never be overloaded in a way to allow the sort of statement you wrote. I understand C++ just fine.

  4. The biggest problem is choosing the right language by Anonymous Coward · · Score: 0

    It's important to choose one that is elegant and easy to work with on a day to day basis. C++ would probably be a bad choice. Lisp, however...

  5. Code Structure vs. Function by Salvance · · Score: 5, Insightful
    Bjarne says:
    Think of the Mars Rovers, Google, and the Human Genome Project. That's quality software
    but then goes on to say:
    On the other hand, looking at "average" pieces of code can make me cry. The structure is appalling, and the programmers clearly didn't think deeply about correctness, algorithms, data structures, or maintainability
    I doubt he has seen the code to the Mars Rovers, Google, or many other applications that he/we consider quality. He's judging it based on the software's function. If we were to judge software purely on how it worked, quite a bit of software could be considered quality. But if you were to look at the same software's code, you'd probably "cry" like Bjarne. Look at Firefox. That is a Quality application, but programmers I've spoken to said the code is a mess.
    --
    Crack - Free with every butt and set of boobs
    1. Re:Code Structure vs. Function by Anonymous Coward · · Score: 0

      You must not be using the same browser I am.

      I love firefox and all, but I wouldn't give it the capital Q. When all factors are considered, it may be better than the other options, but that doesn't mean it doesn't suck. Have you ever looked into how history is stored? Ever seen it eat memory like a hog? Ever notice how so many of the rendering bugs have been open for half a decade, and are always depending on some change that will happen anydaynow?

    2. Re:Code Structure vs. Function by jZnat · · Score: 1
      Look at Firefox. That is a Quality application, but programmers I've spoken to said the code is a mess.

      nsCOMPtr<pr_bool>(No) nsIt(s) NS_NOT
      --
      'Yes, firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
    3. Re:Code Structure vs. Function by RAMMS+EIN · · Score: 1

      ``Look at Firefox. That is a Quality application, but programmers I've spoken to said the code is a mess.''

      I think many people won't agree that it's a Quality application. I, for one, have been saying for years that it was bloated and the code was horrible, and I think that's finally showing in instabilities and memory leaks. Write code badly, and, eventually, quality _will_ suffer.

      --
      Please correct me if I got my facts wrong.
    4. Re:Code Structure vs. Function by vtcodger · · Score: 1

      The Mars Rovers turn out not to be bug free either.. Despite 'quality' programming and surely a lot of testing, their software has bugs. See this Risks Digest article. If their interrupt problems had taken out the communications link permananetly or they had not, largely by luck apparently, left tools on board that allowed them to debug and fix the problem on the fly, or they'd made the wrong itsy-bitsy mistake patching code over a 90 million mile data link. the software folks would have been bums, not heros.

      --
      You can't see ANYTHING from a car, You've got to get out of the goddamned contraption and walk...Edward Abbey
    5. Re:Code Structure vs. Function by Otter · · Score: 1

      And I don't think anyone involved with the Human Genome Project would say their software (at least at the time of the big race to "complete") was anything near "quality". There were some brilliant individual hacks but the overall pipeline was slapped together in a panicked rush.

    6. Re:Code Structure vs. Function by Anonymous Coward · · Score: 0

      Wait... what?

    7. Re:Code Structure vs. Function by august+sun · · Score: 1
      Indeed, I've worked for companies that provided some critical services (E911 for example) and our codebase was horrific. During my interview for the position one of the devs flat out said that it was 'unconscionable' that people's lives were relying on our work (he had only been at the company for a handful of months so I guess that absolves him of blame).

      Then a few months later I was talking to my old thesis advisor, just shooting the shit when I recounted this episode to him.

      His response?

      Yeah, I looked at some Airbus code once and that put me off flying for almost six months.
    8. Re:Code Structure vs. Function by marklandm · · Score: 1

      Having attended Stroustrup's seminar at SD West 2006, seeing his slides and what he has been doing, I would say that he probably has seen the code to the Mars Rovers, Google, and the Human Genome Project. He spends a lot of time looking at how real people use C++ to try and figure out how to make the language better, and how to teach/use the language better.

    9. Re:Code Structure vs. Function by Shadowlore · · Score: 1

      I doubt he has seen the code to the Mars Rovers, Google, or many other applications that he/we consider quality. He's judging it based on the software's function.

      Why doubt it? Why not *gasp* research it? Indications are he has in fact seen (some of) the code. Given his position in the field, and his position in the research field, it is not unlikely that he has consulted with JPL or Google, or especially the HGP. His connections and links run deep and wide.

      --
      My Suburban burns less gasoline than your Prius.
    10. Re:Code Structure vs. Function by julesh · · Score: 1

      Look at Firefox. That is a Quality application, but programmers I've spoken to said the code is a mess.

      I'm looking at an application that uses somewhere over five times as much memory to achieve not a lot more than similar applications have done with the same constraints. I'm looking at an application that occasionally freezes after prolonged use. I'm looking at an application which a few weeks ago started refusing to die when I closed its windows, and popping up a message saying that a script wasn't responding after a couple of minute's delay, forcing me to reinstall to remove whatever error had caused the issue.

      I'm looking at an application that has 5-year old bugs reported yet still unfixed in its bug tracking database.

      And you call this quality software?

  6. Ridiculous. by sammy+baby · · Score: 5, Funny
    Stroustrup:
    On the other hand, looking at "average" pieces of code can make me cry. The structure is appalling, and the programmers clearly didn't think deeply about correctness, algorithms, data structures, or maintainability. Most people don't actually read code; they just see Internet Explorer "freeze."


    Now that is just ridiculous. I'm using IE7 to post this article, and have been using it since its release, and I can say
    1. Re:Ridiculous. by Anonymous Coward · · Score: 0

      "How did he submit his post?" "Maybe he was dictating."

    2. Re:Ridiculous. by grammar+fascist · · Score: 4, Funny
      Now that is just ridiculous. I'm using IE7 to post this article, and have been using it since its release, and I can say

      You can say that it's magical, because it managed to post for you just before it crashed. Though that's pretty nifty, I've seen Firefox tack on a "NO CARRIER" before. Maybe you should submit a feature request.
      --
      I got my Linux laptop at System76.
    3. Re:Ridiculous. by sillybilly · · Score: 1

      How to explain a joke... it always makes it funnier.

    4. Re:Ridiculous. by Anonymous Coward · · Score: 0

      Actually, the "NO CARRIER" comes from the modem that finishes the message for you, and then issues a HTTP POST to the web server. A quality modem will even OCR the captcha image for you. (Obviously, we're talking about the modem at the ISP end, since your own has already lost the connection at this point.)

    5. Re:Ridiculous. by Paradise+Pete · · Score: 1
      "Maybe he was dictating."

      Oh, shut up.

    6. Re:Ridiculous. by Jesus_666 · · Score: 1

      You can say that it's magical, because it managed to post for you just before it crashed. Though that's pretty nifty, I've seen Firefox tack on a "NO CARRIER" before. Maybe you should submit a feature request.

      Huh? My Firefox doesn't NO CARRIER

      --
      USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
    7. Re:Ridiculous. by scipero · · Score: 1

      The grail is hidden in the castle Aaaghhh...

      Prior art!

  7. Only my second favorite by jgannon · · Score: 4, Funny

    This is only my second favorite Stroustrup interview. The first is here: http://www.chunder.com/text/ididit.html (Yes, I know it's a hoax.)

    1. Re:Only my second favorite by atomic-penguin · · Score: 1

      It's both amusing and insightful.

      --
      /^([Ss]ame [Bb]at (time, |channel.)){2}$/
    2. Re:Only my second favorite by nwbvt · · Score: 1

      Someone brought a copy of that in when I was taking "Intro to Computer Science" in high school. We had a good laugh, and from then on just blamed Stroustrup whenever something went wrong with our program.

      --
      Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
    3. Re:Only my second favorite by kraut · · Score: 1

      Not as funny as his paper on overloading whitespace: Generalizing Overloading for C++2000 ;)

      --
      no taxation without representation!
  8. Which university is that? by Anonymous Coward · · Score: 1, Funny

    Which university is it that teaches Visual Basic? Please let us know the name and location of this university, so we can avoid hiring employees who studied there.

    1. Re:Which university is that? by wizzat · · Score: 1

      You think its funny, but I bet he was serious.. I know my boss might have the same question. ;-)

    2. Re:Which university is that? by rucs_hack · · Score: 2, Informative

      mine teaches java prediminantly, and I've had to tutor third year students who seem to lack more then rudimentary programming skills.

      The logic they go by seems to be 'Download a class for it, no need to code it yourself'. It drives me crazy.

    3. Re:Which university is that? by Anonymous Coward · · Score: 0, Funny

      God damn, they obviously don't teach English.

    4. Re:Which university is that? by ioslipstream · · Score: 1
      "The logic they go by seems to be 'Download a class for it, no need to code it yourself'."


      Isn't that kind of the purpose of Java, one way to do it, don't reinvent the wheel?
    5. Re:Which university is that? by rucs_hack · · Score: 4, Insightful

      yes, for Rapid Application Development. However that is *not* the point of studying computer programming.

      While a good coder knows when to re-use code. A coder incapable of originating complex code is little more then an automaton.

      I'm sick of the 'don't re-invent the wheel' argument being dragged out and used to justify people not studying properly, or for that matter, not teaching properly. I was lucky, I attended a course where most lecturers believed that students should code their own assignments.

      Examples being recursive functions, sorting functions, Dijkstra's shortest path algorithm, stuff like that. However I have recently had to cope with people being given exactly the same type of assignment, and being allowed to download pre-built classes for them! What, I ask you, is the point of that?

    6. Re:Which university is that? by Mark_Uplanguage · · Score: 2, Interesting

      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
    7. Re:Which university is that? by Vexorian · · Score: 1

      In my bolivian University they start with Java as well, the good thing is that our use of premade libraries is null and we use a very limited library, the only thing we don't code yet is a console reading class because it would be silly to learn about input streams and exception handling before learning how to make your first program that reads 2 integers and returns the sum.

      --

      Copyright infringement is "piracy" in the same way DRM is "consumer rape"
    8. Re:Which university is that? by rucs_hack · · Score: 2, Insightful

      I think that students should start with C, move to pascal, then onto perl/python/lisp, and after that C++, or perhaps java (even though I hate that language, and I've had to teach it, so I'm not blindly critical). A smattering of php wouldn't be bad.

    9. Re:Which university is that? by rucs_hack · · Score: 2, Insightful

      nice.

      I don't object to java being taught, just the use of premade code to replace having to do stuff yourself.

      Do ensure you widen your skillset well beyond java though, single language knowledge is a bad idea. Knowing several and specialising in one is better, since you can move to different languages as the need arises with ease.

    10. Re:Which university is that? by Kamots · · Score: 3, Interesting

      Hmm...

      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 :) 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?

    11. Re:Which university is that? by computational+super · · Score: 3, Interesting
      Isn't that kind of the purpose of Java, one way to do it, don't reinvent the wheel?

      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.
    12. Re:Which university is that? by Mark_Uplanguage · · Score: 2, Informative

      That's interesting. I learned Pascal first and then C. The reason I found this helpful was the Pascal was more controlled (I can't remember all of the correct words anymore). C allows all kinds of memory allocations, redefined pointers and such which are brutal on a beginning programmer. Pascal prevents a lot of those mistakes, therefore giving you a chance to learn some concepts without too much disaster. As for perl/python/lisp. I think lisp is great for showing another way/paradigm of programming. Perl/python/ruby allow you to merge everything together. Of course Smalltalk/Squeak would be great for bringing home object oriented programming. After that PHP, JSP, ASP, whatever is just suited to the environment you're working in. Reality is that you'll probably never get that many programming languages into a B.S.

      --
      "The difference between stupidity and genius is that genius has its limits." -- Albert Einstein
    13. Re:Which university is that? by Gotebe · · Score: 1

      "What, I ask you, is the point of that?"

      Regarding algorithms... If we assume nobody is stupid, students are going to download code and prof is going to know they are doing it. He can't know what is downloaded from internet and what isn't by only reading the text. Today, prof's best bet in such a situation is an oral exam.

      Also, knowing how to code an algorithm is +- useless. What is usefull is understanding it without a language context, and more importantly, its tradeoffs in a given situation.

      Coding it? Why? Only to prove to yourself that you can do it! I did it when I was younger.

      Regarding coding techniques (your example: recursion), this can be shown/asked through an assignment. Prof needs to invent a new recursion/whatever example for each generation of students to avoid downloading. This may be feasible.

    14. Re:Which university is that? by rucs_hack · · Score: 2, Insightful

      "Coding it? Why? Only to prove to yourself that you can do it! I did it when I was younger. "

      No No no no no!

      To learn it in the first place! Weren't you paying attention? You even demonstrated my point by saying 'I did it when I was younger'.

      Yes, you did, so did I, would I re-write something when someone had a better implementation than me? Perhaps, if I wanted to learn how to do it, but not if I needed it soon, or had reasonable assurance that the existing implementation was better then I could do myself. However I have yet to move into a new area of coding without getting my feet wet by implementing some of the code used in that domain myself, just to know what I was talking about.

      What's more use, a programmer who has learned about a thing, then produced on his own an implementation of same, however basic, or one who studied it just to pass an exam and never built it in the real world?

    15. Re:Which university is that? by Lord+Ender · · Score: 1

      The point is to teach what the course aims to teach without wasting time on things students should learn elsewhere.

      Also, one of the main themes in my software engineering education was to avoid complexity. People who think complexity is a good thing often end up on TheDailyWTF.com.

      --
      A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
    16. Re:Which university is that? by rucs_hack · · Score: 1

      I wasn't talking about huge complexity, this is all pretty basic stuff. Heck, if it isn't, then the industry is screwed.

    17. Re:Which university is that? by Anonymous Coward · · Score: 0

      I'm sick of the 'don't re-invent the wheel' argument being dragged out

      Yeah, but where do you cut the line? Everybody's reusing code from somebody else at some point. If you want no reuse at all, then they'd be programming for the bare metal, all the way up to XML parsers and what not.

      Ideally if they learn a few languages to a half-decent standard (not so much learn the languages themselves as learning how to program well), and with enough of everything else (application architecture, patterns, etc) - because knowing a language inside/out isn't enough.

      Regardless of all that, they'll always have more to learn once they're out - if it's not learning a language better, than it's learning another language altogether, or various frameworks and what not.

    18. Re:Which university is that? by hobo+sapiens · · Score: 1

      That's great. Those are the ones taking CS courses because they think they will make a lot of money, not because they enjoy learning. They won't last. Leave them alone. They are corporate layoff fodder.

      --
      blah blah blah
    19. Re:Which university is that? by hobo+sapiens · · Score: 2, Insightful

      Me too, though this was purely coincidental because where I went Pascal was not a pre-req for C. But when I finally got to my C course, which by the end of the year had a dropout rate of 50%, it was relatively smooth sailing. I already knew how to program from my Pascal course, and heck, even the syntax was close enough. This is from someone who took CS courses just as a curiosity, I actually wanted to be an electrical engineer. I say that to make the point that I had no prior programming experience, and yet after just one semester of Pascal, I was ready for C. Pascal is the perfect primer for C; I dare anyone to name a better language for that purpose.

      --
      blah blah blah
    20. Re:Which university is that? by Doctor+Memory · · Score: 3, Insightful

      I think they should learn computer languages in the order that they evolved: assembler first, then FORTRAN, then Pascal (as the ALGOL representative), then C, then Smalltalk. Maybe throw Lisp in there between FORTRAN and Pascal (even though I believe it's older than FORTRAN). Actually, C is kind of a step backwards from Pascal (limited scoping and no built-in I/O), maybe just tack that on to the last couple of weeks of assembler.

      And let's not forget that students should really be studying computer science, not programming. They shouldn't learn how to do a binary search, they should learn why it's such a powerful technique. The implementation falls out naturally from the description. Likewise for trees of various flavors. Teach them how to identify the language features that best support the algorithms they need, and let them figure out which language is most appropriate for themselves. After all, any language they learn in college will be out of favor by midpoint in their career anyway (or earlier, for those of us that learned Pascal...), so better to teach them how to learn a new one from the start.

      --
      Just junk food for thought...
    21. Re:Which university is that? by Doctor+Memory · · Score: 1

      Also, knowing how to code an algorithm is +- useless. What is usefull is understanding it without a language context, and more importantly, its tradeoffs in a given situation. Not to get all Zen or anything, but if you can't code the algorithm, are there any tradeoffs? If all you've got is a nail, why bother to debate the relative merits of Philips vs. Robertson-head screws? You're not going to be using either one of them...
      --
      Just junk food for thought...
    22. Re:Which university is that? by another_fanboy · · Score: 1

      Sadly, mine did... for MIS at least. I took the class just for the hell of it and hated every moment. I remember for the midterm we had to draw the gui by hand, and I had points taken off because I didn't label the size ( in pixels ) of a textbox. Thankfully, the computer science department used Java and C++.

    23. Re:Which university is that? by jcgf · · Score: 4, Funny

      Why have pascal in there at all? Let it die just let it die.

    24. Re:Which university is that? by halber_mensch · · Score: 1
      I'm sick of the 'don't re-invent the wheel' argument being dragged out and used to justify people not studying properly, or for that matter, not teaching properly. I was lucky, I attended a course where most lecturers believed that students should code their own assignments.

      I especially agree with you on this point given the inundation of software patents, trivial and otherwise. When you get beyond university study and are faced with needing code that performs the function of the Wheel in question, how can you justify not being capable of re-inventing it when you will be legally and economically encumbered to leverage it? It's also worth identifying that the Wheel that looks like such a good solution to leverage and not re-invent may actually just be a brick with some molded putty around it, ready to fall apart as soon as it starts to roll, so it's always good to be capable of making an analog to such a Wheel or, if the Wheel is an open specification, building it to a greater degree of robustness.

      --
      perl -e "eval pack(q{H*},join q{},qw{70 72696e74207061636b28717b482a7d2c717b343 637323635363534323533343430617d293b})"
    25. Re:Which university is that? by Siker · · Score: 1

      Isn't that kind of the purpose of Java, one way to do it, don't reinvent the wheel?

      Clearly you have never written a Swing application.

      In Java Swing reinventing the wheel is considered normal operating procedure. Worst case you also have to invent the ground for the wheel to roll on.

    26. Re:Which university is that? by try_anything · · Score: 1

      Every program, every function you write embodies an algorithm. Most of them are special-purpose algorithms that are only useful for the single purpose you're applying them to, but you still need to understand them. Teaching students to understand algorithms, for the purposes of examining correctness and predicting performance scaling, is best done with simple, classic algorithms like sorting and searching.

      The purpose of studying and implementing quicksort is not so that you can understand quicksort later, but so you can understand how to compose statements, functions, modules, and programs into correct, efficient wholes, and how to decompose statements, functions, modules, and programs into sensible pieces for analysis. Quicksort just happens to be a simple and enlightening example.

    27. Re:Which university is that? by mccoma · · Score: 2, Insightful

      Lisp should definitely be in there. Heck, start all the students on Common Lisp and we won't have everyone thinking all languages need to look like Algol.

    28. Re:Which university is that? by metamatic · · Score: 1
      Isn't that kind of the purpose of Java, one way to do it, don't reinvent the wheel?

      +5 funny.

      Java has arrays, Array objects, ArrayList objects, and Vector objects, all solving the same problem in subtly different and incompatible ways. Ditto Hashtable and HashMap. Then there's the type system with int and Integer, float and Float, and so on. SAX 1.0 vs SAX 2.0. Java has so many reinvented wheels.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    29. Re:Which university is that? by Pollardito · · Score: 4, Funny

      starting them out at assembler is jumping the gun. surely they should learn to use an abacus and a slide rule before moving on to Babbage's mechanical computer and then assembler programming on punch cards

    30. Re:Which university is that? by rucs_hack · · Score: 1

      I learned Modula 2 first, then Pascal, then Miranda, Lisp then C, before moving on to more 'modern' languages like Standard C++ and Delphi.

      So I started on the Wirth tree too, which is a decent way I guess. C was a bit of a shock to start with, but I rapidly began to enjoy the runtime benefits of that language on complex/time consuming problems.

    31. Re:Which university is that? by Dr+Avatar · · Score: 2, Interesting

      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.

    32. Re:Which university is that? by Anonymous Coward · · Score: 0

      There's nothing wrong with Java's container classes. That's one of it's strong points. Autoboxing is sorted in Java 1.5, and there's nothing wrong with SAX.

      You sound like you don't have the slightest clue what you're on about.

    33. Re:Which university is that? by metamatic · · Score: 1

      You sound like you're completely missing the point, which is that whether the collection classes and type system are OK or not, they have lots of redundancy.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    34. Re:Which university is that? by Anonymous Coward · · Score: 1, Insightful

      While I'll agree that those things are very useful to know, I'd have to say that it depends on what they plan on doing with the training. Computer Science, as a discipline, has a markedly different focus than Software Engineering.

      I've heard it said more than once that good software developers in commercial environments come mostly from engineering backgrounds rather than mathematical or computer science backgrounds. The key difference is in the repeatedly emphasized end goals. Engineering students are taught very quickly to think in terms of tradeoffs and utility. Theory focused students are trained to think in terms of ideal structures.

      Both have their place - no engineering would work without the carefully worked out theory. However, I think where I'd diverge would be in the more theoretical training such as the various tree types and such. Those come into play in relatively small subsets of actual programming practice and modern languages generally have ready implementations.

      What seems to get slighted most, from what I've seen are flexibility, reliability, maintainability and good software engineering practice. There should be intensive coursework that emphasizes these elements just as much as theory. As Stroustrup said, those are precisely the things that are hardest to build in but are the most critical.

    35. Re:Which university is that? by heson · · Score: 1

      C first and then Pascal? That would be like teaching a kid to use the bicycle and then teach him to use the tricycle. Pascal has no use but to teach newbs an algol dialect.
      The right way teaching C to nonprogrammers is to teach pascal, and then progress to C when they have learned to write a 200 line program without syntax error.
      But C is not useful to fresh programmers, they need programming languages where thay can learn algorithms and data structures without shooting themselves in the foot all the time.

    36. Re:Which university is that? by rucs_hack · · Score: 1

      basic C does have some advantages for early teaching. Provided of course you steer clear of memory management/pointers and the like. By basic I mean the for loop/switch statement level, real basic stuff.

      I did pascal before C, but thought I'd have preferred the other way round once I was finished.

    37. Re:Which university is that? by Anonymous Coward · · Score: 0

      I like your quadratic formula analogy.

      My professor stressed the difference between training vs education -- in training, you are trained on tools in order to get the job done. however, the real value of education is to teach you the basic theories, which is much more valuable to the students because tools tend to become obsolete with time but basic principles don't (in most cases.) Instead of getting trained on C++ programming, you get education on OO principles, algorithm complexities and compiler techniques. After all these years, I think he is right. Even today I still found myself benefit from the education I got from him in my day to day work, even though technology and tools have changed dramatically.

    38. Re:Which university is that? by BritneySP2 · · Score: 1

      ... Or like anything that make sense at all.

    39. Re:Which university is that? by Anonymous Coward · · Score: 0

      Basically everything is wrong with Java's Collection Framework. It's a fucking mess, not only because of their past mistakes (and the need to continue those mistakes for the sake of backwards compatibility), but also because Java doesn't offer all the features needed to develop a well-designed collections framework. And when such functionality is added to Java (ie. generics), it makes things even messier.

      The Smalltalk Collections classes were done right. Their hierarchy is solid, and the use of blocks avoids many of the iteration problems we observe with Java. Then again, it's often argued that Lisp got it right by building the language around lists.

      Regardless, anyone who suggests that the JCF are good is either fucking ignorant, or a fucking fool. The fact is that the JCF is pathetic compared to the offerings of a language like Smalltalk, nevermind the fact that Java's Collection classes were developed a decade or more after Smalltalk's far better equivalents.

    40. Re:Which university is that? by ctzan · · Score: 1
      I'm sick of the 'don't re-invent the wheel' argument being dragged out and used to justify people not studying properly, or for that matter, not teaching properly.

      I've recently met a Python programmer (who has written some very large & complex applications) who simply wasn't able to come up with an "algorithm" to calculate how many Sundays are between two random dates in the calendar.

      I'm not kidding.

    41. Re:Which university is that? by Saxerman · · Score: 1
      I'm sick of the 'don't re-invent the wheel' argument being dragged out and used to justify people not studying properly, or for that matter, not teaching properly. I was lucky, I attended a course where most lecturers believed that students should code their own assignments. Examples being recursive functions, sorting functions, Dijkstra's shortest path algorithm, stuff like that. However I have recently had to cope with people being given exactly the same type of assignment, and being allowed to download pre-built classes for them! What, I ask you, is the point of that?

      There is much wisdom in what you speak, alas I would claim it is our teachers who are now failing. A good programmer should certainly be able to both write elegant solutions for use by others, and integrate existing code into their programs. Thus should assignments include aspects of both. Yet too often our schools and teachers will teach conformity rather than creativity. They would rather they had the ability to consistently ask for the same things from their students, and yet always get something new and unique from them.

      There is much talk and fear of the internet leading to greater plagiarism, and I certainly accept that some blame lay with the students for 'stealing' the works from others. Yet I also lay the blame upon these redundant assignments. If you continually ask for your students to provide a sort algorithm, how often will natural redundancy arise? The true challenge becomes building new assignments that continually strive to ask for something new and unique. Yet this would require teachers who actually know the material they teach, and the ability to creatively arrive at new challenges that are appropriate for their students. A cost that would require almost a redesign of the way we think about education.

      --

      A steaming cup of soykaf would be real wiz right now.

    42. Re:Which university is that? by innerweb · · Score: 1

      My god man! Do you expect an education at school?

      -Innerweb
      --
      Freud might say that Intelligent Design is religion's ID.
    43. Re:Which university is that? by Anonymous Coward · · Score: 0

      I can understand that. Dates can get trickey, what if the inputs where 09/02/1752 and 09/14/1752

    44. Re:Which university is that? by sousoux · · Score: 1

      "However I have recently had to cope with people being given exactly the same type of assignment, and being allowed to download pre-built classes for them! What, I ask you, is the point of that?" I agree in principle but I'm equally surprised by programmers that DON'T make use of existing resources. I think a mix of the fundamentals and "how to get it done" is the right blend. Just teaching people how to write a compiler from scratch doesn't enable them to be productive (and good) programmers.

    45. Re:Which university is that? by Hognoxious · · Score: 1
      what if the inputs where 09/02/1752 and 09/14/1752
      I'm a Catholic, you insensitive prod!

      (Disclaimer: I am not a Catholic, but I do play one on TV)
      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    46. Re:Which university is that? by DragonWriter · · Score: 1
      A good reason to use some older language like Pascal or FORTRAN would be to avoid the pre-built classes problem.


      Yeah, because its so hard to find, on the internet, implementations of well-studied algorithms in languages that have been heavily used for decades longer than Java has existed.

      OTOH, if a class has controlled examinations, the student that downloads -- whether in Java or otherwise -- components to get projects to work without understanding what they are doing is going to be shown up for a fraud. Now, its been almost a decade since I graduated from college, and more than a decade since I switched out of CS, but I would imagine that they still have examinations in CS classes that involve written, discursive responses, and not just banging away at computing projects.
    47. Re:Which university is that? by JebusIsLord · · Score: 1

      We did pascal in the first semester, then second semester we had a low-level course (sparc) where we had to pick up C on the fly. I question what the use in learning pascal was, to be honest; it is so similar to C that I doubt there would be a significant curve just going with C to begin with. Any arguments as to why Pascal is necessary?

      Java was also taught in second semester, and that's when I learned that I really enjoyed programming. Pascal almost weeded me out :)

      --
      Jeremy
    48. Re:Which university is that? by The+One+and+Only · · Score: 1
      They shouldn't learn how to do a binary search, they should learn why it's such a powerful technique. The implementation falls out naturally from the description.

      How do you demonstrate understanding of what a binary search is? By coding it. As you say, the implementation falls out naturally from the description--if they understand the description they can write the implementation.

      --
      In Repressive Burma, it's not just your connection that dies. slashdot.org/comments.pl?sid=314547&cid=20819199
  9. This is the guy.... by Anonymous Coward · · Score: 0

    ... who claims he developed C++ to make programming more "fun."

    Am I having fun yet, Bjarne? AM I You #$@#$$@#@#$*% +++NO CARRIER

    1. Re:This is the guy.... by CortoMaltese · · Score: 1
      ... who claims he developed C++ to make programming more "fun."
      He just forgot to add "YMMV" at the end.
  10. Re:The biggest problem is choosing the right langu by Eideewt · · Score: 2, Insightful

    FTFA: "My brief definition is, correct, maintainable, and adequately fast. Aesthetics matter, but first and foremost a language must be useful; it must allow real-world programmers to express real-world ideas succinctly and affordably."

    Sounds like Lisp to me.... It's a mystery to me why anyone would voluntarily program in a language that makes the things that should be easy difficult, and makes things like segfaults, which should be pretty darn hard to do, easy enough to accomplish by accident. Yet so many people do it.

  11. "On the other hand, ..." by TransEurope · · Score: 5, Insightful

    "...looking at "average" pieces of code can make me cry. The structure is appalling, and the programmers clearly didn't think deeply about correctness, algorithms, data structures, or maintainability."

    Maybe it's because the average programmer is enslaved in company business. They don't have the
    time to create masterpieces or art in programming. Instead of that they are forced to create
    something adequate in a given time. Happens almost everytime, when science becomes business.
    I don't like that, you don't like that, no one likes that, but that's the way commercial industries
    are working (at the moment).

    1. Re:"On the other hand, ..." by 2short · · Score: 3, Insightful


      I deal every day with programmers who don't think they have time to deal with things like correctness, algorithms, data structures, or maintainability. In their panic to create something adequate in a given time, they invariably run over time and create something inadequate. They'd have been much better off doing it the "right" way, because the whole reason it's called the "right" way is it's the fastest way to get the bloody job done.

      Like it or not, writing code that has to be done on some deadline, and work, is how commercial (and much non-commercial) coding is; at the moment, at all previous moments, and for all future moments. So learn to write good code in that environment or get a different job; don't write bad code and blame it on obvious truisms.

      Sorry, long day :)

    2. Re:"On the other hand, ..." by SageMusings · · Score: 3, Insightful

      So learn to write good code in that environment or get a different job; don't write bad code and blame it on obvious truisms

      Sure....

      And the moment you demonstrate to the organization you can write a quality app in 3 months, they'll decide they can ask for the next one in 2 months. You should come and try my environment some time.

      I wouldn't say we write bad code. We just write adequate code in a survival mode to appease customers who were assured by our sales team that we can change anything they like.

      --
      -- Posted from my parent's basement
    3. Re:"On the other hand, ..." by redblue · · Score: 2

      That's funny... I work completely from home and code for fun as much for profit. For some reason it looks exactly like the code I wrote for the Big Evil Companies I used to work for.

    4. Re:"On the other hand, ..." by RAMMS+EIN · · Score: 1

      It's not just in the corporate world that bad code gets written. So many people decide that they can write something useful (often a web app) and go on to write something full of bugs and security holes.

      --
      Please correct me if I got my facts wrong.
    5. Re:"On the other hand, ..." by misleb · · Score: 2

      Oh please. Look at just about every open source project out there. No management holding them back. No marketing departments making unreasonable demands. No accountants cutting budgets. And yet most projects are full of flaws and crappiness. I'm not knocking Open Source. I love it, but at the same time I have to overlook a lot of shortcomings. When it comes right down to it the Linux kernel, for example, is not significantly better than, say the Solaris kernel. They each have their own strengths and weaknesses. No one could point to he Linux kernel source code and say "now that is awesome code that no corporation could ever produce because of budget constraints, et al."

      Fact is that programming major projects well is the real world is HARD. Really fsckin' hard. It has nothing to do with the demands of business.

      -matthew

      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    6. Re:"On the other hand, ..." by 2short · · Score: 3, Insightful

      I generally have a release deadline every 2 weeks or so. I have some code I've been building on for 8 years; and some I've re-invented and re-written so many times I shudder to think what might have been accomplished with the time I'd have saved if I hadn't tried to take a shortcut the first time I wrote it.

      If there is anything that my job has firmly beaten in to me it's that doing it right saves you time over taking the shortcut; and not even down the road, but right there, the first time. The stupefyingly huge savings in maintainability and reusability are just gravy.

      It sounds to me like I would say you write bad code, and I'd recommend trying to write the best code you can because it will get things done faster. Salesmen promising customers unreasonable things won't change, so it's no reason to make things worse. If the things they sell are truly unreasonable, in that they cost more to do than someone pays, and they don't get fired, then your management is incompetent. In that case, you're screwed, but still no reason to make it worse. :)

    7. Re:"On the other hand, ..." by Anonymous Coward · · Score: 0

      just gravy Just gravy? JUST gravy??

      Don't you think it's about time gravy got the respect it deserves? It's not just an unnecessary nice to have, gravy is the most important part of the meal, it's what turns a burnt lump of dead meat into a memorable culinary experience.

    8. Re:"On the other hand, ..." by Oligonicella · · Score: 1

      Bzzt! Sorry, wrong answer. The answer is: Good programming practices and design will yield a stronger application in shorter time... Good practices, design, stronger in shorter time. Thank you for playing, now get off the stage.

    9. Re:"On the other hand, ..." by Paradise+Pete · · Score: 1
      I shudder to think what might have been accomplished with the time I'd have saved if I hadn't tried to take a shortcut the first time I wrote it.

      I've never once had a non-trivial program to write in which I completely understood everything about it, and it was simply a matter of typing it out. So the first version always contains mistakes in judgement.

      I have, of course, often thought I completely understood everything, but I've always been wrong.

    10. Re:"On the other hand, ..." by qwijibo · · Score: 1

      You're on the windows system architecture team, aren't you?

      We all know it's a burnt lump of dead meat in the middle, you're not fooling anyone.

    11. Re:"On the other hand, ..." by qwijibo · · Score: 1

      The fastest way to get the job done is to not finish it. I can't count the number of times I've put together a prototype to make sure that my ideas for how to solve the problem are on the right track and the prototype got a "production code" sticker slapped on it and we were onto the next project.

      I agree completely with the idea that you need to write code as if this type of thing happens because it often does.

    12. Re:"On the other hand, ..." by qwijibo · · Score: 1

      You get 2 months for something that took 3 months before? What decadent luxury. Where can I send my resume? We lose 50+% of our time AND 50+% of our people each time we get a new project. Once we were 8, now we're 1(it takes a while to get used to referring to Team Mike in the second and third person in meetings). I think next time the project is expected to do itself and finish before it starts.

    13. Re:"On the other hand, ..." by Lars+Arvestad · · Score: 1

      I have to say that I have seen plenty of academic codes that would make the most hardened programmer cry. My favourite example involves include files that behaves differently depending on which file includes them. And the conditionals are nested... When the ifdefs cover several pages at the time, it can be several days worth of work to understand what is going on.

      No doubt the pressure is on also in academia, but add to that inadequate programming skills and you get an interesting combination.

      --
      Reality or nothing.
    14. Re:"On the other hand, ..." by loconet · · Score: 2, Insightful

      "the whole reason it's called the "right" way is it's the fastest way to get the bloody job done"

      Wrong. Why do I keep hearing this argument? It makes no sense whatsoever. I've heard it from many managers, is that what they teach them? I'm obviously missing something. My experience and common sense tells me that it takes longer to sit down and design a solution using a well thought out process (ie: the "right" way) than it takes to throw together a hack to address the problem quickly.

      If the "right" way is the fastest way to get the job done, why wouldn't more people use it? Why would the majority of programmers, always "complain" about having to sacrifice correctness for timeliness. Is the incompetence level _that_ high? I don't think so, I've heard this "complain" from bright programmers.

      Think about it. Wake up at the usual time you wake up during a work day and try to paint your house before you leave for work. Assume that you absolutely need to finish the project before you leave for work. How good of a job are you going to do vs doing it on the weekend with a more thought out plan, taking the time to evenly cover all the walls, taking care of covering the floor, furniture, using the right paint, ventilating the rooms properly, letting it dry before you apply a second hand, etc.

      The "right" way involves different stages of analysis, design and development which usually take time. Hack jobs exist for a reason and not because programmers didn't realize that "the 'right' way is it's the fastest way to get the bloody job done"!

      --
      [alk]
    15. Re:"On the other hand, ..." by Anonymous Coward · · Score: 0

      hahahahaha

      the funniest post i've seen in a long time. i once wrote a "group project" in which i did all of the coding, but still used "we" and "us" in the comments and when talking about it.

    16. Re:"On the other hand, ..." by kestasjk · · Score: 1

      I agree. I'm currently on holiday, and have been spending most of the day pawing through an open source app of mine simply changing part of the internal architecture to the way I should have made it in the first place. You can only add so many hacks on top of hacks before you have to tear it all up and re-write a lot of code.

      The point is with my open source projects I find that I write the code to get a feature that I want now; I enjoy the results of the code more than coding itself. The opposite is true where I work; I'm not rushing to see some boring inventory app in action, so I enjoy coding it right.
      I don't think you can say "open source means good code" or "no deadlines means good code", I'd say it's more to do with your motivation.

      --
      // MD_Update(&m,buf,j);
    17. Re:"On the other hand, ..." by qwijibo · · Score: 2, Insightful

      I think the "right" way is the one that takes the least time in the long run. The problem is that business is focused on "good enough right now" and doesn't care if spending a week instead of a month on something now may still cost the same month later, plus another couple of months of converting everything from the wrong way to the right way. From the business perspective, "later" is someone else's problem. Businesses succeed or fail based on how effectively they determine which things can be put off until later and which need to be done correctly now.

    18. Re:"On the other hand, ..." by loconet · · Score: 1

      I agree. I think the keyword here is "long run" which may be what the original poster was referring to. The benefits of doing it the "right" way in the long run is something which managers are unable to (don't want) to comprehend because a lot of them live/work for today and today only.

      --
      [alk]
    19. Re:"On the other hand, ..." by 2short · · Score: 1


      If your business is going to fail unless you regularly get things done in radically inapropriate time frames, then your business is going to fail. Lousy development practices will not change that.

      I hear programmers, even bright ones, complain about having to sacrifice correctness for timliness frequently. After I tell them what I think is the fastest way to do something, they say, "I don't have time for that, I only have a week!" Three weeks later, they complain that it was really hard to do their hack because the base code didn't fit with it. The base code that, mind you, already existed, and whose properties were the basis for my recomendation.
        A year later, after they're gone, I rip out their buggy thing that never worked right and replace it, improving the base code in the process. It takes me a week.

      As far as the house painting analogy:
          You will be scraping paint off the furniture you didn't cover, and repainting the stuff you used the wrong color on while I'm done, and working on the next job.

    20. Re:"On the other hand, ..." by fermion · · Score: 1
      It is easy to blame the time constraints, or the fact that we are now learning on GUIS that do most of the work for you, or that there is no real benefit to writing good code©. But the reality is that no matter what the pressure, no matter what the programming language or development environment, it comes done to the way the person was trained.

      If a person is trained to value organization, process, and orthogonality, then no matter what the environment this what will be generated. If a person is trained simply to put commands in a workable order, with no regard to how the data is protected, or the number of places that must now the storage structure, then this is what will produced. Any language can be used to write spaghetti code,while even something as ancient as C and Forth can be used to write well structured and compartmentalized code.

      What happens with business, science, or whatever, is that people become greedy or sloppy,and demand immediate reward even if it significantly reduces future viability. The benefit of certain languages, as the benefit of certain oversight agencies, is that certain policies are enforced in an effort to deter those person that would take dangerous shortcuts. Of course the well trained ethical person does not require such oversight.

      --
      "She's a scientist and a lesbian. She's not going to let it slide." Orphan Black
    21. Re:"On the other hand, ..." by Anonymous Coward · · Score: 0

      Maybe it's because the average programmer is enslaved in company business. They don't have the time to create masterpieces or art in programming. Instead of that they are forced to create something adequate in a given time. Happens almost everytime, when science becomes business. I don't like that, you don't like that, no one likes that, but that's the way commercial industries are working (at the moment).

      Maybe they need to go work for UPS sometime... where you get the job benefit of having your job threatened every time you screw up.

    22. Re:"On the other hand, ..." by 2short · · Score: 1

      Oh, certainly there's times I don't understand the problem well enough. But I don't regret that; I try to learn what's wrong with the first version and hence it's frequently the second version that lives on.

      What I regret is when I know there's something wrong with my approach, but do it that way anyway because I "don't have time" to do it right. Then all I learn is what *else* is wrong with the aproach I already knew was basically wrong to begin with. Then I'm generally over time, have something that doesn't work very well, but that I've invested a bunch of time in so it's emotionally difficult to just chuck it; and I've learned nothing I didn't already know about the right way to do it.

    23. Re:"On the other hand, ..." by BrotherLuigi · · Score: 1

      the whole reason it's called the "right" way is it's the fastest way to get the bloody job done. No, then it would be called the "fastest" way. These two things are hardly ever the same.
    24. Re:"On the other hand, ..." by 2short · · Score: 1

      I'm saying that, in my experience, the "right" way and the "fastest" way are almost always the same. I see people regularly do no planning, and dive straight into something to just "hack it together" because they only have a couple days to get it done! And these people invariably run into problems that cause the project to take a week and not work at the end. Problems that could have been avoided if they spent 5 minutes planning how to do it the right way before they jumped in.

    25. Re:"On the other hand, ..." by SageMusings · · Score: 1

      It sounds to me like I would say you write bad code

      Typical Slashdot fodder. How the hell do you know what kind of code I write? Ever seen a single line? If you are releasing on a 2 week cycle, you're the one either writing poor code or working on a trivial application.

      --
      -- Posted from my parent's basement
  12. Real Experience by stox · · Score: 1, Insightful

    Nothing personal, but Bjarne Stroustrup comes real short in the real world department. He has not been in the position of solving real world problems with C++. Someone like James Coplien has. I would be much more interested in the commentary of a front line warrior, than I would from a theoretical preacher.

    --
    "To those who are overly cautious, everything is impossible. "
    1. Re:Real Experience by abshnasko · · Score: 1

      I would be much more interested in the commentary of a front line warrior, than I would from a theoretical preacher Well he did CREATE the language....
    2. Re:Real Experience by Anonymous Coward · · Score: 3, Informative

      Stroustrup developed much of the cfront C++ compiler, which itself was written in C++. It received widespread use on most UNIX platforms, and was the default C++ compiler on systems like HP-UX and SCO UnixWare. Numerous organizations licensed it, and some even offered ports to systems like DOS.

      He was the head of AT&T Labs' Large-scale Programming Research department for a number of years. I'd imagine you're not familiar with some of the cutting-edge research he was responsible for when it comes to massive software systems. Had you actually been familiar with his achievements, you wouldn't have accused him of coming up "short in the real world department".

    3. Re:Real Experience by Beryllium+Sphere(tm) · · Score: 1

      I've written commercial software.

      "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." is one of the most insightful things I've read since Fred Brooks.

    4. Re:Real Experience by hardcampa · · Score: 0

      "Nothing personal, but Bjarne Stroustrup comes real short in the real world department." Nothing personal but are you really that stupid. Do you really believe Stroustrop just sits back and watches.

    5. Re:Real Experience by stox · · Score: 1

      Well, I might just have a slight clue developing large systems. I have been being one of the first consumers of C++ ( Fun with DMDPI and porting to the i386 ), wrote code for 5ESS International ( Fun with Inband signaling ), and the admin'd the farms at the DZero and CDF experiments at Fermilab ( Fun with Quarks ).

      I'm sorry, but the likes of James Coplien and Warren Montgomery (Bell Labs in the late 80's and early 90's) have far more "real" experience at developing "real" applications that Bjarne will ever have.

      --
      "To those who are overly cautious, everything is impossible. "
    6. Re:Real Experience by rcastro0 · · Score: 1

      "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." is one of the most insightful things I've read since Fred Brooks.

      The "We do not know exactly how we did it" part is insightful, though in the obvious-when-you-consider and most-other-things-are-like-that kind of way.

      The "building reliable systems out of unreliable parts" part sounds like a mystical revelation but is in fact incoherent garbage. The definition of reliable (from the dictionary) is "giving the same results on successive trials". What software, be it a system, be it a module, is not reliable in that sense ? It may have a bug, but a bug which happens under specific, repeatable and avoidable conditions, does not make a software system or part any less reliable.

      --
      Quem a paca cara compra, paca cara pagará.
    7. Re:Real Experience by kraut · · Score: 1

      >i'm sorry, but the likes of James Coplien and Warren Montgomery (Bell Labs in the late 80's and early 90's) have far more "real" experience at developing "real" applications that Bjarne will ever have.

      Last time I checked Jim was still using C++. Enough said.

      --
      no taxation without representation!
    8. Re:Real Experience by scotch · · Score: 1

      So it's you versus Bjarne now? What is you argument again? Some people (your humble self included) have more experience (not measured, supported, or in any way evidenced) so we're supposed to agree that you've made what particular point? That you're a jerk no one probably likes to work with? Or is that just your internet personality?

      --
      XML causes global warming.
    9. Re:Real Experience by complexmath · · Score: 1

      Nothing personal, but Bjarne Stroustrup comes real short in the real world department. He has not been in the position of solving real world problems with C++.

      So you're saying that he invented C++ and prompty retired? That patent must have been worth a fortune!

  13. Firefox is a fucking mess. by Anonymous Coward · · Score: 5, Informative

    The Firefox codebase is indeed a mess. Don't take my word for it, view it yourself: http://lxr.mozilla.org/seamonkey/source/.

    Part of the problem is the severe over-architecturing. This over-architecturing has added much unnecessary complexity to the overall design of Gecko and Firefox. Much of it is "justified" in the name of portability. But then we find that other frameworks, including wxWidgets and GTK+, do just fine without the overly complex and confusing architecture of Gecko and Firefox.

    It's just not easy for most developers to become up-to-date with the Mozilla codebase because of all this added complexity. Unless a volunteer developer has literally months to spend learning even the small portion of the code they're interested in working on, it's basically inaccessible to most programmers.

    The constraints of the real-world often come into play, and we have developers modifying code they don't necessarily understand fully. And so we get the frequent crashes, glitches, memory leaks and security problems that Firefox 1.5.x and 2.x have become famous for.

    It's likely that Mozilla should ideally rewrite a vast portion of their code, keeping simplicity in mind. That likely won't happen, and thus we will most assuredly still run into problems with Firefox and Gecko, problems caused directly by the overcomplication of the Mozilla architecture.

    1. Re:Firefox is a fucking mess. by Maian · · Score: 3, Interesting

      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.

    2. Re:Firefox is a fucking mess. by mkosmul · · Score: 1

      It's likely that Mozilla should ideally rewrite a vast portion of their code, keeping simplicity in mind. That likely won't happen, and thus we will most assuredly still run into problems with Firefox and Gecko, problems caused directly by the overcomplication of the Mozilla architecture.
      Netscape, the forefather of Mozilla, decided to rewrite their Navigator from scratch when they went from version 4 to 6. The result was a terribly bloated program which was barely usable on usual hardware of the day and caused Netscape to lose almost all of its power. I hope Mozilla doesn't try to repeat this step.

    3. Re:Firefox is a fucking mess. by juancnuno · · Score: 1

      They already did that. Part of the reason why Netscape lost.

  14. Stroustrup is an asshole by Anonymous Coward · · Score: 0

    I see him almost everyday and I just want to hit him after taking ENGR 112 at Texas A&M which is supposed to be a basic intro course to programming and it is hell on earth...

    1. Re:Stroustrup is an asshole by Anonymous Coward · · Score: 0

      That class tries to squeeze 2 semesters of material into 1 semester. I think the stuff beyond 'C with classes' should be covered in Yurttas' 332.

      In his defense, you don't want someone like him dictating what 'introductory' should be. Imagine if John Carmack taught the introductory graphics course *shudders*.

    2. Re:Stroustrup is an asshole by Anonymous Coward · · Score: 0

      Well he was not my professor for the course though. He made the book which you still have to buy the next few chapters from kinkos every couple of weeks in order to continue the course. The book is erroneous and so is most of the code in it.

  15. DESIGN of C++? by jcr · · Score: 1

    More like accretion.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
  16. This is why I like assembler by FlyByPC · · Score: 1

    PIC microcontrollers in particular. Not only do you know exactly what the chip will do, but since it's programming on a reasonably small scale, you can have complete control -- right down to the actual bits -- of everything on the chip. Small, efficient, fast -- and with a bit more effort, you can do a quick mathematical proof that the software is airtight.

    I realize this is completely impractical on a level of an operating system -- but TFA is right; if we could put a little less emphasis on having the shiny new gadget right now (and I know, I'm as bad as anyone), we could have much more reliable software. Do enough people want it that badly? Maybe not.

    --
    Paleotechnologist and connoisseur of pretty shiny things.
    1. Re:This is why I like assembler by sillybilly · · Score: 1

      Not to mention low power. Microwatts, nanowatts. Unfortunately it's hard to play Pacman on it, let alone something like Unreal Tournament, but I've seen a paddle/ball video game implementation. If they could take that simplicity, and make it big and fast, where it can drive a screen better, but so simply that even a dumbo can program it, it would really flourish. It needs no harddrive - but you could connect one externally -, it needs no display - but you could connect one externally (my monitor has umm, how many pins? a 40 pin chip should have enough pins) - no keyboard, but you could connect one externally, etc. As far as pincount goes, some of the interfaces could be simplified to how USB2 simplified the how many pin parallel port, and if the feature set is complicated, provide and on-chip mechanism to do the translation (they have RS232 built in to newer chips, but you can do the bit banging by hand if you please, roll your own.) That's how it should be with all peripherals - the specs simple so even a dumbo can do the bit banging, and peripherals should be optional. None of this "drivers" mess in i386 that nobody knows what the heck is going on, and results in crashes so much. And once it reaches the speeds of a Commodore C64 or Z80, it's pretty usable and fun. Yes, I know the Z80 is there, you are welcome to learn it and play away with it, but it's too complex, the motherboard a Z80 runs on is not dumbo friendly. How about instead of Z80's, PIC's with USB stick memory, and some easy LCD display upsided from the 16x2 displays you see, with reduced pincount? You could have a whole range of chips, from superlow microwatts they have now, up to superfast 1GHz P3 level, and in all cases be able to have a standalone chip, with max 40 pins, or the option to connect harddrive, usb stick, display, keyboard, rs232, if you want, that is. Such a standard where things are simple and grandma can bitbang it would work wonders in industry/spaceshuttle/everything, because everyone could do it as opposed to a very specialized few.

    2. Re:This is why I like assembler by FlyByPC · · Score: 1

      Speaking of microwatts -- I was diagnosing a PIC program once, and was trying to find out why it wouldn't reset when the power was cut. It was just going into suspend mode, and picking right up where it left off. Turns out my finger was resting on the switch contacts, and the megohm or so of resistance across the contacts was enough to keep the PIC (a 12F683) powered up but paused. Amazing.

      --
      Paleotechnologist and connoisseur of pretty shiny things.
  17. Re:The biggest problem is choosing the right langu by Anonymous Coward · · Score: 0

    It's a mystery to me too, but at least they're not using perl!

  18. He summarizes one of the big issues in SD now... by Bamafan77 · · Score: 5, Interesting
    From the article:

    TR: How can we fix the mess we are in?

    BS: In theory, the answer is simple: educate our software developers better, use more-appropriate design methods, and design for flexibility and for the long haul. Reward correct, solid, and safe systems. Punish sloppiness.

    In reality, that's impossible. People reward developers who deliver software that is cheap, buggy, and first. That's because people want fancy new gadgets now. They don't want inconvenience, don't want to learn new ways of interacting with their computers, don't want delays in delivery, and don't want to pay extra for quality (unless it's obvious up front--and often not even then). And without real changes in user behavior, software suppliers are unlikely to change.

    There ya go! Time pressures and price are fundamentally incompatable with code quality, even amongst the best programmers. Ergo, great programming is incompatible with most business models (i.e., most businesses don't have the money to make the software they want at the quality they want). It's sort of like wanting a Ferrari, but only having enough money to buy Gremlin. Sadly, many (most?) programming projects are nothing more than an arms race between getting something out the door that hangs together reasonably well and the bottom of the client's bank accounts.

    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.

  19. Its crazy by JustNiz · · Score: 3, Insightful

    To all those people saying C++ is too dangerous/prone to errors and Java/C## is the way ahead:
    Stop blaming the tools and look to yourselves.

    C++ is like a sharp scalpel. Yes you can hurt yourself if you're unskilled, inexperienced or sloppy.
    Java and C# are like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.

    Unfortunately it seems that there are a lot of people out there who like to call themselves programmers but have no actual ability. Java/C## does a good job of removing their need to think and hiding their inate lack of skill which is why they prefer it.

    But there's a reason why surgeons don't use plastic scissors. The same applies to good software engineers.

    1. Re:Its crazy by Coryoth · · Score: 2, Interesting
      C++ is like a sharp scalpel. Yes you can hurt yourself if you're unskilled, inexperienced or sloppy.
      Java and C# are like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.

      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.
    2. Re:Its crazy by nigels · · Score: 1

      Things like Java serve to lower the barrier to entry. This makes it cheaper for companies to churn out flawed software, than it would otherwise be. And hopefully in the padded cell environment, the exceptions/crashes won't bring down the whole system. That's a decision for businesses to make, but it does reflect badly on the profession overall.

    3. Re:Its crazy by EvanED · · Score: 5, Insightful

      C++ is like a sharp scalpel. Yes you can hurt yourself if you're unskilled, inexperienced or sloppy

      "C++ gives you enough rope to shoot yourself in the foot"

      Java and C# are like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.

      I'm not convinced of the "totally inefficient" bit. I think you'd be pressing it to do time-critical systems (indeed, current GC is more or less incompatible with realtime systems), OSs, etc., but I'm not convinced that they're not just fine for applications. This especially applies to C#, because C# GUIs are actually responsive. (Swing and to a lesser extent SWT lag a little.)

      But there's a reason why surgeons don't use plastic scissors.

      There's also a reason carpenters don't use scalpels. It's because different tools are good for different jobs.

    4. Re:Its crazy by KonoWatakushi · · Score: 1

      I could agree with everything in your post if you replaced C++ with C.

      C++ however, is sharp not like a scalpel, but rather a twisted piece of shrapnel. Even when used properly, it is hideous and inflexible. A more dynamic language like Objective C allows for *much* cleaner, more expressive, and far more readable code.

    5. Re:Its crazy by Anonymous Coward · · Score: 0

      you put a little too much sharpness in C##.

    6. Re:Its crazy by QuantumG · · Score: 3, Insightful

      As much as your comment is flamebait, I have to agree with you to a point. The "virtual machine" aspect of the Java programming environment has probably done more to harm the quality of programmers than anything else. I know java programmers who don't understand how a computer works. They ask me questions about "how the processor loads strings into registers" and such. Being able to not think about the nitty gritty of the processor you are writing your code for is great, but that doesn't justify not knowing the basics of how a processor actually works. You might as well be coding in LOGO.

      This, of course, is not true of all Java programmers. It probably isn't true of most Java programmers, but I feel safe to say that it's true of more Java programmers than it is of C or C++ programmers.

      --
      How we know is more important than what we know.
    7. Re:Its crazy by Anonymous Coward · · Score: 0
      But there's a reason why surgeons don't use plastic scissors. The same applies to good software engineers.

      But surgeons only use a scalpel when they are doing sugery. Would you expect them to use it to cut a piece of paper?

      Java/C## may be simpler, but they fill the spot for non-intensive software that doesn't require the precision of using C++. Why would you want to use C++ to write something that could be made simpler with Java/C##, especially if there is no noticable performance hit?

    8. Re:Its crazy by JustNiz · · Score: 1

      probably because its quicker for me to write something in C++ than java/C##, and also because the compiuled executable is fast and doesn't neeed a vm and a whole bunch of installed libraries to run.

    9. Re:Its crazy by RAMMS+EIN · · Score: 1

      ``To all those people saying C++ is too dangerous/prone to errors and Java/C## is the way ahead:
      Stop blaming the tools and look to yourselves.''

      No. Tools that contain unnecessary pitfalls are flawed. If the language allows people to write unsafe code, people will write unsafe code. Especially if writing safe code is harder. Of course, the people who write unsafe code are still to blame, but the tools are bad, too.

      ``Java and C# are like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.''

      If they're inefficient, that's because of the existing implementations, not because of the languages themselves.

      --
      Please correct me if I got my facts wrong.
    10. Re:Its crazy by IlliniECE · · Score: 1

      Yes, C++ developers more often seem to 'get it' about computer architecture. And C++ *is* like a scalpel, and Java *is* like a pair of scissors (rounded corners, i'm not sure). But, in comparing them, one has to consider the extensive, well-documented, and reliably structured libraries that come with Java. When you need to demonstrate a broadly functioning prototype in a short development cycle, an exacto knife is too much trouble. For a time-critical, mission-critical software, then we can pull out the C++ and assembly code.

    11. Re:Its crazy by Anonymous Coward · · Score: 0

      Think of the other tools you use - a car for example. When you get in a car you usually want to go somewhere. You don't want to have to prime the carb first, fiddle with the choke, crank the engine to get the car started. You want electric blinkers instead of hand signals. What about ABS, ESP etc etc etc.

      I've enjoyed/hated programming with C++ as much as anyone but I don't need to prove that I can 'wield the sharp scalpel'. If I've got a dumb robot to help me with the surgery then I'll take that help. Only when I really *need* the dangerous tool to do something then I'll use it.

    12. Re:Its crazy by freedom_india · · Score: 1

      >>Totally inefficent but safe for beginners.

      If they are inefficient as you claim, tell me how come we see more and more systems everyday being built on Java (esp. in Banking).

      You seem to confuse easiness with inefficiency. By your standards a 1880s Sword is more efficient for cutting up food meat than a mere fork.

      >>But there's a reason why surgeons don't use plastic scissors

      Have you heard of Polymers? They are used in airplane frames and also by surgeons.

      Java is more like a modern day Saw with lots of safety features implemented (auto cutoff, detects human flesh and cuts off, stops when it detects its about to break, etc).
      Its more easy to use, trustworthy and Powerful.

      Or maybe you would prefer to use the old-age manually operated Steel Saw which would whip back and could cut you in two pieces at a snap.

      --
      "Doing what i can, with what i have." ~ Burt Gummer
    13. Re:Its crazy by Kjella · · Score: 1

      C++ is like a sharp scalpel. (...) But there's a reason why surgeons don't use plastic scissors. The same applies to good software engineers.

      There's also a reason surgeons eat dinner with a knife, not a scalpel. Handling it requires great care, and if you can get the job done well enough with a safer tool, all the better. Personally I use Qt as my "insulation" between me and stupid mistakes - an out of bounds QByteArray index doesn't create a buffer overflow, with signals/slots a dangling pointer won't crash the application. Could I use raw buffers and callbacks instead? Yes, if the performance required it. But if I'm able not to, I prefer that even though I consider myself competent with a "scalpel".

      --
      Live today, because you never know what tomorrow brings
    14. Re:Its crazy by shutdown+-p+now · · Score: 1
      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.)

      Unfortunately, it isn't that. Last time I checked, it still lets you pass a list of integers to a method taking a list of numbers as an argument (that is, LIST[INTEGER] can be used wherever LIST[NUMERIC] is expected). If the method tries to put a REAL into the list, the language will just let you do so, producing undefined results at run-time (since the list can only contain INTEGER elements). There isn't even any run-time check. So much for strong static typing...

      It's also the only language I'm aware of in which method arguments are covariant rather than contravariant when it comes to method overriding. I know the "party line" on the issue, and the way the language tries to handle the problems arising from it, but the fact is - it is inherently not type-safe, nor consistent with the way preconditions are handled.

      It is a pity really, since I'd very much like a decent object-oriented statically typed language designed with Design by Contract methodology in mind. My hopes are that C# will get there eventually, since Anders Hejlsberg mentioned in one of his interviews that DbC, while not on the top of the list, might be there eventually.

    15. Re:Its crazy by Coryoth · · Score: 1
      I'd very much like a decent object-oriented statically typed language designed with Design by Contract methodology in mind. My hopes are that C# will get there eventually, since Anders Hejlsberg mentioned in one of his interviews that DbC, while not on the top of the list, might be there eventually.

      It's probably worth your time to look at Spec# then, which is C# with DbC and extended static checking.
    16. Re:Its crazy by iamacat · · Score: 1

      "how the processor loads strings into registers"

      1. mov ebx, offsetof cconst$129
      2. Java chip instruction reference
      3. Can you answer offhand how processors do integer division? (I can)
      4. ... in which order a processor will execute a given series of instructions? (I can't)

      People only need to learn something they use for work, or something they are curious about. It sounds like the later is the case with your coworkers, and you should give them a curiosity-satisfying explanation about memory being one big byte array and \0-terminated strings. As for people who are not curious and don't write native code, so what if they don't know what is a processor and what is memory?

    17. Re:Its crazy by larytet · · Score: 1
      Ask a Win32 GUI developer how scheduler work or just "what task scheduler is" and there is a fair chance that you will not get any answer.

      On the other side "Win32 GUI developer" can argue that in 98% of cases there is no need to know how exactly memory management works in the OS or what are major causes of disk fragmentation.

      Linux applications developers are somewhat better, but may be because there are significantly less of them.

      Real time embedded systems guys are best, but even them sometimes have no idea how nesting interrupts works and supported in the RTOS

    18. Re:Its crazy by Anonymous Coward · · Score: 0

      >1. mov ebx, offsetof cconst$129

      Somehow i get the feeling you know far, far less than you think...

    19. Re:Its crazy by Domstersch · · Score: 2, Insightful
      C++ is like a sharp scalpel. Yes you can hurt yourself if you're unskilled, inexperienced or sloppy.
      Java and C# are like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.
      Your analogy is quite adept, because surgeons do, often, use scissors with rounded ends. Surgical scissors come in a number of varieties, including blunt/blunt (with both points blunted), sharp/blunt (that only expose a point when opened), and sharp/sharp. If you're going to be poking around inside someone, you don't want any sharp points beyond those that are strictly necessary, and that you're using to get the job done. How this applies analogously, to programming languages, is left as an exercise to the reader.
      --
      =w=
    20. Re:Its crazy by shutdown+-p+now · · Score: 1

      I know of it, but is it usable in production environment already? I'm rather skeptical of something that comes from research.microsoft.com domain with regards to stability.

    21. Re:Its crazy by Oligonicella · · Score: 1

      "how the processor loads strings into registers"

      I know many programmers, programming in many languages that are that stupid.

      Where in Java does it teach you that strings are loaded into registers? Nowhere? My next question then is how you made the leap that it's Java's fault the guy has a 44 IQ?

      "I feel safe to say..."
      Why? You have stats to back you up, or just your prejudices?

    22. Re:Its crazy by QuantumG · · Score: 1

      That would be the last sentence where I clearly outlined that I didn't think all Java programmers were idiots and that there are probably just as many programmers of other programming languages which are just as confused. You're not being very fair.

      --
      How we know is more important than what we know.
    23. Re:Its crazy by arevos · · Score: 2, Insightful
      The "virtual machine" aspect of the Java programming environment has probably done more to harm the quality of programmers than anything else. I know java programmers who don't understand how a computer works. They ask me questions about "how the processor loads strings into registers" and such. Being able to not think about the nitty gritty of the processor you are writing your code for is great, but that doesn't justify not knowing the basics of how a processor actually works.

      You don't explain how knowing the gritty details of a computer helps a person become a better programmer. Sure, it's nice to know, and I once spent several enjoyable months getting to know the instuction set of the 68008 very well indeed, but I'm not altogether sure that experience has been particularly useful. Most of the work I do is either highly abstracted, or efficient enough without giving a thought to the processor's architecture.

      Or, to put it another way, you don't necessarily have to know how to bake clay bricks in order to become a good architect.

    24. Re:Its crazy by EnglishTim · · Score: 1

      Assembly is like a sharp scalpel. Yes you can hurt yourself if you're unskilled, inexperienced or sloppy.
      C++ is like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.


      Now, I agree the 'inneficient' comparison isn't valid, but the rest is. C# (and to a lesser extent, Java) is not so much about being easier as they are about being more productive to use. Now, I agree with Joel that you do need programmers who can happily code in C++, but there's no reason why you should neccesarily use it for your project, especially if it results in the project being completed more quickly, or with less people.

    25. Re:Its crazy by Khelder · · Score: 1

      No mod points today, so I'll comment, instead.

      I couldn't agree more. Knowing more layers of abstraction certainly helps in some domains, but it's not clear that knowing how your CPU's pipeline works will help you write better code in Java (or PHP, Python, or lots of other popular languages).

      By the argument of the GP, programmers should know how CMOS works, and be fluent in VHDL. Heck, why not know how copper, aluminum, and silicon are mined and refined, too?

    26. Re:Its crazy by Anonymous Coward · · Score: 0
      I know java programmers who don't understand how a computer works.


      Is this the fault of the language or the programmer's education?

      I'm an EE who had to learn VHDL and how to code micro-controllers (6811, PIC). I took courses in OS design and CPU architecture. I often work with CS grads and interns that don't know about file system design or VFS layers. I don't blame Java, I blame the curriculum for being inadequate.
    27. Re:Its crazy by Decaff · · Score: 1

      C++ is like a sharp scalpel. Yes you can hurt yourself if you're unskilled, inexperienced or sloppy.
      Java and C# are like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.


      This is so wrong it is hard to know where to start. (Anyway C++ is more like driving without a seatbelt - no matter how good you are you will end up getting more hurt when things go wrong sooner or later).

      Java and C# are not inefficient, and anyone who claims that they are is years out of date.

      It may be cool and nerdy to hack around with pointers and manual memory management, but in almost all cases it is totally unecessary, and to claim that it is required for performance is to seriously underestimate the power of modern VMs and garbage collection systems.

      Far from removing the need to think, languages like Java and C# allow the developer to think about what really matters - developing good algorithms, rather than having to deal with much irrelevant housekeeping. The vastly improved error handling of the languages also allows the developer to concentrate on fixing bugs, rather than trying to trace where the bugs are (I remember my days as a DOS C++ developer, when pointer errors led to a jammed PC and interesting random screen graphics). For example, developing and debugging multi-threaded applications in Java is orders of magnitude simpler than the equivalent in C++.

      And it is interesting who you consider beginners. As an example, perhaps you would like to explain to Boeing, who are are using Java for flight systems, replacing C++ and Ada, why they are 'beginners'?

    28. Re:Its crazy by kraut · · Score: 1

      > No. Tools that contain unnecessary pitfalls are flawed.
      Agreed, but having programmed in C++ for longer than I care to remember, I don't think there are as many unnecessary pitfalls in C++ as people make out. auto_ptr maybe, and a couple of other standard library bits. Most of the other potentially dangerous things are a) necessary in some contexts and b) easily avoided.

      > If the language allows people to write unsafe code, people will write unsafe code. Especially if writing safe code is harder.
      Writing unsafe C++ is quite difficult if you know some basic rules.

      > Of course, the people who write unsafe code are still to blame, but the tools are bad, too.
      Horses for courses. C++ isn't the best language for everything.

      --
      no taxation without representation!
    29. Re:Its crazy by kraut · · Score: 1

      > By your standards a 1880s Sword is more efficient for cutting up food meat than a mere fork.

      You might want to rethink that metaphor. I always find cutting my steak with a fork awfully tricky ;)

      > If they are inefficient as you claim, tell me how come we see more and more systems everyday being built on Java (esp. in Banking).
      Because they're
      a) fast enough
      b) are fashionable (or at least were)
      c) have a big pool of developers that are skilled enough.

      of course c) is a function of c)

      Lots of things drive the adoption of a technology in banking, but it's rarely technical reasons :(

      --
      no taxation without representation!
    30. Re:Its crazy by JustNiz · · Score: 1

      Err.. interestingly I am currently working on a flight system for the Airbus A400M. Its all C.

      No Boeing aren't using Java for flight systems, except on unmanned vehicles. Java won't ever be DO-178B certified so the FAA wouldn't allow it near an actual flight system.

      Software for life-critical systems must be certified before it can be used. Certification is a rigorous process, in which both the development environment and the quality of the software itself are evaluated. Aviation software, for instance, must be developed according to the DO-178B standard.

      A DO-178B compliant development process yields not only the software itself, but also a huge amount of documents in which every aspect of the software and its development is described and recorded. This makes such processes very expensive, and not everyone is prepared to follow such standards.

      Even if you produce Java software in a DO-178B compliant process, you are still dependent on a JRE whose DO-178B compliance is realistically impossible. This implies that the whole application (including your own compliant parts) is not compliant and can not be certified.

      Memory management based on garbage collection interfere with real-time requirements, so you won't find java-based flight systems.

    31. Re:Its crazy by Decaff · · Score: 1

      No Boeing aren't using Java for flight systems, except on unmanned vehicles. Java won't ever be DO-178B certified so the FAA wouldn't allow it near an actual flight system.

      Those are still flight systems. My point was not that Boeing are going to use Java for all real-time or embedded systems - it was that Java is not simply a language for beginners.

      Memory management based on garbage collection interfere with real-time requirements, so you won't find java-based flight systems.

      This isn't the case. Garbage collection in real-time Java is well-established, as in the example of PERC.

    32. Re:Its crazy by iamacat · · Score: 1

      You feeling is wrong.

    33. Re:Its crazy by Anonymous Coward · · Score: 0

      ObBash:
      I'm rather skeptical of something that comes from microsoft.com domain with regards to stability.

      There, fixed that for you. :-)

    34. Re:Its crazy by Reservoir+Penguin · · Score: 1

      Pure flamebait. Programming is a mathematical activity. Knowing useless trivia about processors is orthogonal to being a good programmer and it wont make you smarter. FYI, Logo is a variant of Lisp with some magic to get rid of parenthesis. Incedentally, you don't need to know useless shit about CPU registers in order to create absolutely beaut5iful code in Lisp.

      --
      US-UK-Israel: The real Axis of Evil
  20. Re:The biggest problem is choosing the right langu by Nicholas+Bishop · · Score: 2, Informative

    Well, one good reason to accept the possibility of segfaults is speed. C and C++ allow you to get down as close as you want to the underlying hardware, which (if the programmer is sufficiently skilled) can produce much faster code. Obviously this doesn't matter much in your average desktop software, but there are are any number of application types (3D games, simulations, animation/rendering systems, system libraries) where speed is still very much a concern.

  21. Agreed... by Bamafan77 · · Score: 4, Interesting
    Maybe it's because the average programmer is enslaved in company business. They don't have the time to create masterpieces or art in programming. Instead of that they are forced to create something adequate in a given time. Happens almost everytime, when science becomes business. I don't like that, you don't like that, no one likes that, but that's the way commercial industries are working (at the moment).
    Agreed, but the problem is complicated. Sometimes code is bad because the programmer is not very good (vast majority of cases). Other times it's bad because a good programmer wasn't given enough time to do that job. I once inhereted something where a customer wasn't happy with a product and I pulled open the hood expecting a mess. Instead what I got was extremely well documented code explaining the layout, sanely named variables, and some fairly complicated things happening in an understandable manner. The guy who I got this from was a very good programmer (heh, how often does THAT happen?!). Then it occured to me that the customer simply wanted the impossible done.

    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.

    1. Re:Agreed... by sillybilly · · Score: 1

      "Then it occured to me that the customer simply wanted the impossible done."

      Or maybe the customer just wanted a lower price, and they found you. Happens a lot.

    2. Re:Agreed... by squoozer · · Score: 3, Insightful

      Sometimes code is bad because the programmer is not very good (vast majority of cases).

      I hear this quite a bit and I think it's probably a flawed assumption or at least to simple a statement to describe the truth. The vast majority of developers can't be below average or the average would drop. What we can say is that a good portion of developers seem to have a poor grasp of basic software development skills. What we need to ask then is why.

      In my experience there seems to be far more variation in skill level between software developers than I have seen in any other profession. Perhaps this is simply because I am only familiar with software development and there is the same spectrum width in other professions as well but I somehow doubt it. I suspect, however, that software development is actually a very very hard process that only a small number of people truly have the mental discipline for. Since that number is less than the number of developers required we need to do something to make software development easier for the masses of developers. This is similar to the way cabinets were made. The master cabinet maker would produce the top and front and the less skilled (apprentice) would produce the frame (since it's easier).

      --
      I used to have a better sig but it broke.
    3. Re:Agreed... by qwijibo · · Score: 1

      How good a developer is depends entirely on their environment. For example, someone can do an excellent job in school where everyone is working on the same, well-defined problem, but do poorly in the real world where they are the only one working on the problem. Likewise, someone can do really well in a small company environment where the only metric is whether or not you get something done, and do poorly in a large company where a 2 month project would be turned into a 20 year career for 30 people, doing nothing more than having meetings, drawing diagrams and playing politics.

      In school, you get requirements from the teacher. The teacher wants you to demonstrate that you can address the problem using the tools available. In the real world, you don't get requirements, you get a wish list from a crack smoking manager. I keep hearing about people getting requirements for their development projects, but never once have seen anyone provide them. Are "requirements" a fantasy that we choose to believe in as developers?

      What separates the good from the bad in the real world isn't experience with a particular type of technology or methodology. That's what we're taught to believe, but it's just not true. The good people are the ones who can look at the pipe dream wish list and determine which parts are possible based on the skills the person has available. There may be better ways for more skilled people to solve the problem, but you don't get that choice in the real world. More importantly, you have to be objective about your own capabilities and be able to recognize those items on the wish list that you can't do or delegate to someone else in your company. By recognizing what is impractical (it would cost way too much time/money for the value it provides) and nipping that before it gets past the pipe dream stage, a lot of time is saved for everyone.

    4. Re:Agreed... by ciggieposeur · · Score: 1

      Perhaps this is simply because I am only familiar with software development and there is the same spectrum width in other professions as well but I somehow doubt it. I suspect, however, that software development is actually a very very hard process that only a small number of people truly have the mental discipline for.

      I used to think the same thing. Then I went to graduate school for engineering and learned otherwise.

      Software development is not very very hard. It is certainly not harder than designing a chemical plant, building, engine, material, etc. The truth is that the wide range in skills is present in all of the disciplines.

      ABET-certified engineering schools graduate people who are not yet fit for the job of engineering, but then they must spend years working under people who ARE fit and take batteries of tests and worthwhile experience before they become the next generation's mentors. Software development has no such process.

      The solution is to divide "programming" into three disciplines (as some schools are doing). Computer science remains the theoretical mathematical discipline for information theory. Information systems / MIS / BCIS / whatever is the broad computer applications discipline that we now call "IT". Software engineering is an ABET-certified path that people writing mission-critical software must undergo.

    5. Re:Agreed... by try_anything · · Score: 2, Insightful

      What separates the good from the bad in the real world is context. Some guys are great at setting up wikis, installing automated testing harnesses, and designing test cases. Others are good at talking to customers and managers. Others are good at debugging and profiling. Others are good at cranking out boilerplate implementations of business logic. Others are good at sitting alone in an office writing diagrams and mathematical equations, designing out redundancy. Others are good at understanding other programmers' minds and produce great APIs and documentation.

      Almost everyone is hopeless at one or two of the above, and some people are brilliant at one or two but hopeless at the rest. A guy who is brilliant at one thing is going to fail in a three-person startup where the other two people are nontechnical. Likewise, a versatile, Perl-scripting sysadmin may be a crackerjack developer for a small company, but hopelessly outclassed when placed in a specialized role in a big development group.

  22. Bjarne Stroustrup by KonoWatakushi · · Score: 0, Flamebait

    is the last person I want to hear comments from about programming languages.

    From the article: "Technology Review: Why is most software so bad?"

    Come on Bjarne, be honest. It is at least in part, because most software is written in that awful language you foisted on the world. I think the state of programming today would be vastly more advanced if C++ had given way to Objective C.

    1. Re:Bjarne Stroustrup by Anonymous Coward · · Score: 0

      On the other hand, it was us/industry that was stupid enough to take to C++ - Bjarne didn't force us.

    2. Re:Bjarne Stroustrup by metamatic · · Score: 1
      I think the state of programming today would be vastly more advanced if C++ had given way to Objective C.

      Amen to that.

      I've written applications in both, and oh how I wish Objective-C had killed C++.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  23. couldn't say "NO" to a feature by r00t · · Score: 4, Insightful

    The KISS principle is totally lost on that guy.

    The moment you have 2 people doing C++ on 1 project, at least 1 person will be faced with code written using features they just don't understand. C++ has features to spare.

    Think you know C++? No, you don't. Heck, the compiler developers are often unsure.

    This is a recipe for disaster, as we often see.

    C was hard enough. Few people truly understood all the dark corners. (sequence points, aliasing rules, etc.)

    C++ is addictive. Everybody wants one cool feature. C code is somewhat easy to convert. Soon you're using enough of C++ that you can't go back, and hey, more is better right? The next thing you know, some programmer on your team got the wise-ass idea to use Boost lambda functions (for no good reason) and you find yourself with 14 different string classes and... you have a mess that no one single developer can fully deal with.

    1. Re:couldn't say "NO" to a feature by Rakshasa+Taisab · · Score: 1

      Sounds like you got some idiot programmers/managers, why are you blaming C++?

      --
      - These characters were randomly selected.
    2. Re:couldn't say "NO" to a feature by r00t · · Score: 1

      Sounds like you haven't worked in the industry very much.

      Perhaps you've been lucky enough to get away with BEING the wise-ass who writes fucked up code that relies on obscure stuff that nobody else knows. In that case, soon you'll meet another like yourself, only using a different set of obscure stuff.

    3. Re:couldn't say "NO" to a feature by Kupek · · Score: 1

      Bull. In The Design and Evolution of C++, Stroustrup clearly lays out how he decided which features should be included. He was sensitive to feature creep, and rejected far more ideas than he accepted. Ideas he did accept had to be useful to a majority of programmers, feasible to implement and feasible to teach.

      And frankly, C is not hard if you have enough understanding of a computer. It is widely considered a small language that does its intended job well.

    4. Re:couldn't say "NO" to a feature by r00t · · Score: 1

      That Stroustrap should even need to defend against this accusation is telling, no?

      Do YOU know C?

      Is assignment ("=") a sequence point? How about the double-ampersand? How about brackets? How about a cast? How about the parentheses for function calls? How about the comma operator? How about the tertiary operator? (Can you even explain what a sequence point is?)

      Does "a = a++;" violate any rules? Does "a = a++ + a++" violate any rules? How about if those examples used "++a" instead of "a++"?

      On a machine with sizeof(float)==sizeof(int), suppose you: take the address of a float, cast from float* to int*, then assign the result of (de)referencing the int* to an int. Where exactly have you violated the C standard? Assuming normal x86 hardware, what is the worst that could happen? Will such code always ensure that the bits of the float end up in the int?

      This is all without getting into sick stuff like putchar(3["Holy crap"]) and trigraphs. On the off chance that maybe you really do understand C... congratulations for that, but shame on you for failing to notice that damn near everyone else is just throwing shit at the compiler until the error messages go away and then blindly poking around (perhaps with a debugger) until the compiler spits out something that mostly seems to run sort of OK.

    5. Re:couldn't say "NO" to a feature by shplorb · · Score: 1

      The next thing you know, some programmer on your team got the wise-ass idea to use Boost lambda functions (for no good reason) and you find yourself with 14 different string classes and... you have a mess that no one single developer can fully deal with.

      Which is why the Lead Programmer lays down the rules then fires anyone who decides to pull brain-dead shit like that. If you don't have a Lead Programmer then you really shouldn't have more than two people working on the project.

    6. Re:couldn't say "NO" to a feature by Kupek · · Score: 1

      No, I don't think it's telling that Stroustrup finds it useful to explain how he decided what did and did not get into the language. The mere fact that people shout about something doesn't mean that they have a valid complaint.

      As far as C goes, yes, you can write obtuse code with non-obvious semantics. But that's true of any useful language. Much of what you blame on C is a result of the fact that it's basically a high level assembler. The fact that manipulating hardware can be confusing is not the fault of C.

    7. Re:couldn't say "NO" to a feature by TonyTech · · Score: 1

      The moment you have 2 people doing C++ on 1 project, at least 1 person will be faced with code written using features they just don't understand. C++ has features to spare.

      That's not a language problem. It's a problem of software development project management. You're supposed to have things like a coding standard (ever heard of that?) and able architects/designers. Anyone who accepts any and all C++ mechanisms in a project is asking for trouble. Anyone who runs a project like that is inexperienced and unqualified. (Just think of all the "stupid template tricks" that are possible with C++ and you'll soon realize that you can't give that much space for developers to create in. You have to define some boundaries such as, "Template use will be restricted to using only the STL containers/iterators/algorithms in the simplest of ways. Stupid template tricks will not be tolerated".)

  24. Re:The biggest problem is choosing the right langu by Coryoth · · Score: 1
    Well, one good reason to accept the possibility of segfaults is speed.

    It is possible to get similar speed and memory efficiency without giving up safety:
    Ada vs. C++
    D vs. C++
    Eiffel vs. C++
    OCaml vs. C++

    (and just for comparison)

    Java vs. C++
  25. Surgeons don't use scissors, tailors do by coder111 · · Score: 3, Insightful

    Of course surgeons don't use plastic scissors. But how often do you need a surgeon? Most of the time you need a cheap tailor to make you a suit. And that's when scissors come in handy.

    C++ can do wonders when used by highly experienced people. But most of the time, it is more cost effective to get entry level coders and use PHP/Java/C#/whatever. You will get a (somewhat) working product cheaper and possibly faster. And time to market and cost is often more important than maintainability/quality.

    And don't get me started on 3rd party C++ libraries. You'll need tons of them to move a finger, and you'll spend more time finding/eavluating libraries than coding. This problem is getting worse for other languages too...

    --Coder

    1. Re:Surgeons don't use scissors, tailors do by JustNiz · · Score: 1

      >> Of course surgeons don't use plastic scissors. But how often do you need a surgeon?

      OK you're taking my broken analogy out of context :-)

      What I rweally mean is that presuming you're developing software, its always better to have a good software engineer than a mediocre one, which is what java/C# allow people to get away with being.

      >> And don't get me started on 3rd party C++ libraries. You'll need tons of them to move a finger,

      Huh what? I never use 3rd party libraries and I've been developing software in C++ for about 15 years. OK I don't do any gui code, and like any other good sw engineer I have built up my own code base of reusable items, but that just comes for free if you do good abstraction anyway.

    2. Re:Surgeons don't use scissors, tailors do by misleb · · Score: 1
      C++ can do wonders when used by highly experienced people. But most of the time, it is more cost effective to get entry level coders and use PHP/Java/C#/whatever. You will get a (somewhat) working product cheaper and possibly faster. And time to market and cost is often more important than maintainability/quality.


      I'm sorry, but this is a ridiculous false dichotomy. You put C++ geniuses on one end and entry level PHP/Java/C# programmers on the other. As if you can't have Java/C#/whatever programmers who are really good at their job and produce high quality results. You imply that all projects would ideally be done in C++, which is just stupid.

      -matthew
      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    3. Re:Surgeons don't use scissors, tailors do by sillybilly · · Score: 1

      As long as we are talking about plastic scissors with rounded tips that are child safe, what about VB classic, or even shell scripts? C++, C#, Java don't really feel like plastic scissors, nor surgeon's knives.

  26. Stroustrup is the problem by Animats · · Score: 2, Insightful

    The problem with C++ is Stroustrup. Specifically, it's that, as what's now called "C++0x", the next revision, got underway, Strostrup insisted that C++ had no major problems - it just needed some cleanup. This was after a decade of trouble with buffer overflows and related safety issues.

    C++ is unique in that it has hiding without safety. No other major language is in that space. C has neither hiding nor safety; Java has hiding with safety, as do almost all languages which postdate C++. This is not fundamental to a compiled language; Modula 2 and 3, and Ada, had hiding with safety. Nor is it related to garbage collection, inherent problems of an efficient, compiled language, or the needs of systems programming. Providing backwards compatibility with C while bolting objects onto the language led to safety issues that were never overcome.

    Most of the problems with C stem from the "pointer equals array" model, the basic source of buffer overflow bugs. C doesn't even have a way to talk about the size of array arguments (well, C99 does). Dangling pointers are also a problem but a secondary one. C++ tries to paper this problem over with collections, but far too often, collections have to expose a C pointer to get something done. At that point, size information is lost. Right there is the biggest single problem with C and C++.

    The C++ revision committee is dominated by people who want to do l33t things with templates, things nobody will ever do in production code but, they think, are really cool. There's a whole "generic programming" cult of abusing the template mechanism to do computation at compile time. Millions of users suffer from unnecessary program crashes, and the US is more vulnerable to malware and cyber-terrorism because of this focus. It's as if the IEEE committee on power transmission standards was dominated by people who were into making big sparks.

    Stroustrup could have insisted on actually fixing the safety problems. But he didn't.

    (I'm writing this as someone with over ten years of experience in C++, doing everything from protocol stacks to game physics engines to real-time programming. And after ten years, I'm fed up with the mess. This should have been fixed years ago.)

    1. Re:Stroustrup is the problem by freedom_india · · Score: 1

      I wish i had Mod Points Now. Would have modded you as Insightful AND Interesting AND Informative. (yeah i know slashdot doesn't allow that, but your succint writing says it all).

      --
      "Doing what i can, with what i have." ~ Burt Gummer
    2. Re:Stroustrup is the problem by shutdown+-p+now · · Score: 3, Insightful

      Sounds like what you want is simply not what C++ designed to deliver. Blame yourself for not choosing the right tool, not the tool itself.

    3. Re:Stroustrup is the problem by pherthyl · · Score: 2, Interesting

      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.

    4. Re:Stroustrup is the problem by luzr · · Score: 2, Interesting

      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.

    5. Re:Stroustrup is the problem by Richard+W.M.+Jones · · Score: 1

      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!".

      OCaml gets within a few percentage points of the performance of C/C++, without any of the associated problems.

      In some cases it's faster and the code is smaller.

      Rich.

    6. Re:Stroustrup is the problem by Geoffreyerffoeg · · Score: 1

      Don't use the ugly parts of boost if you don't want

      I think GP's pointing out that the authors of the ugly parts of Boost are a significant part of the C++0x committee.

    7. Re:Stroustrup is the problem by master_p · · Score: 1

      Perhaps then it is time to sign this petition for adding garbage collection to C++...

    8. Re:Stroustrup is the problem by Phatmanotoo · · Score: 1

      I wish the mod system could go over 5 because the parent post is +20 Insightful++.

      Sometimes I think that if people in other engineering disciplines could understand what's been going on in the computing business, then they would desperately cry and ask for prosecution. At least the people who designed and the industries who pushed these broken languages/libraries should be indicted for careless negligence (or whatever the legal term for this is).

    9. Re:Stroustrup is the problem by ivec · · Score: 2, Informative

      Stroustrup insisted that C++ had no major problems - it just needed some cleanup. Lame FUD. Can you provide a reference that supports this fallacious statement?

      My recollection is that Stroustrup was:

      • encouraging library extensions rather than language extensions, acknowledging that the language was already complex enough as it is
      • encouraging language changes/extensions only where they make C++ easier to learn and understand
      Specifically, you may want to check http://www.artima.com/cppsource/cpp0x.html
      Short of dropping backwards-compatibility with the current code base, what kind of language changes would you like to see?

      C++ is unique in that it has hiding without safety. Noting in the C++ standard requires the language to be "unsafe".

      If you look at standard C++ library implementations, for example, some are currently providing ubiquitous range-checking (within the library). Compliers have started to provide built-in checks for buffer overruns. You can integrate a garbage collectors as add-on (personally I much prefer RAII). And C++ could be compiled to a virtual machine.
      But the standard does not mandate any of the above, because it does not want to preclude the use of C++ for system programming.
      And it also just seems that the community of C++ users still remain more interested in the latest optimizing compilers and auto-vectorization capabilities, than in the safety-enhancing features.

    10. Re:Stroustrup is the problem by hardcampa · · Score: 0

      Can someone explain what why the stupid post above got modded insightful. The guy OBVIOUSLY doesn't know C++.

    11. Re:Stroustrup is the problem by luzr · · Score: 1
      Very stupid idea. If you want GC, why you do not use C# or Java?

      You absolutely do not need GC in C++.

      Using the right style and library, you can avoid all problems with resource management, without using GC or "smart" reference counting and create clean and easy to maintain code faster than in Python.

      See: http://www.ultimatepp.org/www$uppweb$overview$en-u s.html
      (Disclaimer: I am biased member of team).

      (Unfortunately, there is too many "experts" in the field to get such simple solution of the problem of "programming" widely accepted fast :)

    12. Re:Stroustrup is the problem by RAMMS+EIN · · Score: 1

      I completely agree with you. Just out of curiosity: if you're a C++ programmer, but don't like the way C++ is developing, and would like safety concerns to be addressed, what about C#? (Sorry if that question isn't as clear as it could be)

      --
      Please correct me if I got my facts wrong.
    13. Re:Stroustrup is the problem by ville · · Score: 1
      Interfacing with some library with a C interface often requires passing out pointer to the first element of an std::vector.

      // ville

    14. Re:Stroustrup is the problem by Rufty · · Score: 2, Interesting

      Objective C ???

      --
      Red to red, black to black. Switch it on, but stand well back.
    15. Re:Stroustrup is the problem by pjabardo · · Score: 1

      So, now, Stroustrup should be sent to Guantanamo because he helps terrorists? Try being a little bit serious!

      Most crashes happen because they use boost-style libraries? Try using it a little. Are there problems? Of course but they do provide a much safer environment with adequate abstraction than C.

      I write scientific applications that takes days to process and I find it very pleasing to use abstractions on things like matrices. Hell, I can even ensure that array limits are respected during development phase and I have ready access to great libraries like blas and lapack without any overhead and any trouble.

    16. Re:Stroustrup is the problem by frantzdb · · Score: 1
      The C++ revision committee is dominated by people who want to do l33t things with templates, things nobody will ever do in production code but, they think, are really cool. There's a whole "generic programming" cult of abusing the template mechanism to do computation at compile time.

      You are confusing generic programming with template metaprogramming. Both do l33t thing with templates. Template metaprogramming involves compile-time computation. It has many uses, some more dubious than others.

      Generic programming is about writing data structures and alorithms in such a way that you don't need to write them again later. For example, the STL provides std::max_element which solves the problem of finding the maximum element (or other extremal element based on some other binary comparison) in any collection of things, be it a C-style array, a linked list, or some other structure. The same has also been done for algorithms such as sort and Dijkstra shortest paths. The one major problem with the STL doesn't have to do with generic programming at all. It is that template errors in C++ are very very ugly. This is a known issue and is getting attention.
    17. Re:Stroustrup is the problem by rp · · Score: 1

      It has been fixed, of course, but you may have missed the solutions, which (apart from template-based programming) aren't called C++.

    18. Re:Stroustrup is the problem by cortana · · Score: 2, Informative

      CFLAGS += -lgc

    19. Re:Stroustrup is the problem by novitk · · Score: 1

      ML (or Haskell, Lisp, etc) for that matter would never be popular. They've had enough time and failed to gain popularity. The reason is simple - they dump too much on a poor brain of an average coder, who gets lost too fast to keep interest. The way forward is to get something well-understood and Algol/C-like and extend it into the right direction incorporating ideas from functional world. A good examples of this approach are C# 3.0 and Nemerle.

    20. Re:Stroustrup is the problem by Kupek · · Score: 1

      One of the design goals of C++ was to add OO capabilities to C without adding any execution or space overhead. Fixing the "safety problem," as you call it, would involve an increase in execution time. When what you want conflicts with one of the design goals, then you're probably using the wrong tool.

    21. Re:Stroustrup is the problem by Animats · · Score: 1

      C# isn't bad as a language, but it's Microsoft-only and too closely tied to Microsoft's run-time environment, which is too limiting.

    22. Re:Stroustrup is the problem by asuffield · · Score: 0, Troll
      Most of the problems with C stem from the "pointer equals array" model, the basic source of buffer overflow bugs.


      Most of the reasons for using C also stem from this model. If C/C++ did not exist, we would have to invent (at least one of) them.

      People keep using C because nothing else really gets the job done as well. No amount of complaining about this is going to change it. Whoever you are, whatever your ideas are, they are not a viable solution in the real world - the proof of this is that we're still using C for a wide range of tasks. If your idea actually worked, we'd be using that instead. Plenty of people would like to be able to replace C.

      Go think of a better idea.
    23. Re:Stroustrup is the problem by RAMMS+EIN · · Score: 1

      ``C# isn't bad as a language, but it's Microsoft-only and too closely tied to Microsoft's run-time environment, which is too limiting.''

      Is it really? I was under the impression that C# was an ECMA standard and had a number of non-Microsoft implementations.

      --
      Please correct me if I got my facts wrong.
    24. Re:Stroustrup is the problem by frantzdb · · Score: 2, Insightful

      Until recently, I thought the STL was just a "container library" too. Then I was introduced to the many useful algorithms it includes. An interesting read is Stepanov's Notes on Programming which describes some of the design decisions behind the STL and how it relates to generic programming. There are imperfections, but overall it is a very powerful library and is certainly not just containers - those are just the obvious part.

    25. Re:Stroustrup is the problem by Abcd1234 · · Score: 1

      I gotta second this. It combines the beauty of Smalltalk's object model (late binding, extensive use of introspection, etc) and syntax (*simple*) with the speed of C. Far better than the monstrosity that is C++.

    26. Re:Stroustrup is the problem by kraut · · Score: 1

      > Noting in the C++ standard requires the language to be "unsafe".

      Apart from the inclusion of the C standard library ;)

      > And it also just seems that the community of C++ users still remain more interested in the latest optimizing compilers and auto-vectorization capabilities, than in the safety-enhancing features.
      That's because the C++ community is slowly shrinking back to its core subset - people who need to write largescale, efficient and maintainable systems, and are willing to understand their tool properly. At least I hope so.

      C++ has mainly been a victim of its own success: It isn't the perfect tool for writing every little corporate desktop application. But for a while every system was written in C++, whether the system or the people were suitable or not. Hence we're stuck with a lot of bad systems written by bad C++ programmers who dislike the language.

      --
      no taxation without representation!
    27. Re:Stroustrup is the problem by luzr · · Score: 1

      Ah, of course it is about algorithms as well, but STL simply fails to solve the basic problem - storing data. No algorithm will help you if you cannot store the data directly. Therefore you must store the pointer to data, with all troubles that it involves... That is why we have people wanting GC in C++ and other people trying to invent yet another kind of smart pointer... Moreover, those algorithms are not as generic as they seem. E.g. std::list still needs its own sort etc...

    28. Re:Stroustrup is the problem by pbaer · · Score: 3, Informative

      There's actually a language called D that is related to C++ and is supposed to fixe a lot of C++'s problems, and annoying syntax. Features.

      --
      There are 11 types of people, those who know unary and those who don't.
    29. Re:Stroustrup is the problem by vidarh · · Score: 1
      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).

      Of course it can store objects. What are you on about? Perhaps your misunderstanding is because STL requires objects to be copyable to store them? I store objects in STL containers all the time. It's very hard to take your criticism seriously if you don't even know a fundamental thing like that.

    30. Re:Stroustrup is the problem by luzr · · Score: 1

      Not many objects are copyable. It is hard to discuss if you have not noticed this simple fact :)

    31. Re:Stroustrup is the problem by master_p · · Score: 1

      You did not have to write the disclaimer, I know you: you have been promoting ultimatepp on almost every board on the planet.

      What you do not realize is that the model of execution of C++ makes it superior to C# and Java...it allows for customization of hot spots in far greater capacity than what C# and Java allows.

      Stack allocation, RAII, no VM start up time, direct interfacing with C, etc, make C++ a superior language.

      I have evaluated ultimatepp for our projects and although it has some good ideas, ultimately it has some serious flaws as well.

    32. Re:Stroustrup is the problem by luzr · · Score: 1

      What to say? I have to agree with all points, except the last one ;) Maybe you have not noticed, but U++ is C++ platform. And I have noticed that model of execution of C++ is superior. That is one of reason we are using C++, is not it? What most people have not noticed is fact that C++ can be used in a way that makes it superior even in productivity. That is what U++ is about.

    33. Re:Stroustrup is the problem by frantzdb · · Score: 1

      True. Although that's why the standard is getting shared_ptr and why Boost has pointer containers. It's not perfect, but the STL's philosophy of "make it as generic as possible but not without sacrificing performance" is a restriction. Once you are talking about polymorphic objects, then performance is probably not of as much concern.

    34. Re:Stroustrup is the problem by luzr · · Score: 1

      'shared_ptr' is all about sacrificing performance (and productivity). 'Pointer containers' is really the way to go, but too little too late. Mirek

    35. Re:Stroustrup is the problem by Anonymous Coward · · Score: 0

      Did you ever consider possibility that maybe you're just not a good C++ programmer?

      - Dave

    36. Re:Stroustrup is the problem by Animats · · Score: 1

      Both of those compilers are relatively simple ones that generate byte codes for a .NET run time system. They aren't hard-code optimizing compilers. So they're not the tool of choice if you're doing number-crunching, real-time work, or operating system internals.

      This isn't a language issue. There's at least one implementation of Java that generates machine instructions directly.

    37. Re:Stroustrup is the problem by vidarh · · Score: 1
      Really. Almost all objects I work with are copyable. Perhaps because I 1) know how to use smart pointers that have sane copying behaviour when I need to, 2) know how to write copy constructors when I need to.

      It's hard to discuss C++ with you when you obviously don't know the language.

    38. Re:Stroustrup is the problem by luzr · · Score: 1
      Have you noticed the performance impact?

      Do you think std::vector > is easier to use and maintain than std::vector?

    39. Re:Stroustrup is the problem by vidarh · · Score: 1
      Have you noticed the performance impact?

      The performance impact over what? There is NO performance impact in adding copy constructors unless you use them, and if you use them there will be no more performance impact over doing it in the copy constructor than over copying your objects in other ways, assuming you don't aim to write your copy constructors in brain-dead ways and use a compiler that will inline when it can.

      In most cases using std::vector is not much slower than using a native array, assuming you know how and when to set the capacity, and use a compiler that isn't so ancient that it doesn't do any reasonable level of optimizations. Do you think std::vector > is easier to use and maintain than std::vector?

      Slashdot ate parts of your text... You need to escape your less than and greater than.

    40. Re:Stroustrup is the problem by luzr · · Score: 1
      The performance impact over what?

      Of std::vector > over

      std::vector<Object *>

      with manual deletes.

      Slashdot ate parts of your text... Yes, sorry,

      std::vector< shared_ptr<Object> >

      vs.

      std::vector<Object>
      .

      I have to learn to use preview...

    41. Re:Stroustrup is the problem by vidarh · · Score: 1
      Of std::vector<Object> over std::vector>Object *> with manual deletes.

      Your point being? STL has absolutely nothing to do with this - the performance impact in this case more or less the same as if you use a plain old array to do the same things, and is a trade off between the size and copy cost of the object in question vs. the convenience of storing the object instead of a pointer.

      In C++ you have the choice. In for example Java you don't (you always store the pointer - as much as Java tries to pretend it's "pointer free" - unless the implementation happens to do otherwise behind your back). As a result, in C++ you have the tool to shoot yourself in the foot, but you also have the ability to pick a more efficient alternative depending on what is appropriate (and whether you want copy or reference semantics).

      std::vector< shared_ptr<Object> > vs. std::vector<Object>

      Again, this has nothing to do with the STL containers, and everything to do with your choice of what to put in it. In this case, of course there will be a difference, since one is storing a pointer and a reference count and the other is storing a copy of the object. Which is faster depends on your compiler and the size of the object and the shared_ptr implementation you are using. The only thing this shows is the flexibility you have when you get to pick different semantics by providing different typed arguments.

      Frankly, to me it sounds like you're expecting Java when you are programming C++. If you are more comfortable with how Java works, then use Java. Personally I'd pick C++ (over Java) any day, but these days I prefer Ruby despite far worse performance. It just doesn't matter most of the time.

    42. Re:Stroustrup is the problem by luzr · · Score: 1
      You are missing the point. You can have container library in C++ that allows storing objects directly. Technically, it is simple. Even boost has one (see ptr_vector etc...). The problem of STL is value semantics. Problem of C++ is STL.

      Personally, you pick Ruby. Personally, I still pick C++ *for productivity reasons* (despite superior performance :-).

    43. Re:Stroustrup is the problem by vidarh · · Score: 1
      You are missing the point. You can have container library in C++ that allows storing objects directly. Technically, it is simple.

      No, you are missing the point. We do have a container library in C++ that allows storing objects directly: STL.

      Boost's "ptr_vector" does NOT "store objects directly" - it stores pointers to objects, hence the name. ptr_vector etc. has VERY different semantics, and is appropriate for completely different purposes than std::vector. If ptr_vector satisfies your needs, then fine, but then I don't get why you keep whining about STL - it's not meant to cover every need you might ever have, just to cover a set of the most important basics. If you need more, then there's plenty of sources of alternatives, like boost. Again, it sounds like you want to get C++ to be Java.

      Personally I've never had a reason to consider ptr_vector, as it is very rarely that I want heap allocated objects that mainly have a lifetime that coincides with a vector and where I've needed value semantics, and when I do it's mostly been objects that are suitable to store by value, and ptr_vector comes with a cost: You are forced to pay for the memory allocation of every object separately regardless what you do, which is often not acceptable when you want to store small objects (depending on OS you typically get an overhead of between 12 and 20 bytes for every single allocation).

      When I do use C++, it's when those things matters.

    44. Re:Stroustrup is the problem by luzr · · Score: 1

      Well, there are many things you got wrong (e.g. ptr_vector exposes objects, not pointers, memory allocation can have zero overhead, at least in U++ it has, etc...), but this is a little bit dead thread. I welcome you to discuss this issue in this somewhat related thread: http://www.ultimatepp.org/forum/index.php?t=msg&th =1738&start=0&S=a60a17415da420a4cd756711de199c23 Mirek

    45. Re:Stroustrup is the problem by TonyTech · · Score: 1

      The C++ revision committee is dominated by people who want to do l33t things with templates, things nobody will ever do in production code but, they think, are really cool. There's a whole "generic programming" cult of abusing the template mechanism to do computation at compile time.

      I agree whole heartedly. The C++ generics paradigm gets way too much verbage and I can't help but think that those on that bandwagon are just purposely trying to sell complexity (or just techies who like to tinker with technology for technology sake and don't have a clue about anything "big picture" or "outside of the box"). I'd rather have C++ devoid of special template machinery and in its place have a better preprocessor. If it takes more than the automation of simple text replacement like a preprocessor macro would do, I would (and do) opt out of such monstrosity. Project managers get your projects back on track and improve quality: restrict developers from doing "stupid template tricks".

      The second thing about C++ paradigm extremists/purists have a ball ranting about is type safety. I'm convinced that a well placed void* ptr and a little casting is better than the extreme practice/view. Used with care, source code can be more readable and maintainable and all that bulldozer-grade template machinery becomes unnecessary. C and C++ are "close to the hardware" afterall and exposed pointers are what that means. It's probably true that if you can't write a memory management library, than C++ is too advanced of a tool for you as hardly any library tries to abstract one away from that _power_/_feature_ (Java is perhaps at that higher level of abstraction).

      Personally, I think the compiler vendors like that it requires man years of effort to comply with the unnecessarily complex C++ standard, as it locks out a number of potential competitors, and the do-it-yourselfer is probably the competitor they are most afraid of. Is the complexity of C++ by design? Who's on that committee anyway? Compiler vendors and "language lawyers" mostly I'll bet.

  27. Re:The biggest problem is choosing the right langu by EvanED · · Score: 1

    Sounds like Lisp to me.... It's a mystery to me why anyone would voluntarily program in a language that makes the things that should be easy difficult, and makes things like segfaults, which should be pretty darn hard to do, easy enough to accomplish by accident. Yet so many people do it.

    To at least a large extent, probably inertia. People know imperative languages, they know "traditional" ALGOL derivatives, so that's what they use, either because they don't see the grass on the other side is greener or because they decide that they don't have time to make it to the bridge and across it before running out of food, because while there is grass where you are, there's nothing until the other side of the bridge if you go for it. (Okay, that analogy got really unwieldy quickly, but I think there's something to it.)

    For instance, the ML compiler is written in ML. Do I have any flipping clue at all how you would write a piece of software anywhere near as complex as the ML compiler with ML? Heck no! At least not well at all. If I were to attempt it, I'd end up with ! and ref everywhere because I don't know how to do it any better. I don't know how you would really take advantage of the fact that ML provides first-class functions or stuff like that. Sure, I can write little toy programs in ML, but nothing of that scale. Lisp is even worse; I don't have ANY clue how to go about it there. But could I write an ML compiler in C++? I think I could. It'd take me a while, and I couldn't guarantee performance, but I think I would wind up with something reasonable.

    (BTW, in case you can't really tell, I'm sorta in the second group in the analogy. I think Lisp holds at least a lot of promise for helping development (though I'm not totally convinced), it's just that I don't have time to learn not only a new language but in some sense a new paradigm right now.)

  28. There's only one real problem: lack of talent by CPE1704TKS · · Score: 4, Insightful

    The problem with programming is that too many people that lack the talent are in the programming business. I know because I work with many of them. They are not detail oriented, they don't think strategically, long term, etc and just make a mess of code. They only want to fix the problem they need to fix without worrying about the effect it will have on the system, etc. This is what causes bad programs. Programming is easy enough that any moron can make something work, but to make something continue to work requires an engineering understanding, and this is something most people don't have. It's unfortunate.

    1. Re:There's only one real problem: lack of talent by tilde_e · · Score: 1

      I work with a Java developer (moron) like you describe. Whenever he comes upon a NullPointerException, he adds a nice little if (object != null) block around the code that hit the exception and calls it a day.

    2. Re:There's only one real problem: lack of talent by Anonymous Coward · · Score: 0

      If everything you do is well within the grasp of you and your tools, I suggest you stretch yourself a bit. Much language research is done by people who found hard enough problems that they needed better tools. Stroustrup himself was inspired by his failure to complete a distributed systems simulation in Simula -- it was too slow to generate useful data, so he had to rewrite it in BCPL, a language even more primitive than C. He realized that the system could not have been developed in BCPL, nor implemented in Simula, so neither tool was suitable for the task, even when coupled to his extremely impressive brain. Many years later, C++ was born.

      You really have to fail before you can do anything creative.

    3. Re:There's only one real problem: lack of talent by Scrameustache · · Score: 1

      As with all artistic endeavours, it's 10% talent, 90% effort.

      Of course, if you don't have talent, all your efforts will never give you better than 90%, but talent isn't enough.

      --

      You can't take the sky from me...

  29. The tired story... by Anonymous Coward · · Score: 0

    Every time one of these articles come around the self-proclaimed experts who have completed no project bigger than their fucking graduation requirements break out their worn soap box and lament about the poor coders produced by the University system. Universities don't 'make' good engineers or scientists. If it is a good University it will provide the resources and direction to succeed at these endeavors if you're sufficiently motivated. And nobody can reasonably ask for more than that.

  30. Link to the interview by dr_d_19 · · Score: 1

    ...Here! :)

  31. Re:The biggest problem is choosing the right langu by Nicholas+Bishop · · Score: 1

    Those benchmarks look fairly artificial. I'm not sure it makes sense to generalize such results up to an entire application.

  32. Re:The biggest problem is choosing the right langu by QuantumG · · Score: 1

    Meh. There's absolutely no reason why a compiler couldn't put a check for NULL on every pointer dereference and throw a NullPointerException these days. We're talking one or two machine instructions here. Modern cpu-based branch prediction can easily make this essentially free. Is there a single C++ compiler out there that does it? Even as a compiler-specific extension? Not that I'm aware of (please, correct me if I'm wrong). Even if it was only for debug builds this would be beneficial, it's where 99% of segfaults come from in C++ code and it is what results in C++ code being so damn crusty:


    Foo *f = somefunc();
    if (f) {
          f->blah();
    }


    is just pointless. somefunc should never return NULL. I should never have to check for it. But that's my opinion, I don't wanna get into a whole "exceptions are for exceptional circumstances, not errors" argument.

    --
    How we know is more important than what we know.
  33. please stop him! by Anonymous Coward · · Score: 1, Funny

    If Bjarne rewrites the C++ I/O libraries one more time I'm going to hunt him down like a job and stick my C++ Reference Collection (with bookends) up his ass.

    Some of us have real work to do, you know...

  34. Thanks, Bjarne by Anonymous Coward · · Score: 0
    I couldn't point to a specific language feature and say, "See, there's the influence of the nineteenth-century philosopher," but he is one of the roots of my reluctance to eliminate "expert level" features, to abolish "misuses," and to limit features to support only uses that I know to be useful. I'm not particularly fond of Kierkegaard's religious philosophy, though.

    And for that, I thank you. One of the things I love about C++ is one of the very things many people complain about--the freedom to create damn near any data structure in completely unique and novel ways. This freedom, however, is born out of complexity, and yet, that complexity isn't a major performance bottleneck or resource hog.

    Posted anonymously because I already modded here.
    1. Re:Thanks, Bjarne by Vexorian · · Score: 1

      Some could argue that freedom is dangerous, should we exchange freedom for security or commodity? I would never do such a trade

      C++ is a flexible language and when used correctly can seriously be versatile, seriously.

      Stroustrup gets it right also, sometimes the libraries are the issue. Firefox is a sample for code mess but if you made a similar project in wxwidgets or QT you would notice some of the cleanest code.

      --

      Copyright infringement is "piracy" in the same way DRM is "consumer rape"
  35. Irony by Anonymous Coward · · Score: 2, Insightful

    C++ is unique in that it has hiding without safety.

    The C++ revision committee is dominated by people who want to do l33t things with templates, things nobody will ever do in production code but, they think, are really cool. On the one hand you criticize c++ for "hiding without safety", in the same post you criticize the c++ revision committee for doing "l33t stuff with templates". l33t stuff with template allows efficient containers which largely alleviate the problems with pointers in c++.

    Stroustrup could have insisted on actually fixing the safety problems. But he didn't. How would you "fix" it, without losing its efficiency? I write image compositing software, when I want to write UI code I use python but when I write image processing code I use C++, I want to be able to access raw memory (abstracted trough a "l33t" template interface of course ;) ). Any changes to C++ would have to accommodate this type of valid use.
    1. Re:Irony by Anonymous Coward · · Score: 0

      Use C code for the image processing parts. Use java swing or PyGTK for the GUIs.

      There's no place for C++ in this world.

    2. Re:Irony by Anonymous Coward · · Score: 0

      Why would I use C? How is C better than C++ for this application?

      C++ allows for things like this : :http://opensource.adobe.com/gil/

      Through the use of templates, this library allows you to write an algorithm once, but that will generate optimized assembly code for a many pixel types/channel configs. (float, char etc.)

      How would you do that in C?

    3. Re:Irony by Oligonicella · · Score: 1

      'How would you "fix" it, without losing its efficiency?'

      You don't. But you reduce the maintenance portion of the software lifetime which greatly outweighs the developmental time. You also reduce the bug and attack points.

      Everyone touts the increase in processor speed (what with our processors sitting, twiddling their thumbs just waiting for something to do) and no one wants to use that for safety purposes. Stupid.

    4. Re:Irony by Anonymous Coward · · Score: 0

      You don't. But you reduce the maintenance portion of the software lifetime which greatly outweighs the developmental time. You also reduce the bug and attack points. Again what specifically that would you do that would address this but still allow low level access so that people had access to raw memory if they wanted?

      Everyone touts the increase in processor speed (what with our processors sitting, twiddling their thumbs just waiting for something to do) and no one wants to use that for safety purposes. Stupid. I completely agree, but I think this is caused C++ being used in the wrong places. Don't cripple C++ because people are using it incorrectly.
  36. He is too logical and mathematical by eat+bugs · · Score: 1

    That just makes things too hard.

  37. Re:The biggest problem is choosing the right langu by Anonymous Coward · · Score: 0

    There's absolutely no reason why a compiler couldn't put a check for NULL on every pointer dereference and throw a NullPointerException these days Visual studio does : :http://www.deez.info/sengelha/blog/2006/01/30/c-e xception-handling/

    This doesn't help much, either way the program will probably have to close, I suppose catching the exception means it exits a little more gracefully.

    Even if it was only for debug builds this would be beneficial, it's where 99% of segfaults come from in C++ code and it is what results in C++ code being so damn crusty: Both gdb and visual studio catch dereferenced pointers in debug builds and provide a stack trace.
  38. False Dichotomies by RAMMS+EIN · · Score: 1

    I found this particular sentence very insightful:

    ``These dichotomies (between efficiency versus correctness, efficiency versus programmer time, efficiency versus high-level, et cetera.) are bogus.''

    I don't believe C++ gets it completely right, but it's certainly true that some languages let you write code that is succinct, elegant, correct, and efficient. I think it all depends on offering the right primitives, powerful enough abstraction methods, and a good optimizing compiler.

    --
    Please correct me if I got my facts wrong.
  39. Re:The biggest problem is choosing the right langu by QuantumG · · Score: 1

    Unfortunately it's not a named exception that visual studio throws, so you can only catch "all exceptions" and try to figure out what exactly happened. As long as you can get a stacktrace though, that's the important thing. I've had dozens of segvs that obliterate the stack.. that's just crazy.

    --
    How we know is more important than what we know.
  40. Re:He summarizes one of the big issues in SD now.. by misleb · · Score: 2, Insightful
    There ya go! Time pressures and price are fundamentally incompatable with code quality, even amongst the best programmers. Ergo, great programming is incompatible with most business models (i.e., most businesses don't have the money to make the software they want at the quality they want). It's sort of like wanting a Ferrari, but only having enough money to buy Gremlin. Sadly, many (most?) programming projects are nothing more than an arms race between getting something out the door that hangs together reasonably well and the bottom of the client's bank accounts.


    Ok, then please explain why Open Source projects are full of flaws just like commercial products. Are all the geniuses exclusively employed by companies that stifle greatness and everyone else is doing Open Source? Please. Programming greatness is rarely achieved... anywhere. The problem developing for profit is that you need a product to profit from. That means you have to ship something that is imperfect just to stay in business and make a living. The problem developing on your own for free is, again, that you need to make a living and really don't have the kind of time to produce greatness (assuming your are capable). Either way, it comes down to resources. One can rarely get enough outside of work and one can rarely get enough AT work. Same problem. Business drives development just as much as it stifles it.

    -matthew
    --
    "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
  41. Re:The biggest problem is choosing the right langu by Coryoth · · Score: 3, Informative

    No benchmark is ever going to be a definitive measure, the best they can ever do is give you an idea or the general qualitative differences. I think you'll find, however, if you were to actually try Ada, Eiffel, D, or OCaml for an entire application, that they do, in fact, compare very well with C++ - it's not like there aren't any significant large applications written in those languages (well, possibly not D): they get plenty of use in various industries and are well known for their efficiency.

  42. Re:He summarizes one of the big issues in SD now.. by Karellen · · Score: 1

    That must mean that Duke Nukem Forever is going to ROCK!! ;)

    (Less than 5 months until Apr 27 2007, the 10-year anniversary of the initial announcement)

    --
    Why doesn't the gene pool have a life guard?
  43. Re:The biggest problem is choosing the right langu by bar-agent · · Score: 1
    I think Lisp holds at least a lot of promise for helping development (though I'm not totally convinced), it's just that I don't have time to learn not only a new language but in some sense a new paradigm right now.

    You can probably start with Dylan. It has similarities to Common Lisp and Scheme, but it uses a traditional infix notation. Paradigm-wise, it starts out a lot like C + structs, and you can explore out from there.
    --
    i'd hit it so hard, if you pulled me out you'd be the king of britain [bash.org]
  44. There is no silver bullet. by shess · · Score: 4, Insightful

    Many of the points in the interview implied that software was simply soaking up all the hardware performance, and perhaps we could squeeze more out of the software. I completely agree, except ...

    http://www-inst.eecs.berkeley.edu/~maratb/readings /NoSilverBullet.html

    The problem is that the software is an order of magnitude slower than it needs to be because the hardware has increased in performance by 2 and 3 and 4 orders of magnitude. If we had held the software to the same standards as we used to back when the hardware cost more than the programmers, it would be more efficient - but would only be able to make use of a couple megabyte of RAM and disk. The looseness of current software is part and parcel of harnessing the hardware. The hardware didn't just allow us go loose with the software we wrote - it allowed us to use abstractions which were measurably less efficient, but which had the side effect of allowing us to harness the hardware in the first place.

    As a pair of trivial examples, take arrays and dictionaries. When I ask interview questions like "Design a hashtable" or "Reverse a linked list", many candidates have to actually step back and think about the question! 30 years ago, designing a good hashing function was the mark of true talent, and gains were to be had by selecting the linked-list scheme which best suited the problem at hand. These days, many people don't really know why you'd use a map versus a hash_map, or a vector versus a deque. And, for the most part, they don't really need to.

    1. Re:There is no silver bullet. by cyclomedia · · Score: 1

      "These days, many people don't really know why you'd use a map versus a hash_map, or a vector versus a deque. And, for the most part, they don't really need to."

      Which is IMVHO a Good Thing. I believe that programmers should continue to hold absolute power over every bit and register their code handles, and beginners should spend a long while getting stuff done in standard C before they are allowed near C++'s "class" keyword.

      However in terms of collections, hash tables and the ilk i think that something like the D language is the way to go, which has them built in and optimised at compile time for you. Getting Stuff Done is not helped by having to rewrite the same bit of code over and over for every mudane task like creating a lookup table in every new project you write. And low level C compilers shouldnt need to be stuffed full of heuristics to try to guess that they need to optimise your own personal hash lookup function in a particular way. It's self defeating, like building escalators either side of a wall instead of just sticking a door through it.

      --
      If you don't risk failure you don't risk success.
    2. Re:There is no silver bullet. by Oligonicella · · Score: 1

      Thirty years ago? In 1976? Really? Don't think so. Those gains, by the way, are now moot. The increase in processor speeds ate them up long about... 25 years ago. (I can pull numbers too.)

    3. Re:There is no silver bullet. by Khelder · · Score: 1
      I think you're basically right on, but to me, you left something out when you said "it allowed us to use abstractions which were measurably less efficient". What's missing here is "Less efficient for what?"

      The answer is obvious, less efficient in terms of the computer---its runtime, memory, disk, etc. 30 or 40 years ago, those were good, important things to optimize for, because they were really expensive. Each early computer had a team of people whose full-time jobs were to make sure none of the computer's time was wasted.

      Today, for most people in the developed world (and I'll bet everyone reading this post), their computers far outnumber them (since almost anything electronic has at least one CPU in it now). Even just for traditional "computers", we think nothing of wasting huge fractions of their cycles (e.g., while they're waiting for us to type the next character or click the next link, at night when they're off or idle).

      What's the precious commodity today? CPU cycles, RAM, disk? In rare cases, yes, but the vast majority of the time the most valuable thing is humans' time and attention. So it makes sense to optimize for that, both in terms of making it easier and faster to write programs, and easier to use them.

    4. Re:There is no silver bullet. by Jesus_666 · · Score: 1

      These days, many people don't really know why you'd use a map versus a hash_map, or a vector versus a deque. And, for the most part, they don't really need to.

      When writing C++ you use a map rather than a hash_map when your program is supposed to be standard-compliant and/or portable. hash_map, while certainly useful, is utterly non-standard.

      --
      USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
  45. "...a decade of trouble with buffer overflows" by Joce640k · · Score: 1
    Which part of C++ is forcing you to create buffer overflows?


    Buffers overflows are caused by bad programmers, not C++.


    C++ defines container classes which cannot overflow. Try using them next time you write some C++ code.

    --
    No sig today...
    1. Re:"...a decade of trouble with buffer overflows" by LizardKing · · Score: 1

      C++ defines container classes which cannot overflow. Try using them next time you write some C++ code.

      No, the STL defines container classes, and they suck just as badly as the C++ language itself. Performance goes out he window unless you spend inordinate amounts of time ensuring that all the classes you put into the containers are setup to avoid multiple copying. This is a major pain in the arse, as different implementations of the STL have different semantics, and "accepted best practice" is to not to hold a copy rather than a reference to an object in a container. As someone else points out above, STL has encouraged generic programming, which is a major brainfuck which I've only seen used by l33t programmers who shouldn't be allowed near a compiler in the first place. The general attitude I see amongst self-acknowledged C++ programmers is "fuck design, screw maintainabilty, where can I slip some more operator overloading and inheritance into this crock of shit".

      Quite honestly, I wish Stroustrup had never been allowed the opportunity to inflict C++ on the programming world. C is concise, and despite it's flaws (which are mostly design trade offs) can be used with good practices to produce maintainable and scalable code. C++ on the other hand adds nothing more to C than complexity, throwing away the possible benefits of OO. In fact, until I was exposed to Java I couldn't see any benefit to OO programming thanks to the way it has been implemented in C++.

    2. Re:"...a decade of trouble with buffer overflows" by root_42 · · Score: 2, Insightful

      >> C++ defines container classes which cannot overflow.
      >> Try using them next time you write some C++ code.
      >
      > No, the STL defines container classes, and they suck
      > just as badly as the C++ language itself. Performance
      > goes out he window unless you spend inordinate amounts
      > of time ensuring that all the classes you put into the
      > containers are setup to avoid multiple copying. This is
      > a major pain in the arse, as different implementations
      > of the STL have different semantics, and "accepted best
      > practice" is to not to hold a copy rather than a
      > reference to an object in a container

      On the contrary -- the GP is quite correct. First, the STL ist not called the STL anymore for ages. It is part of the C++ standard library. And that's what it is -- a STANDARD. Compilers that do not follow the semantics described IN the standard are plainly broken and should only be used with care, if at all. But this is always a problem with languages that are implemented by a lot of people. Java for example is simple, because there are only vert few implementations in existance, and most probably 95% of the people using Java uses the one done by SUN. I think only very few use gcj for example.

      Also the STL is not that complex as you think and it really is efficient, if used correctly. But that is the case for any library and any tool. Furthermore one can always put pointers to objects in a container, which is the same as using a reference. And if you want to have some safety there, use a smartpointer -- there is nothing complicated about that. The discussion here really shows that C++ is indeed a COMPLEX language and that indeed it is NOT UNDERSTOOD by many of us here. But I think those who have worked with it for some years and REALLY UNDERSTOOD some of the more complex topics of it, will admit that C++ is a powerful, efficient and elegant language. There is no all-purpose language that is ALWAYS simple, efficient and elegant. This just can't happen. But C++ fits a lot of purposes well. For example for many occasions I write small python programs when I need to do some parsing, conversion or small calculations. That's totally great! But I also use C++ for larger programs, because it offers a vast amount of libraries and ideas. Not having to implement my own partition, sort, find or vector every time is really helpful. And those algorithms even run very fast on all my self-created types.

      --
      [--- PGP key and more on http://www.root42.de ---]
    3. Re:"...a decade of trouble with buffer overflows" by LizardKing · · Score: 2, Informative

      Java for example is simple, because there are only vert few implementations in existance

      The reason Java is simple is that it didn't try to be a multi-paradigm language, where the inevitable trade offs left C++ inadequate in every paradigm. Java was also well described in a decent specification rather than being standardised too late in the day as happened with C++. There also exists a canonical Java test suite, whereas the C++ standard is littered with opportunities for implementation specific functionality, especially in the STL.

      Also the STL is not that complex as you think and it really is efficient, if used correctly.

      I can write efficient code for Sun's implementation of the STL that will generate multiple calls to the copy constructor in GNU STL when adding an object to a container. Neither STL version violates semantics as described in Stoustrup's book, it's just one of a vast number of implementation specific features that are allowed in an STL implementation.

      There is no all-purpose language that is ALWAYS simple, efficient and elegant.

      No, but I struggle to think of a single instance where I have encountered C++ code that proved to be simpler, more maintainable or more efficient than the equivalent written in C, Perl or Java. Of the three large C++ based projects that I have become involved with, two were scrapped and replaced with a mix of C and Java. The third is still proving to be a hindrance to those trying to maintain and extend it, so much so that a parallel system is evolving, largely written in Perl.

    4. Re:"...a decade of trouble with buffer overflows" by try_anything · · Score: 2, Insightful

      C++ vectors *can* be used safely, but the library designers used traditional, easy-to-read syntax for unsafe access and verbose, hard-to-read syntax for safe access. They clearly meant for unsafe access to be the norm and safe access to be used in special cases. I'm a C++ fan, but in this case they screwed up badly.

    5. Re:"...a decade of trouble with buffer overflows" by kraut · · Score: 1

      > The reason Java is simple is that it didn't try to be a multi-paradigm language,
      It's not that simple anymore.. but anyway, I've always hated having to create a fake class just to be able to have a main in Java.

      > where the inevitable trade offs left C++ inadequate in every paradigm
      Err. No. Sorry. No, There, you have your unsubstantiated opinion, I have mine.

      >Java was also well described in a decent specification rather than being standardised too late in the day as happened with C++.
      Well, that was because Java was pushed by a big company, whereas C++ grew fairly organically, and was adopted because people found it useful. Of course the language developed - I shudder what would have happened if they'd standardised it in '89 - but I agree, it would have been nice to have the standard a few years earlier. Hardly Bjarne's fault.

      > There also exists a canonical Java test suite, whereas the C++ standard is littered with opportunities for implementation specific functionality,
      Having a test canonical test suite is obviously nice; equally obviously when you have a single company controlling the "standard". Standards developed through the ISO have a messier origin. As for the implementation specific functionality - most of that is actually inherited from C.

      Again, compatibility with C was a choice; it was probably crucial to C++' success at the beginning, and may be more of a hindrance now. Java makes other choices - e.g. in floating points - which would have sunk C++ when it was developed.

      > I can write efficient code for Sun's implementation of the STL that will generate multiple calls to the copy constructor in GNU STL when adding an object to a container. Neither STL version violates semantics as described in Stoustrup's book, it's just one of a vast number of implementation specific features that are allowed in an STL implementation.

      Good for you; and my comiserations for having to deal with Sun's compilers. But if you still believe that Bjarne's books define the standard, you're so far behind the times that it's hard to take you seriously. Go and look at the standard, you'll find it complex but fairly unambiguous; implementation defined behaviour is quite rare, and usually exists for a good reason.

      > No, but I struggle to think of a single instance where I have encountered C++ code that proved to be simpler, more maintainable or more efficient than the equivalent written in C, Perl or Java. Of the three large C++ based projects that I have become involved with, two were scrapped and replaced with a mix of C and Java.

      My comiserations; you've clearly been unlucky in your choice of employers. There have been a lot of bad C++ projects, but the same can be said for most languages that have left the lab - I can certainly vouch for the Java on that count.

      > The third is still proving to be a hindrance to those trying to maintain and extend it, so much so that a parallel system is evolving, largely written in Perl.
      You're not seriously suggesting that Perl is the way forward in ANY sense?

      --
      no taxation without representation!
    6. Re:"...a decade of trouble with buffer overflows" by LizardKing · · Score: 1

      It's not that simple anymore.. but anyway, I've always hated having to create a fake class just to be able to have a main in Java.

      Well, having to create a "fake" class for your main() method is hardly a complaint - nothing "fake" about the class, and it enables you to knock up a quick test harness or to have multiple entry points to a system. It's definitely better than having to use the preprocessor to hide multiple main functions in a bunch of C++ classes. As for the simplicity of Java, the underlying bytecode format has hardly changed since 1.1, even with the addition of generics. The language itself has also been remarkably stable between versions, and the API in the accompanying class library has mostly become simpler (see the Collections classes for instance) although it has grown exponentially as more classes have been added.

      > where the inevitable trade offs left C++ inadequate in every paradigm
      Err. No. Sorry. No, There, you have your unsubstantiated opinion, I have mine

      My opinion yes, but substantiated by my experience and that of others I have worked with and respect. an opinion that is also shared by the authors of a number of articles, books and studies that show programmer efficiency is higher when working with Java rather than C++. This efficiency is partly down to the complexity of C++ - it is undeniably harder to master - but the comparative benefit of mastering that complexity is debatable. A consensus is even forming that Java has had its day, and that things like Ruby may be more programmer efficient (see "Beyond Java" by Bruce Tate for instance).

      Had C++ been standardised in 89, perhaps it would have been an elegant language without some of extra complexity that was documented in each edition of Stroustrup's book. As for reading the standard, no thanks. The fact that I cannot think of a good C++ book ("C++ Primer" is just as terrible as "The C++ Programming Language" for example) just reinforces the fact that C++ is complex, and doesn't make me anymore inclined to resort to the standard as a reference.

      Your swipes at the Sun compiler miss my point - GCC is a poorer compiler for my target platform anyway - I was simply highlighting the implementation dependent gotchas that STL introduced. I don't want to need to know the most optimal way of using a each STL, I'd rather have a language and accompanying library that are simple enough that they offer abstractions I can use efficiently without the implementation specific knowledge.

      Finally, as for the Perl code, it's not my ideal way forward. More of a damning indictment of C++ that it's easier for many of my colleagues to develop parallel tools in Perl, a langauge not known for encouraging the writing of maintainable code.

      To paraphrase something I read a while ago, there's an elegant language fighting to find its way out of the elephantine bulk of C++, and it's Java.

    7. Re:"...a decade of trouble with buffer overflows" by Generic+Player · · Score: 1

      "Good for you; and my comiserations for having to deal with Sun's compilers. But if you still believe that Bjarne's books define the standard, you're so far behind the times that it's hard to take you seriously. Go and look at the standard, you'll find it complex but fairly unambiguous; implementation defined behaviour is quite rare, and usually exists for a good reason."

      Are you seriously not able to understand this yet? The standard only defines the semantics and syntax. It does not enforce any particular method of writing the STL library behind the scenes. That is by definition implimentation specific. Which is why different implimentations have vastly different performance characteristics.

      "My comiserations; you've clearly been unlucky in your choice of employers. There have been a lot of bad C++ projects, but the same can be said for most languages that have left the lab - I can certainly vouch for the Java on that count."

      Sure, you can do bad with any language. But C++ is the only language I can think of that really has almost no good software written in it at all. C++ is a major reason most average joe computers users think "computers are just broken" and that applications should crash all the time.

      "You're not seriously suggesting that Perl is the way forward in ANY sense?"

      I didn't see anything suggesting that, why did you? He said some people find perl to be less horrible than C++. C++ is the only language I know of that actually makes perl look elegant.

    8. Re:"...a decade of trouble with buffer overflows" by Bill+Dog · · Score: 1

      Um, for std::vector, the "unsafe" syntax is "thing[1]". Definitely traditional and easy-to-read. The safe access is "thing.at(1)". Wow, that's so verbose and hard-to-read!

      The designers clearly meant for the "unsafe"^H^H^H^H^H^Hefficient access to be the norm. If you get the length of the vector first, and loop from 0 up to before that, like everyone is used to doing with arrays and using the square brackets operator, it's unnecessary to pay the price for the overhead of bounds-checking the index on every access. at() would be used less often, only in cases like a function that takes an index as input and needs to access a vector with that index. One could then use at() to do the checking and throwing if out of range, rather than writing code one's own code to do this.

      --
      Attention zealots and haters: 00100 00100
    9. Re:"...a decade of trouble with buffer overflows" by try_anything · · Score: 1
      The designers clearly meant for the "unsafe"^H^H^H^H^H^Hefficient access to be the norm. If you get the length of the vector first, and loop from 0 up to before that, like everyone is used to doing with arrays and using the square brackets operator, it's unnecessary to pay the price for the overhead of bounds-checking the index on every access.

      Don't assume that getting rid of safety buys efficiency. Check out these implementations of the scenario you described (your "efficient" version is method2):

      void method0(vector<int>& v)
      {
      for(int i=0; i<v.size(); ++i) {
      twiddle(v.at(i));
      }
      }

      void method1(vector<int>& v)
      {
      int size = v.size();
      for(int i=0; i<size; ++i) {
      twiddle(v.at(i));
      }
      }

      void method2(vector<int>& v)
      {
      int size = v.size();
      for(int i=0; i<size; ++i) {
      twiddle(v[i]);
      }
      }

      void method3(vector<int>& v)
      {
      for(int i=0; i<v.size(); ++i) {
      twiddle(v[i]);
      }
      }

      void method4(vector<int>& v)
      {
      for(vector<int>::iterator i = v.begin();
      i != v.end();
      ++i) {
      twiddle(*i);
      }
      }

      Using gcc 4.1 and -O3, the fastest version is... are you ready for it? method1. method0, method2, and method4 have essentially identical numbers, and method3 is the slowest. That's right: method1 beats method2, and method0 beats method3. Don't ask me why. On -O2, your implementation (method2) and the iterator implementation tied for first, significantly ahead of the others.

      That's why the default should be safe access. Compilers and processors are incredibly weird and complex beasts, much more complicated than programming languages. You can't reliably label code "efficient" or "inefficient" based on inspection, but you can almost always rely on guarantees made by languages and high-quality libraries. You know that v.at(i) does a bounds check, and v[i] may not. You don't know that v[i] will compile to faster code than v.at(i); you can only make a very unreliable guess.

  46. Re:He summarizes one of the big issues in SD now.. by frank_adrian314159 · · Score: 1
    Ok, then please explain why Open Source projects are full of flaws just like commercial products.

    Because "Worse is Better".

    --
    That is all.
  47. Wouldn't that be called D? by Myria · · Score: 1
    you put a little too much sharpness in C##.

    Wouldn't that be called D?
    --
    "Screw Sun, cross-platform will never work. Let's move on and steal the Java language." - Visual J++ Product Manager
  48. the problem with programming are books by Bjarne by HealYourChurchWebSit · · Score: 1

    The problem with programming are books like Bjarne Stroustrup's "The C++ Programming Language."

    I mean, just because a computer language was hard to write, doesn't mean it should be hard to read about.

    --
    --- have you healed your church website?
  49. Re:The biggest problem is choosing the right langu by frank_adrian314159 · · Score: 2
    It has similarities to Common Lisp and Scheme, but it uses a traditional infix notation. Paradigm-wise, it starts out a lot like C + structs, and you can explore out from there.

    Which means you learn nothing other than a new syntax to program your same old style in (i.e, nothing worthwhile). Not to mention that Dylan's macro system will leave you crying because computational macro systems in a syntax heavy environment just suck. If you're really short of time, you're better off using it to learn Erlang, Prolog, or Smalltalk. With the first two, you'll learn new ways to think about programming; with the second, you'll at least get better tools and have more fun. Either is more useful than Dylan.

    --
    That is all.
  50. Bjarne Stroustrup. by dousk · · Score: 1

    What a name! Sounds like a distant cousin of G.Threepwood. I mean, you can even start a law firm with those names. Imagine a big plaque with the sign "Stroustrup & Threepwood" slapped on it.

    Boy that sounds expensive.
    Or silly (me). :)

    1. Re:Bjarne Stroustrup. by Anonymous Coward · · Score: 0

      For my native language Stroustrup sounds as "ostrich is dead body"
      (excuse me Bjarne :)

  51. Slow, but quick to write by fub · · Score: 1

    You are ever so right. If we had kept on hand-crafting our software in assembly, it would be able to squeeze out ever single last clock-cycle out of the CPU and use it. However, writing an application-server in assembly isn't anyone's idea of fun -- and it takes too friggin' long.

    There are too many things that need to be automated with software for us to be able to keep on doing everything in assembly. Using higher-level languages has two advantages: it gets easier to express abstract concepts, and there is less technical knowledge needed to write software.
    The price we pay is the inefficiencies introduced by interpreters, compilers and virtual machines. With raw CPU power still increasing, that's not so much of a problem -- all this time, we've been riding the wave of Moore's Law, writing software in languages with more and more abstract features.

    That is not to say that there is no merit in being able to design a linked list, and surely loads of programmers stand to benefit from some additional lectures on data structures. But squeezing the last drop of performance out of the hardware is not an issue anymore.

  52. Re:The biggest problem is choosing the right langu by jcr · · Score: 1

    More than that, when you write in a language that doesn't have as much needless complexity as C++, then you have time debugging, and performance tuning that you don't have if you're using Stroustrup's Great Train Wreck.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
  53. Obligatory reminder of the other Interview by Phatmanotoo · · Score: 1

    "I Did It For You All..."

    After all these years, I have my doubts this interview was really a hoax.

  54. Stroustrup complaining about the quaility of code by nagora · · Score: 0, Troll
    is like Hitler lamenting the treatment of Jews.

    I've never encountered a more overrated programmer than Stroustrup, nor a worse technical writer. The examples in his books would make any decent programmer cry, and the text would do the same to anyone who likes clear prose. Worthless crap.

    --
    "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
  55. Who does use it? by Anonymous Coward · · Score: 0

    I was at Ken Thompson's retirement bash at Bell Labs when Rob Pike was giving the speech mentioning all the great things that had been built at the labs. Bjarne was there too. Rob said "....., oh and some C++ language that no-one here uses...". Well you know those guys had the intelligence _not_ to use that OO on top of assembler idea. Shame the rest of the industry wasn't that smart.

  56. Arrogant Assh*le. by Qbertino · · Score: 1

    C++ can do wonders when used by highly experienced people. But most of the time, it is more cost effective to get entry level coders and use PHP/Java/C#/whatever. You will get a (somewhat) working product cheaper and possibly faster. And time to market and cost is often more important than maintainability/quality.

    Sorry, but you're an Arrogant Assh*le.
    I mostly do webstuff for a living right now and have been programming for 20 years. I use PHP for webstuff because the available pipeline and it's toolset are mature and I don't want to compile every 2 minutes. I'd use Java if I needed a GUI-app that is cross-platform. Which are the exact reasons for most people using PHP or Java. With you bullshitting about the o-so-experienced C++ programmers and the o-so-n00b PHP and/or Java people I doubt that you have the knowlege or experience to judge who's experienced and who's not. Show me the equivalent of jEdit in C++/QT or the equivalent of Typo3 in C++. Until then I suggest you change your tone of voice towards people choosing other PLs than your favorite.

    P.S.: Just the other day I heard of this guy who wants to build a complex browsergame in C++. For performance reasons. LOL! We all know where that's going to end. Talking about choosing the right tool for the job. Now who's the unexperienced developer? Me or he who uses C++? ... Thought so.

    --
    We suffer more in our imagination than in reality. - Seneca
    1. Re:Arrogant Assh*le. by coder111 · · Score: 1

      Ok, English is not my native language so I might have said something I did not mean. I didn't want to say that C++ = good coders, PHP/Java/C#/etc = bad coders. What I wanted to say was:

      C++ + good coder = good results
      C++ + newbie coder = horrible results

      PHP/Java/C#/etc + good coder = good or very good results
      PHP/Java/C#/etc + newbie coder = acceptable or barely acceptable results

      And it takes much more time/experience to learn to use C++ effectively than it does to use Java/PHP. And time means money. And after you teach your just hired newbie how to code well while paying him salary, he leaves for another company where he gets more pay.

      Oh, and I agree with JustNiz that having good programmers is always a good thing. Of course it is, but in reality, you don't always get the team you want. And about not using 3rd party libraries- what do you do? command line stuff? Math/science? You are a lucky man then. While making these might get away without 3rd party libraries, but if you need GUI, compression (like gzip), various file formats (XML), database interfaces, internet protocols like HTTP, web, clustering, anything- you are gonna need some. Oh, and what if you switch jobs? Who owns the copyright on your library of reusable components? You or your current employer?

      P.S. I code web apps in java. So don't think I disrespect people who use something other than C++.

      --Coder

  57. You want Lisp. by piranha(jpl) · · Score: 4, Insightful

    You want Lisp. Hear me out.

    Of course, the character syntax is superficially different. Operators use infix notation ("(+ 1 2)" is analogous to "1 + 2"), and have identical character syntax as function calls ("+", an operator in Lisp jargon, may be implemented as a function).

    If you can sleep at night after that, your can define own higher-level language syntax that looks exactly like any other Lisp syntax. Lisp is extremely flexible in its naming of functions and variables (symbols). If you'd like, you could define an operator named .= as a function: (.= string new-character-strings ...) would modify the given string object, string , in-place, appending each specified new-character-string to the end.

    Recognizing the downside to modifying random strings in-place, perhaps you'd rather have your .= operator assign a newly-instantiated string to the variable referenced by string . You could, by writing the operator as a macro. The macro would act like a function, taking as input each "raw" argument—symbols and lists, the structure as they appear in your program, before evaluation—and returning as output replacement Lisp code to evaluate in its place. So that your .= operator form of (.= out "lalala") is semantically equivalent to (setf out (concatenate 'string out "lalala")) (like out = out . "lalala"; in other languages).

    It's not just simple textual substitution. You can use any function or macro in your macro definition to transform your input arguments into whatever replacement code you'd like. I'm using macros in Common Lisp to generate recursive-descent parsers based on a grammar production expression: the following form defines a function named obs-text that takes a string as input and returns a list of matches found as output:

    (defproduction obs-text
    (LF :* CR :* (obs-char LF :* CR :*) :*))

    This function is defined in place and evaluated and compiled immediately by the Common Lisp implementation.

    Macros can be abused, but they add a tremendously powerful capability of abstraction not possible with many other languages.

    1. Re:You want Lisp. by piranha(jpl) · · Score: 1

      That's prefix notation, but you knew that.

    2. Re:You want Lisp. by BritneySP2 · · Score: 1

      > Hear me out. ... "lalala" That's why nobody listens to lispers. (I like Lisp.)

    3. Re:You want Lisp. by HeroreV · · Score: 1

      One of the biggest hurdles to using Lisp is its libraries. You know, all none of them. If Lispers really wanted people to use Lisp they'd push harder for support in Microsoft.NET or Mono. Tachy is working towards that, but I haven't seen much excitement about it.

    4. Re:You want Lisp. by DragonWriter · · Score: 1
      One of the biggest hurdles to using Lisp is its libraries. You know, all none of them.


      There are substantially greater than zero libraries for Common Lisp, likewise for Scheme.

      If Lispers really wanted people to use Lisp they'd push harder for support in Microsoft.NET or Mono.


      Or just write a Common Lisp implementation in Python, and then get .NET (via IronPython) and and Java (via Jython) support for free on top (actually, there are several Lisp implementations in Python already.) And there are already at least two .Net Lisp implementations (DotLisp and L Sharp .Net), though neither is Common Lisp or Scheme, but instead different dialects; there are also .Net interfaces for Common Lisp on Windows (allowing Lisp to call .Net without running on it).

      I'm not sure how much "harder" you think the Lisp community ought to be working...

    5. Re:You want Lisp. by piranha(jpl) · · Score: 1
      Or just write a Common Lisp implementation in Python...

      Yeesh. Maybe when there's a self-hosting Python compiler.

  58. Array problem fixed by WalterBright · · Score: 1
    (I'm writing this as someone with over ten years of experience in C++, doing everything from protocol stacks to game physics engines to real-time programming. And after ten years, I'm fed up with the mess. This should have been fixed years ago.)

    The problem with arrays has been fixed in the D programming language, http://www.digitalmars.com/d/, which is a reengineering of C++.

  59. Or you could just... by pr0nin · · Score: 1

    ...right click on the project in VS2005 choose refactor -> refactor as c++. Problem solved in like 2 or 3 clicks :)

    --
    Destroy, erase, improve
    1. Re:Or you could just... by Anonymous Coward · · Score: 0

      I'm assuming your comment was supposed to be moderated as funny.

      If it is as large as weicco says (and I'm assuming a reasonable amount of GUI) then you'd expect man years of effort to convert from VB6 to VB.NET to even be able to choose the refactor option. when we ran the upgrade wizard we had thousands of errors and that is not even counting the warnings.

      Weicco - that is a big claim

    2. Re:Or you could just... by bowlingfreak · · Score: 1

      I think I worked on the same project as the previous poster. If I'm right, it has about 900+ independent screens (maybe more now, it's been a few years), custom controls and a fairly complex architecture with much of the heavy lifting already done in C++. If that's the case, it most certainly would not be as simple as 2 or 3 clicks. In fact, migrating from 16 bit VB3 to a 32 bit VB5 took far longer than Microsoft said it would. they basically said recompile but it ended up taking a lot more work than that. I HOPE you were joking with the "refactor as C++" comment.

    3. Re:Or you could just... by pr0nin · · Score: 1

      Yeah, it was a joke, just like the refactoring in vs2005...

      --
      Destroy, erase, improve
  60. How about this simple example then by Viol8 · · Score: 1

    cout > operators as I/O operators was a very poor decision , though I guess that fits in with the rest of the abortion that is C++

    1. Re:How about this simple example then by Viol8 · · Score: 1

      Great , you put double less than and double greater than into the post and slashdot can't handle it. Figures. What I attempted to say was:

      cout "double left shift" a "double left shift" b;

      Just from looking at that code is it obvious whether a is being shifted by b or and the result output or are both a and b being output? No it isn't. And I've seen examples of this sort of code MANY times. Using the "double left shift" and "double right shift" operators as I/O operators was a very poor decision , though I guess that fits in with the rest of the abortion that is C++

    2. Re:How about this simple example then by 2short · · Score: 1

      From my original post:

      "Now I'm sure people will deluge me with examples of cryptic, intentionally obtuse code that dumps the results of shift expressions directly to streams, and thus abuses this construct to create confusion. That's not the point. In decently written code, it's not a problem."

      Thanks for fulfilling my prophecy.  But I still maintain that in remotely serious code, there's never any reason to do this.  Oh, I see, you mean:

      cout << a << b ;

      That certainly happens in real code all the time, and they are both output, every time.  It's completely obvious, unless you think operator precedence has mysteriously evaporated and that the programmer decided to use an intentionally confusing formulation.  You just don't wind up doing stream output in the same sort of context you do bitwise shifting.  If the line starts with cout, and the code isn't part of an obfuscation contest, there aren't any bitwise shifts going on.

      "the rest of the abortion that is C++"

        C++ is not, and does not try to be, well suited to everyones needs.  It may not be well suited to your needs.  As one of the most widely and succesfully used programming languages there are, it seems likely it is well suited to somones needs.  If you think it is simply an unmitigated pile of garbage, it seems likely you are missing something.  Particularly when your criticisms revolve around things that actual users of C++ never have a problem with, even a little bit.

    3. Re:How about this simple example then by Viol8 · · Score: 1

      "You just don't wind up doing stream output in the same sort of context you do bitwise shifting."

      Don't do much maths programming do you. I hadly think doing a maths op in stream output is "cryptic". Perhaps you always insist on putting everything in variables before output, who knows.

      "If you think it is simply an unmitigated pile of garbage, it seems likely you are missing something."

      I have no issues with its functionality. I have many issues with its syntax which frankly make complex C++ unreadable to any sane person a lot of the time.

    4. Re:How about this simple example then by 2short · · Score: 1

      "Don't do much maths programming do you"

      That's really funny.  My work is chiefly computational geometry and/or statistics, but bit-shifting doesn't come up much in either.  It comes up in ocasional forays into custom compression schemes.  Sorry, no, I really can't see bit shifting on the same line as stream output in any serious code; it's going to be a couple function calls and abstraction barriers away.  Maybe in some quick and dirty test code, but in any case, how hard is it?

      cout << (a << 4);

      Sorry, but the multiple meanings of "<<" is just not a cause of any confusion for any serious C++ programmer; it's a funny quirk that newbies coming from C notice.  Does it bother you that "*" sometimes means "multiply" and sometimes means "dereference"?  Do you have an example of any code ever where the overloading of "<<" is confusing to you?  Because I've got a heck of a lot where it makes stream output much more readable.

      As I've said elsewhere, if you're not writing code most of your working hours, C++ is not designed with you in mind, and is probaly not suited to your needs.

      "issues with its syntax which frankly make complex C++ unreadable to any sane person"
      Well, in that case there's a heck of a lot of insane people out there producing a heck of a lot of nicely functioning code.

    5. Re:How about this simple example then by Viol8 · · Score: 1

      "My work is chiefly computational geometry and/or statistics, but bit-shifting doesn't come up much in either"

      I suspect it wouldn't in statistics , but in geometry I'm surprised. If you're writing efficient code shiting (depending how good or bad the compiler is) can be a lot faster than mult or division by 2.

      "Does it bother you that "*" sometimes means "multiply" and sometimes means "dereference"?"

      Yes it does actually. Theres no reason K&R couldn't have picked one of the many other punctuation symbols on the keyboard and used that instead. '@' for example. Its even pronounced "at". How much more obvious could it be? But no , they overloaded star. Genius. Stroustrup had the opportunity to not follow in their footsteps , but he just made it worse.

      "As I've said elsewhere, if you're not writing code most of your working hours, C++ is not designed with you in mind, and is probaly not suited to your needs."

      Well unfortunately I've been working as a C++ programmer for the last 8 years and C for 5 years before that so I think I have a vague clue what I'm talking about. Perhaps familiarity breeds contempt but for me , C++ is even more of a dogs dinner than C and I wouldn't have bothered to learn it if it hadn't been a career necessity.

    6. Re:How about this simple example then by 2short · · Score: 1

      "I suspect it wouldn't in statistics , but in geometry I'm surprised. If you're writing efficient code shiting (depending how good or bad the compiler is) can be a lot faster than mult or division by 2."

      Any compiler worth using does optimizations like that for you. But probably not that one specifically, because every processor from the last 20 years or so (that you'd be doing geometry on; maybe not microcontrollers) will do that one in hard- or firm- ware. That's exactly the sort of "optomization" that at best just makes your code unreadable, and quite possibly prevents the compiler from making even better optomizations.

      I've never seen a "*" or a "<<" and been confused about what it meant. Not once, ever. Not one of the many C++ programmers I've known in person has ever expressed such confusion. Sorry if it's a big problem for you, but I honestly have a hard time relating.

      You say you learned C++ only as a career necesity, but if you hate it so much, maybe C++ programmer isn't a good career choice?

  61. Re:He summarizes one of the big issues in SD now.. by Chrononium · · Score: 1

    Time pressures and price are fundamentally incompatible with quality engineering. It's called a trade-off. It's nothing new. People always want to spend the least amount of money for the highest quality product developed in the shortest amount of time. Expecting anything else is naive.

  62. More Education!!! by scottsk · · Score: 1

    Executive summary of article: The creator of C++ now works for Texas A&M, an educational institution, and he thinks the solution to the problems of software is more education.

  63. A better interview with Stroustrup by 3dWarlord · · Score: 1
  64. Start ASSEMBLY on PAPER, no COMPUTERS by cheekyboy · · Score: 1

    The way I started, was to learn every instruction set of a 6502 from a book, and virtual know half the op codes
    of hand in hex. This without a computer, just paper and pen. Write some small functions on paper too. Like for loops
    and atoi converters, and maybe sin(x) lookup calls.

    Then once you can convert hex/dec/bin in your head and know half the opcodes in hex, you can start proper assem coding
    on a computer to do cool funky stuff.

    Once you see you are repeating stuff often, you get to appreciate the concept of library functions and you build yourself
    a person toolkit api, micro libc hmmmmm. Then you implement half the apis in macros/functions.

    Once you see the high level of things, jumping to C/C++ is a piece of cake and you understand it all.

    --
    Liberty freedom are no1, not dicks in suits.
    1. Re:Start ASSEMBLY on PAPER, no COMPUTERS by hotdiggitydawg · · Score: 2, Funny

      Paper and pen? Luxury. When I were lad, we had to use papyrus and lump o' charcoal, and compilin' were done by chisellin' machine code int' stone tablet.

    2. Re:Start ASSEMBLY on PAPER, no COMPUTERS by swamp+boy · · Score: 2, Funny

      And we were thankful! Also, we had to walk through 6 feet of snow to the programming "chisel lab" and it was uphill both ways.

    3. Re:Start ASSEMBLY on PAPER, no COMPUTERS by Alioth · · Score: 1

      I did the same, but with the Z80 :-) Mainly the paper and pen (and hexloader) because I needed to buy an assembler for my Sinclair Spectrum and didn't have enough pocket money to buy GENS - so a small hex loader written in ZX Basic had to do. It all got a lot easier when someone gave me a pirated tape with GENS 3 on it!

    4. Re:Start ASSEMBLY on PAPER, no COMPUTERS by Anonymous Coward · · Score: 0

      > 6502 -> C++ easy

      Actually this was a big problem for me, because in 6502 ASM I knew where every byte was and what it did, and the stack was only 256 bytes. It took me a year to trust stack allocation of variables would not crash my system, and at the time new could happily return null. It didn't help to find out that the stack grew from the bottom, and heap allocation came down from the top, and in fact they could silently collide. I can't say that I was really happy with C++ until new was guaranteed to throw on failure.

  65. How many dahes have created a language? by Gnavpot · · Score: 1

    This is the third time I discover that a language I know (the existence of, at least) was created by a fellow dane. The two others were Turbo Pascal (Anders Hejlsberg) and PHP (Rasmus Lerdorf).

    So now I have to ask:
    Have other danes created widely used languages, which I do not know of?

    (I know that Hejlsberg have made a few more languages. I am counting persons, not languages.)

    1. Re:How many dahes have created a language? by drxenos · · Score: 1

      You're stretching it a bit. Turbo Pascal is an implementation of a language created by Nicolaus Wirth.

      --


      Anonymous Cowards suck.
  66. This article is a little Old by Veretax · · Score: 1

    This article is a bit dates, I saw it a few weeks ago. Is Slashdot getting behind? In any case back on topic, in High School i had the pleasure of taking a IBM Basica course. Fortunately I had a brilliant math teacher in it, but unfortunately it was a bore. I learned most of what i needed by reading through the book in its volume in a couple of weeks. However, the most important things I learned from the class to this day include how to build an algorithm. When I got to college, they threw all the engineers in a Engineering 2 class that was supposed to teach all engineers C. Unfortunately we were taught by a Civil Engineer and he didn't have much understanding. This became apparent when they guy's idea of a sort algorithm required three separate arrays: One for the original data, one to mark that it was moved, and the final one. Using what I had learned in High School I decided that I'd show this professor what a real sort looks like. I think i implemented it three different ways and also did it his way. (His way was much more convoluted if memory serves). Anyhow, when the professor saw the work, the next day I saw my three examples circulating the room as examples. SO what is my point? I don't think its the syntax, or even basic concepts that our college programs are lacking. What is lacking is how to think critically and create algorithms for the situations we encounter. In one of my upper level courses we talked all class about the concepts of TCP/IP, but when it came to the programming projects were somewhat thrown to the wind. Now I'm not faulting this professor for that (it turns out the class was mislisted and should have required C++ as a prerequisite in the catalog. Too bad for me though. Once i got into actual CS classes they threw me into ada, which despite all its critiques was a GREAT language to learn on. I think all beginning programmers should be taught on a strong typed language. That way the can develop good habits.

    1. Re:This article is a little Old by Anonymous Coward · · Score: 0

      This guy's sort was probably thought up by himself, rather than an example that you just implemented in the language. So I wouldn't give the guy too much trouble.

  67. Programmer efficiency by igomaniac · · Score: 1

    I use C++ for my work, and I've been programming in C++ for many years. It's definitly a flawed language, in that even skilled experienced and careful programmers find themselves spending weeks tracking down bugs caused by memory overwrites and buffer overflows. Things that _will_ bite you with C++ are overloads of virtual methods (if someone changes the type of a parameter in the base class to be const, then suddenly your derived class is declaring a new overload not an override because it's not const ...) forgetting to declare a destructor virtual so you leak some resource where you delete through a pointer with the base class type, and the list just goes on and on.

    Add to this the build dependency nightmare that causes a simple change (say, adding a member to a class that's used a lot) to take 10-15 minutes to compile and you have a language that simply takes you longer to get the job done. And the most expensive side of software development is the man-hours it requires, not that you have to buy a newer faster computer to run the software - so programming in an 'efficient' language like C++ is just not the way to go for most projects. In fact the time you save writing in C# (or Java or Haskell for that matter) instead, can be used for performance profiling and finding better algorithms - so in the end you probably end up with a more efficient program anyway.

    --

    The interactive way to Go -- http://www.playgo.to/iwtg/en/
    1. Re:Programmer efficiency by try_anything · · Score: 1

      I'm in the same boat you're in and for the first time in my life find myself rearranging code to bring compile times down, using Valgrind, and using Boost.Python for sanity.

      The world needs a decent systems language (not C, maybe C++) with easy automated integration with a higher-productivity language like Python or C# -- maybe a closely integrated pair or family of languages, or maybe a single language working in "Safe" and "Unsafe" modes. .Net seems to be in the neighborhood by accident, Stroustrup is showing some interest, Boost.Python users know the value of it (but have to work way too hard), and Common Lispers have known the answer for decades (but have developed a fierce bias against any integration between languages or programs -- it's all one big Lisp system or nothing). Efforts to retrofit such integration onto existing languages seem hopelessly complicated and difficult, so this looks like a problem for language designers. With all this beating around the bush, we should get something useful in the next twenty years -- too bad for anyone who isn't young enough to look forward to it :-P

  68. Re:He summarizes one of the big issues in SD now.. by Peter+La+Casse · · Score: 1
    Time pressures and price are fundamentally incompatable with code quality, even amongst the best programmers. Ergo, great programming is incompatible with most business models (i.e., most businesses don't have the money to make the software they want at the quality they want).

    Ok, then please explain why Open Source projects are full of flaws just like commercial products.

    Because they often don't have what it takes either: time, discipline and ability. Just because one kind of software doesn't have it doesn't mean that open source software has to have it. Making high quality code is often not as fun, and when I code for myself it's usually for fun. Just because I'm making something for myself doesn't mean that I don't have time pressure, or that I'm inclined to be more disciplined than I am when I'm coding for work. If I'm only a mid level programmer at work, I don't magically get smarter when I program for myself at home.

  69. He's been an academic too long by Chief+Crazy+Chicken · · Score: 1

    The real, core, problem behind bad software is a requirements issue.

    There are several things that come to play here:
      - People don't know what they want until they have it.
      - Mass market products (office, browsers) use an averaging effect of either focus groups or "representative guessing" to determine requirements for people that won't know what they want til they have it.
      - Users and developers don't want to talk to each other.
      - If someone makes them get in a room, users and developers tend to talk in different directions, having different mental models of the domain space.

    I'm sure there are more. That's the top few without writing a book.

    There are a few elements in his answers that have some truth about them -- the constant panic and rush causing lower quality -- but they all tie back to these. The panic and rush are there because everyone is trying to patch over the problems and miscommunications several steps too late.

    Additionally, the sorts of things that wouldn't make an academic or intellectual cry when reading code are artistic fluffery. Brilliantly clever "pretty" algorithms end up being unreadable and incomprehensible either at 3 in the morning or by the guy that's really just a coach at heart and is in your code. ("I'm in ur code, coaching ur variables")

    maintainability and readability ftw.

    1. Re:He's been an academic too long by Anonymous Coward · · Score: 0

      Ahh, how oft we hear the same excuses ...

      > - People don't know what they want until they have it.

          Yes they do (outside the mass market at least, where most software is written). They've been running their business's for quite
          some time and usually know *exactly* what they want. They then are prepared to invest a lot of time, money and effort in
          educating the development team. Unfortunately, newbie coders seduced by all those many, many books are often contemptuous
          of the customer and produce rubbish. (This is *especially* true of "Agile" teams in my experience.)

      >- Mass market products (office, browsers) use an averaging effect of either focus groups or "representative guessing" to determine requirements for people that won't know what they want til they have it.

          Yeah, I'll concede this one:- but see above, the vast majority of software is *not* mass market In fact, most doesn't even
          run on PC's - ever heard of the embedded market?

      >- Users and developers don't want to talk to each other.

          Again, see above. The customer has set aside a budget and wants a result from their investment. Yes they *do* want to talk
          to you. If you can't make the effort, well I guess it means you ain't as professional as you'd like to think.

      >- If someone makes them get in a room, users and developers tend to talk in different directions, having different mental models of the domain space.

          True. But they're paying you, so make the effort to learn their language. You'll learn something (probably that, yes they do
          know what they want)

    2. Re:He's been an academic too long by Anonymous Coward · · Score: 0

      Nobody knows what they want until they get it. It's inhuman to demand more. I don't know where you get the idea that most people do.

      Anyway, it's often the case that no one person understands the problem well enough to specify a minimally usable system, let alone an ideal one. Even when replacing an existing system, a simple oversight in specification by a manager can cut the productivity of a class of peons (say, data entry clerks) to one tenth of their previous rate, and correcting that oversight might be very costly if you haven't assumed from the beginning that the requirements will continue to evolve even after you start delivering working software. Of course, that's just a polite way of saying that it's safest to assume that the requirements are always wrong.

      The idea that users provide good requirements comes not from experience, but from an incorrect logical inversion of this argument:

      the requirements are wrong
      --> the users don't know what they want
      --> it's the user's fault
      --> it's not my responsibility

      The inversion:

      yes, it is your responsibility
      --> don't blame the users
      --> don't blame the requirements
      --> the requirements are correct

      Neither argument is correct in general, and neither can be applied as a blanket statement to all development.

  70. Re:The biggest problem is choosing the right langu by joss · · Score: 1

    If it should never be null, you should be using a reference anyway.
    Decent C++ code is a lot less crusty than java [although the custiness
    of java decreased a lot when they introduced generics].

    --
    http://rareformnewmedia.com/
  71. exactly how we did it. by russell.sawyer · · Score: 1

    "...The snag is that often we do not know exactly how we did it.'" Anyone seen my missing sledgehammer?

  72. finally by Anonymous Coward · · Score: 0

    i submitted this article last week, with nearly the exact same summary, and it got shot down in seconds.

  73. Re:The biggest problem is choosing the right langu by arevos · · Score: 1
    Sounds like Lisp to me

    Lisp has a habit of appearing rather messy at times, and some standard libraries (such as CLOS) are not particular elegant or aesthetically pleasing, at least to my eyes. I suspect that Lisp suffers from a lot of historical cruft in it's standard libraries - CDR anyone?

    I prefer the aesthetics of Haskell, myself, though it would be rather interesting to see how elegant and expressive one could make a Lisp dialect.

  74. Just give us by Anonymous Coward · · Score: 0

    std:: libraries that concentrates on _practical_ application development instead of spending forever defining the language in terms of cosmetic perfection and pure computer science and data structure.

    A lot of us are tired of choosing a database library, a threading library, an XML parser, RPC mechanism, network libraries, etc. etc. etc. even at the *prototyping* stage.

    That's why many developers flocked to Java/C# and never looked back. Not because of complexity, pointers, etc. Heck, I'm sure a lot of Java devs migrated from C++ understand all the C++ concepts, even the newer ones like Policy-based design.

    We went away because we don't want to spend time choosing or reinventing the same things over and over when we make a prototype of mock up and learning too much non-transferable knowledge about customized libraries. If C++ were like Java where the std:: API is constantly updated with common, basic, high level constructs (no, NOT vectors and stacks, I'm talking about portable network stacks , FIFO mutex locks and XML parsers) many of us wouldn't have left.

    C++'s problem is that it's too restrictive on how std:: should be updated.

  75. I am PROUD of SLASHDOT by kahei · · Score: 1


    Ladies and gentlemen, there are practically NO hairy old idiots banging on about how great LISP is in this thread! Well done, all!

    To address the cosmic imbalance caused by this sudden attack of maturity, though, let me do the job myself:

    Lisp is great because it is functional (except for some stuff they had to bolt on).
    Lisp is great because it is not functional (except for some old stuff from the early times).
    Lisp is great because it is the 'classic' hacking language, free of new-fangled gubbins.
    Lisp is great because it contains exciting new features.
    Lisp is great because it is easy and intuitive, because it is so pure and orthogonal.
    Lisp is great because it forces you to think to get anything done, because it is so pure and orthogonal.
    Lisp is great because it would be easy to write a worthwhile application in, because it is so pure and orthogonal.
    Lisp is great because as nobody has ever written an important application in it (editor macros and 1970s random story generators are not important), it's free to be pure and orthogonal.
    Lisp is great because it uses tail recursion instead of silly old 'iteration', because recursion is really pure and functional and orthogonal.
    Lisp is great because it can almost nearly manage plain ordinary iteration, by using a weird hack called 'tail recursion'.

    Lisp is great because of the Fourth Rule of the Internet:

    "The smaller and more specialized a fan community is, the more fanatical and argumentative they are."

    --
    Whence? Hence. Whither? Thither.
  76. Why should a language force you to think? by cquark · · Score: 2, Insightful
    I've been involved in more threads than I wish to recall slinging mud at C++ and there is always a strong representation from the crowd who aren't willing to invest the time to understand the object they are criticizing. The criticism fundamentally boils down to: why should a language force me to think?

    That's a good question. The purpose of a programming language is much the same of that of mathematical notation, which is to allow you to think at the level of abstraction of your problem while not wasting time with irrelevant details. Modern calculus notation gives university freshmen the ability to solve problems in a few hours that baffled the greatest minds of history for thousands of years.

    Note that this doesn't mean that you don't have to think when learning a mathematical language. The concepts of limit, derivative, and integral are difficult to grasp at first, but once you understand them, they offer powerful mathematical methods that allow you to think about the problem at hand and not the notation you're using.

    Can computer science make similar claims? The jump from assembly to FORTRAN was a tremendous improvement in productivity, but FORTRAN to C or C to C++ produced small to no productivity improvements, perhaps in part because you have to think more and more about the language. We should be looking for a language that may require thinking to learn, but that once when learned offers powerful methods at a high level of abstraction that allow you to think about the problem without being distracted by the language.

    I would suggest that we look at languages like Haskell, Scheme, or Smalltalk, which do require that we learn concepts like currying, higher-order functions, monads, and type classes, but which offer a higher level of abstraction and greater consistency than languages like C++ or Java.

  77. Or ... by cascadingstylesheet · · Score: 1

    >Same goes for VB. You make something that works the way
    >you expect, then you make it work in a real language.

    Or, if it actually works, you could just, like, use it :)

  78. Bjarne? by Anonymous Coward · · Score: 0

    Bjarne, is that you?

  79. The C++ Hater by Zobeid · · Score: 2, Insightful

    Not enough is made of the sheer obfuscatory nature of C++. C was already somewhat cryptic, but at least it was small. C++ is cryptic and large, and that's really a bad combination. At one point in the interview Stroustrup recounts that half the programmers he polled who said they disliked C++ then admitted they had never programmed an application using C++. He calls that prejudice. I call it perfectly normal human behavior; if you begin to study a language and quickly discover it to be a load of tailings, then you will be disinclined to program applications using it.

    That was my experience anyhow. I began studying C++, and at some point I stopped and asked myself, "Why must I endure this? Surely there must be better options." And I was right.

    I really have to grit my teeth when Stroustrup talks about C++ "winning" against competing languages. C++ is successful for the same reason that COBOL and Microsoft Windows have been successful: because they happened to appear in the right place at the right time, and were promoted by the right people, to become entrenched. Once entrenched, the world was saddled with them for decades to come. It has nothing to do with their inherent qualities or advantages, it's little more than random chance.

    1. Re:The C++ Hater by ChrisMaple · · Score: 1

      C++ is very much the opposite of COBOL and Microsoft Windows. The latter two are for the clueless; C++ is an advanced multilevel tool.

      --
      Contribute to civilization: ari.aynrand.org/donate
  80. Re:The biggest problem is choosing the right langu by ciggieposeur · · Score: 1

    Sounds like Lisp to me.... It's a mystery to me why anyone would voluntarily program in a language that makes the things that should be easy difficult, and makes things like segfaults, which should be pretty darn hard to do, easy enough to accomplish by accident. Yet so many people do it.

    I've been converting to Lisp since last January, and a few weeks ago I had a sore temptation to give up and spend more time on C++. Yes, I LOVE Lisp macros, CLOS is pretty powerful, and closures, and in general the "completeness" of the spec is astounding. HOWEVER:

    1) The packaging blows. The CL's have settled on ASDF, which requires two files in addition the the source (the .asd and the .lisp with the defpackage form) that must be kept in sync with the source too. I would much rather have "(import my.lisp.packagename)" and have it Just Work.

    2) Like Java, Lisp is both a language and a VM. In this case, multiple VMs that are all extended in incompatible ways to provide the functions that we need that aren't in the HyperSpec. The current OSS leader SBCL has rendered defconstant absolutely useless in flat violation of the accepted practice. A couple months ago I got CMUCL to segfault on an invalid pure-Lisp form. GCL doesn't yet support CLOS. I haven't yet bothered with CLISP, but I'm sure my code will expose other issues.

    3) Also like Java, Lisp is too far away from the underlying OS. Case in point: pathnames. My first project in Lisp was to iterate my MP3s and call stat() to get their size. Imagine my surprise when I discovered that it was possible for (directory #P"foo") to return a pathname whose (namestring) could not be passed to (unix:unix-stat) (this is CMUCL). CMUCL had taken the OS-specific filename and munged it to a Lisp filename that was at that point useless to me. So I had to write my own pathname that would actually work on Unix just so that I could get file sizes without having to open files.

    4) Performance really does matter. I've got Lisp code whose purpose is to read 30-100MB of floats, do some trivial manipulation, and write a few KB of output. The first version of the code took 5 minutes. After several DAYS of testing -- and learning that CMUCL has no decent profiler -- I finally figured out that the bottleneck was parsing floats. I dug into c.l.l and saw some code to improve parsing: CMUCL already had implemented that. I found two different libraries for parsing numbers, each improved performance significantly. I'm now down to about 1MB/second of processing speed. ON A 2.4GHZ PROCESSOR. My next step is to use UFFI to wrap strtod() and see if that makes things any faster.

    I'm staying with Lisp through another round. Maybe another year will give me the skillz to make Lisp on par with Java and then within 1.5x of C. I like the VM, I like the macros, I like the language and syntax. I may even volunteer to help with maintaining a CL and REALLY dig deep. But these humps are ridiculous and I can only hope the next generation of Lisp hackers fixes them for the future.

  81. security? by Lord+Ender · · Score: 1
    TR: In retrospect, in designing C++, wasn't your decision to trade off programmer efficiency, security, and software reliability for run time performance a fundamental mistake?

    BS: Well, I don't think I made such a trade-off.


    Holy ego alert, batman! Has BS ever worked in a modern, high-level language?
    --
    A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
  82. i think opposite by asmjunky · · Score: 1

    Personally I don't think starting off with "easier" languages is the answer, and I'll explain why. I started programming in VB3 and continued to do so awhile after the release of VB6. When I attempted to learn C it was very difficult at first. It was tougher and more of a bare bones and "do-it-all-yourself" language. It's when I really got heavy into C and assembly that I really learned about computer programming. Now, I think that if I were to start all over or teach someone to be a computer programmer, I'd have to say I would first teach them the basics of true computer programming in assembly. I wouldn't expect them to be an expert, but I would want that person to be able to atleast read and understand assembly and what a computer can do with data at that level. If you have a decent understanding of that, you can pick up any language a lot easier and quicker. Going from ASM to C would not be tough, hell, you'd welcome it and love it. And as your mind develops the "how things came to be" and structured thought of programming, learn something like C++ or anything with OOP. Once you have that knowledge you have a good sound understanding of programming in general which will make life a lot easier as you learn different languages, but having that sound foundation is the most important.

    1. Re:i think opposite by Anonymous Coward · · Score: 0

      I'd go as far as saying that all programmers should have some understanding of computer architecture as well. My language progression was basic, Pascal, Fortran and then C. Along the way I learned about computer architecture and assembly programming. I also learned C++ (which I hated) and finally Java. The language I still use most is C, though I really like Java as it seems to me to be C with objects done properly. My point is that if you don't really understand how computers work then you never really know what you language is doing for you.

  83. Re:Stroustrup complaining about the quaility of co by Anonymous Coward · · Score: 0

    I disagree. Stroustrup's "The C++ Programming Language" [TCPL] is one of a small set of computer books I am willing to reread.

    The first time I read TCPL, I thought it was a horrible book. I was trying to learn the language details and there appeared to be a significant amount of cruft and useless information. (For example, his discussion of how containers could have been object based.) It didn't simply detail how the language actually worked (to my dismay).

    Over the years, though, I've often found that the very sections I most disliked had the most useful information. If I'd paid more attention and thought a little harder about what Stroustrup was discussing, I would have avoided a number of programming pitfalls---and not just in C++.

    FWIW, I find the animosity toward Stroustrup in some of the posts very odd. Is it a pissing contest? My set of programming gods sit higher than yours?

    AC

  84. Forced methodologies. by jholzer · · Score: 1

    I always see the comment that most bugs are from memory mismanagement and pointers. I've been writing large C++ applications for 10 years. The most common bugs I see are usually fall into two groups. One group is very simple isolated logic errors and typos. The next group are from unknown side-effects from calling libraries/modules the programmer is not familiar with.

    C++ is amazingly good at hiding these side-effects. Frequently, even though code is broken up into different modules, a programmer needs to have a full understanding of all the other modules the module they are working on uses or is used by.

    This problem seems to be compounded with the increasing popularity of "event-driven" programming. I've worked on two systems that use event-driven programming and it is a pain to code for and really a pain to debug. I've seen some nasty hard to fix bugs from circular event cycles. The reason for these was because the programmer did not have a full understanding of all the modules that sent and received events from the module he was working on.

    A recent application I worked on used QT slots and signals for ALL communication between classes. I had to spend a large amount of time understanding the whole system and figuring out what classes received what signals just to fix something that turned out to be a 2 line code change. The signal was propagated through several classes before it got to the class that really did the work.

    It seems that programmers are trying to take things that work well in GUIs and forcing them on the code that does the algorithm code behind the GUI. Object-oriented and event-driven is really nice for GUI programming, it can make programming non-GUI elements of an application very difficult. Some problems just aren't OO, yet when a program is determined to be OO, everything is forced down that path no matter how ugly the OO design is.

    What we need is an easier way to use the methodology that best fits the current problem. The problem is that no language allows you to use different methodologies effectively. Some problems map very well to the functional methodology, yet it is not easy to do using C++.

    If different languages could work together easier, it would help. Then the proper language and methodology could be used for the given module. Managers would then complain that they would need to find programmers that knew more than one language, so it won't happen. I'm waiting for C++HaskLog. Then programmers will be able to use procedural, OO, functional or logic programming all in one language.

  85. Hiring a programmer? Give them this test. by Anonymous Coward · · Score: 0

    0) flow chart a ring buffer
    1) write a program to calculate something using shell script. 'something' might be pi, the area of a triangle, the volume of a cone, ...
    2) flow chart a two pass compiler

  86. Backwards by russotto · · Score: 1
    '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.'
    No, alas, what we generally do is build unreliable systems out of reliable parts.
    1. Re:Backwards by OneSmartFellow · · Score: 1

      This has certainly been my experience - myself hopefully NOT included. I am always fighting my boss and his boss for time to fix bugs with our systems rather than continuously adding new functionality.

      This, as almost every coder on /. will know, is a losing battle. I simply refuse to release my code until I feel comfortable with the quality (I know it's not bug free, but at least it doesn't break frequently), I wish the same could be said for so many of the guys I have worked with. They simply want to please the boss, without regard to maintaining their own standards. As a result our 'customers' internal to the companies I work for, lose faith in our ability to deliver quality products. The whole industry is depressing. I think I'll go sit in the closet now. Bye.

  87. not-so-strongly-typed variables by mosel-saar-ruwer · · Score: 3, Insightful

    it's not-so-strongly-typed variables, funny rounding rules and so on

    I know they're like [pagan] Gods to an awful lotta people in the CS community, but The Founders of The Art, guys like Kernighan, and Ritchie, who had the chance to insist that a declaration actually mean something, but hesitated, and hemmed and hawed, and got all wishy-washy, and finally decided [really deferred a decision until it was too late to make a decision] that a declaration could mean any-damned*-thing that the implementor wanted to interpret it to mean, well those guys, those pagan Gods of the Founding Arts, seriously - someone should take them out behind the toolshed and whip their asses** [if not shoot them outright].

    So now, fast forward 30 or 40 years, and we've got:

    "floats" in the ATI GPU world that are only 24 bits in length
    "floats" in the nVidia/Microsoft/IBM/Sony/Cell world that are 32 bits in length
    "floats" in the classical Unix world [e.g. SunOS/Solaris] that are 64 bits in length
    etc etc etc
    And then you go to do something in VB, or in Javascript, and you get shit** like

    2 + 2 = 4.0000000000012459
    or, what's even worse,

    2 + 2 = 22
    and you end up having to write shit**** like

    var i = parseInt(2);
    var j = parseInt(2);
    var k = parseInt(parseInt(i) + parseInt(j));
    window.alert(i + " + " + j + " = " + k);
    and you scream at your computer, "YES, THESE ARE NUMBERS, NOT CHARACTER STRINGS, YOU GOD-DAMNED***** COMPILER/INTERPRETER/SYNTAX/PARADIGM/NIGHTMARE OF A SACK OF SHIT******!!!!!"

    PS: There is a special circle in Hell******* for the sonuva bitch******** who dreamed up the idea of interpreting variable types on the fly...

    *Pardon my French.
    **Pardon my French a second time.
    ***Pardon my French a third time.
    ****Pardon my French a fourth time.
    *****Pardon my French a fifth time.
    ******Pardon my French a sixth time.
    *******Pardon my French a seventh time.
    ********Pardon my French a final time.
    1. Re:not-so-strongly-typed variables by 2short · · Score: 2, Informative

      K&R did not commit Javascript, and aren't responsible for the problems in your examples.

      K&R invented C. In it, and the myriad that follow it's lead, variables will sometimes get converted to closely related types for the purposes of expressions that need them. I for one want to be able to write

      float x = 2.0 + 2;

      without the compiler throwing up it's hands in a panic not knowing what to do.

          But numbers will not be converted to strings, and of course conversions will have no lasting effect on the variable in question. That would obviously be completely insane, and the utter moron who thought it was a good idea should rightly be forced to write javascript all day, and electro-shocked for every bug.

      Finally, if the number of bits in your floats matters, you can specify it precisely. If, with any regularity, you'd rather have a specific number of bits in your floats rather than whatever the processor handles natively (and thus rapidly), you shouldn't be using floats. Floats don't represent things exactly, no matter how many bits they have. (Well, contrary to your example, they tend to represent powers of two exactly, but that's just trivia.)

    2. Re:not-so-strongly-typed variables by BritneySP2 · · Score: 1

      > "K&R invented C."

      C is not a light bulb. Way too often I hear that someone "invented" a programming language or an OS (as in: "L. Torvalds invented Linux"). Programming languages (and OSes) are designed, not invented. To invent something means to find, through a long series of trials and errors or, sometimes, luck, a way of doing something that nobody knew how to do before; it is right in the middle between "to discover" and "to design". You could probably say, though, that certain constructs in C (as in other languages) - as ways of achieving certain goals - were "invented".

    3. Re:not-so-strongly-typed variables by HeroreV · · Score: 1
      I for one want to be able to write
      float x = 2.0 + 2;
      without the compiler throwing up it's hands in a panic not knowing what to do.
      When will we see the day that IDEs are smart enough to convert that "2" to "2f" or "2.0"? IDEs are way too damn stupid and lazy. There are lots of IDEs like NetBeans that do it badly, so you'd think eventually somebody would do it right.
    4. Re:not-so-strongly-typed variables by 2short · · Score: 1

      I'd hate that! That "2" means something different than "2f". I enjoy various software that offers options for what it thinks I might mean if it does it unobtrusively, but I absolutely despise editors that won't let me type what I wish to type no matter what it is. Now in this case, the differentce between that "2" and "2f" and any half decent compiler will be throwing out the whole "2.0 + 2" for a "4f" right off the top. But that's just all the more reason to assume if I wrote "4" in such an idiosyncratic way, I must have wanted it to look that way specifically.

  88. Bjarne said it best right near the beginning by msobkow · · Score: 2, Insightful

    From the article:

    I think the real problem is that "we" (that is, we software developers) are in a permanent state of emergency, grasping at straws to get our work done.

    How often have you worked on a prototype or demo, only to have the time/expense budget slashed because management decided you must be almost finished when they see a demo GUI?

    How often have you encountered copy-paste-edit code replicated throughout a system because no one had the time to refactor the replicated code into a reusable module?

    When did you last have the time and budget to clean up that rushed prototype via refactoring before the next phase was in crunch mode?

    How often were you told you can't refactor code because it's already been tested and put into production?

    How many "silver bullet" tools have you tried over the decades, only to find that they're marketing hype and often increase the total workload instead of saving time? (e.g. Now you have to maintain UML models as well as the code and database schemas.)

    As long as the "push" is to get it done faster regardless of long-term costs, crap code will continue to churn.

    --
    I do not fail; I succeed at finding out what does not work.
  89. Re:He summarizes one of the big issues in SD now.. by misleb · · Score: 1

    So what you are saying is that the quality of commercial code has very little to do with business pressure and is mostly just a result of unskilled and/or unmotivated programmers.

    Anyway, I'm tired of programmers complaining about how their company stifles their greatness... as if they were producing greatness outside of work (or would given the chance).

    -matthew

    --
    "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
  90. Re:He summarizes one of the big issues in SD now.. by TFloore · · Score: 1

    Time pressures and price are fundamentally incompatable with code quality, even amongst the best programmers.

    This is summarized in an old engineering saying. Not just software development, but pretty much all design and construction and engineering has the same issue.

    Good.
    Fast.
    Cheap.
    Pick any two.

    This ignores other things that contribute, like how good the people involved are. But it is still a very valid saying.

    --
    This is my sig. There are many like it but this one is... Oops. Frank, I've got your sig again! Where's mine?
  91. Parent is not a troll by try_anything · · Score: 1
    If you read the high-quality C++ books on the market and read back issues of the C/C++ User's Journal (now defunct), it's clear that the C++ language as promoted by experts and supporters takes years to learn. A C++ application written in good style will be very difficult for a beginner to understand and can only be further developed under the direction of a seasoned C++ programmer.

    I don't agree that "the earth would be a better place without this plague," but I'd like to see it replaced by something better, such as a pair or family of languages (with easy, natural, logical interoperation) that cover the same ground covered by C++.

  92. problem by treak007 · · Score: 1

    The main problem with programming is caused by the lack of education. A lot of schools are spending more time teaching a programming language (usually a higher level language like python or java) rather then teaching concepts of computer science. Of course the kid who has only programmed in java is gonna find concepts like pointers and such more difficult, making C++ seem much more difficult.

    --
    Klingon Software is not released, it escapes, inflicting terrible damage onto the enemy as it does
  93. Re:the problem with programming are books by Bjarn by try_anything · · Score: 1

    Are you kidding? That's the best-written book on C++ on the market, and one of the best computing books, period. Most of the books on the shelves at Barnes and Noble are written for idiots with years of experience -- all they know how to do is appeal to ill-fitting concepts you've already learned in another domain. The best books, like TC++PL, are the ones that clearly and logically teach concepts, which requires a bit of intelligence on the reader's part but saves him from sloppily carrying over inapplicable concepts from one domain to another.

  94. Re:The biggest problem is choosing the right langu by Anonymous Coward · · Score: 0

    The "down close as you want to the underlying hardware" that you do in C is simply bit-twiddling in random locations in memory.

    C compiler technology is good not because C necessarily maps well to modern instruction set architectures and real machines, but because C is so popular that people have invested a great deal of time in optimization to make up for the poor mapping of automatic and register variables to the stack and machine registers of real processors, and the order of operations in the source to an efficient order of processor instructions, among many other things.

    A number of functional programming languages have even better compiler technology available to them, but because of the huge popularity of C and its descendents, few people are even aware of that, and those that are tend to resist moving from a C (or C with objects) mindset to a functional programming one.

    Most of these FP languages can call out to standard libraries written in other languages, either directly through a native FFI or through some sort of bridge. Some also have native primitives that allow for the same sort of arbitrary and unmediated memory manipulation that is done in C, if you really want to do that.

    Moreover, a handful of interesting ones allow C to invoke libraries written in these FP languages, making mixing-and-matching language/compiler to the computational tasks they're good at fairly easy.

    Writing everything in C or C++ just because the compiler is pretty good at generating object code is silly, since speed is rarely globally critical within a program. The speed-requiring bits can be coded in C (as a sort of portable assembly) while the rest can be coded in something that trades speed for greater safety or greater expressiveness or both. As you say, "this doesn't matter much in your average desktop software". So why resort to C or C++ all the time?

    Indeed, many speed-critical sections of applications written in C or C++ actually include inline assembly, especially when a vector processing unit is available. Examples can be found in "3D games, simulations, animation/rendering systems [and] system libraries". That's because despite the ease of manipulating arbitrary bits in memory in C, often the language and compiler end up producing results which simply aren't as fast as one can do by hand in an even lower level language (like a macro assembler).

  95. Functional & Procedural by Midnight+Thunder · · Score: 1

    I would actually say teaching functional and procedural would be good too. When I was at university they started teaching functional (Miranda) and procedural ( C ). Then they added object based (Ada) and assembly. If a suitable OO language was available then they would have taught it. Smalltalk was available, but most of the VMs were a fortune.

    My point is that I think a good CS course should include a wide variety of programming languages, so people learn to be flexible. Given how fast things change in IT learning flexibility of mind is important IMHO.

    --
    Jumpstart the tartan drive.
  96. why not use for i/o? Side effects by slew · · Score: 1

    Rightly or wrongly, many people assume that there are only a limited number of "side-effect" from operators other than the "="/ASGN and "++" and "--" operators because it looks a little bit like "algebra" instead of an evaluation expression.

    Some of the original design features of C make this a little bit more unlike most people's experience with algebra (e.g., the use of "=" instead of ":=" and other keystroke savings shortcuts often confuses people with expression like "i=i+1") and reduces the visual cues for side effects.

    Later on C/C++ introduced "const" functions to between functions and procedures, but there aren't any syntactic visual cues for the person reading the code and at least for me, that is why I try to steer clear from operators that have "user-visible" side-effects to promote code readability...

    Also, binary operators often have a visual ambiguity problem with precidence and are generally poor candidates for overloading (because people don't always remember the precidence orders of the operators on inspection in an arithmetic context, it's even worse when you lose the aritmetic context and have to remember them explicitly).

    Of course, it's probably a losing battle with C++, but personally, I think it's worth trying to mitigate to the extent we can. It's too late for bit shift on I/O, but at least we can avoid it going forward. Just because operator is meaningless, we assign it some meaning might be okay, but only if it fits in the semantic framework that most people have. If it doesn't fit the framework that most people have, it's just another barrier to learning and it's a bad pattern/example to set for people to emulate. Remember it isn't technically part of the language, but the library, and people are writing new libraries all the time (and making more overloaded operators at the top scope of their programs all the time for the new objects they create).

    Following your logic would argue that multiply doesn't mean anything on pointers, so it is okay to make it an overloaded operator to increase the reference count and make a backup of the underlying object in a log file (multiply like rabbits). I think that would be a totally broken use of the multiplication operator myself.

  97. Re:The biggest problem is choosing the right langu by bar-agent · · Score: 1

    Which means you learn nothing other than a new syntax to program your same old style in (i.e, nothing worthwhile)....If you're really short of time, you're better off using it to learn Erlang, Prolog, or Smalltalk.

    You missed the part where I said "explore out from there." Erlang, Prolog, and (to a lesser extent) Smalltalk have steep initial learning curves. It's hard to ease into those language and do something useful right away. With Dylan, the o.p. can program in a style he is used to, but gradually adapt newer techniques as he becomes comfortable with them.

    The o.p. had already mentioned LISP, and said he didn't have the time to deal with learning so much new stuff all at once. My suggestion was for an advanced language with less to initially learn.

    --
    i'd hit it so hard, if you pulled me out you'd be the king of britain [bash.org]
  98. You are looking for Java by Anonymous Coward · · Score: 0

    Stroustrup did not consider the scope for misuse by stupid people.

  99. Plus you need practice. A lot. by durdur · · Score: 1

    Agree. Plus there is the issue of how much time you need to get proficient. There is almost no way taking a CS class and doing a few assignments will give you enough practice to be really fluent in any computer language. It will get you semi-competent at best and you'll be a danger if let loose on a real-world project. But if you spend some extra time outside of class coding something you care about you may have a chance at proficiency. It is like the difference between someone who's going to a guitar lesson once a week vs. the guy who has has own band (however bad) and is spending all his spare time on it. Which is not to say some book knowledge and assistance won't help but practice is a big part of it, in my experience.

  100. Checking need not add significant overhead. by Animats · · Score: 1

    Fixing the "safety problem," as you call it, would involve an increase in execution time.

    That's a common belief, because the safe languages we have now are mostly inefficient ones, but it's wrong. Subscript checking is cheap if done right, in the compiler with appropriate optimization, because most subscript checks can be hoisted out of inner loops. This was done in a British Pascal compiler in the 1980s, but I don't have the reference handly.

    The problem in C and C++ is that there are too many cases where the compiler doesn't even know how big an array is, so the compiler can't check. If you try to do subscript checking in collection classes, the checking is inefficient because the compiler doesn't know enough to optimize it.

    Here's the general idea of how to do it right:

    float sumarray(size_t n, float tab[n]) /* C99-type array size notation */
    { float sum = 0.0;
    for (size_t i=0; i<n; i++)
    { sum += tab[i]; }
    return(sum);
    }

    That code implies a test for i < n at tab[i]. That would seem to add overhead. But if we allow the compiler to hoist checks upwards, that test floats to the top of the FOR statement. We then have the test of the FOR statement, i < n. So we have "i < n implies i < n, as the test, which symbolically evaluates to TRUE at compile time and can be eliminated. The compiler can thus this do this subscript check with zero overhead.

    That's how you get safety without overhead.

    Certainly there are situations where the checks can't be performed entirely at compile time, but usually, they can be pulled out of an inner loop by standard compiler hoisting and strength reduction techniques. So the overhead is quite low in code hot spots, where it matters.

    Note the syntax float sumarray(size_t n, float tab[n]). That's C99 variable array syntax. Instead of writing float tab[], or worse, float* tab, you actually give the array length. This doesn't cost anything, because the length isn't actually being passed. It just tells the compiler where the length information is to be found, should it be needed.

    At a call to sumarray, checking is also possible. Consider

    float tab nums[1000];
    ...
    float tot = sumarray(tab, 1000);
    The compiler has the declaration of "sumarray" available, as float sumarray(size_t n, float tab[n]). So, given this, the compiler can check the call. It needs to check that lengthof(tab) >= 1000. No problem there; that can be evaluated at compile time.

    I've suggested that C99 array syntax be generalized to give parameters the scope of the entire declaration, allowing float sumarray(float tab[n], size_t n), where n is referenced before its declaration. This allows standard C idioms like int write(int fd, char buf[n], size_t n).

    Microsoft R&D is working in this direction for C#. Check out the "Spec#" effort. The trouble with C++ is that the language is so broken that you can't use such technologies.

    We had much of this technology working in the early 1980s, but machines were too slow back then to tolerate the compile times. With the 3000x improvement in CPU speed since then, that's no longer a problem.

    1. Re:Checking need not add significant overhead. by Kupek · · Score: 1

      That is interesting, and thanks for the pointer to Spec# (I'm re-reading the tech report on Singularity for my quals, so it's relevant to me at the moment). But Stroustrup makes clear in D&E that any overhead was unacceptable. While checks can be done at compile time, not all of it can. (I think that most difficult to spot errors are going to happen in places where it's not a simple 0 to N for loop.) If there had been any overhead, C++ probably would not have become as widely adopted as it is now.

      Also, these techniques should be possible in C++ through templates. If you want safety, then don't use naked arrays. I realize that's not any help for code you inherit, but good design can avoid these problems.

    2. Re:Checking need not add significant overhead. by Animats · · Score: 1

      That's the party line, but it's wrong.

      First, there is overhead for not checking. The extra reboot time, the lost work after a crash, the overhead of all the viruses, spyware, and adware that got in because of buffer overflows - all those are overhead.

      Second, you can't do this as efficiently with templates, because the compiler needs to know more about the checking to optimize it. If you rewrite the code above with a <vector> class, it will be slower. You've deferred compile-time work to run time.

    3. Re:Checking need not add significant overhead. by Kupek · · Score: 1

      Simply using a std::vector won't do the job. But I think it's reasonable to implement what you described with templates with checks at compile time - but I'm not sure as I have not done it.

      Again, Stroustrup was concerned with runtime effeciency. C++ was intended to be a systems programming language with high level abstraction mechanisms. It was not intended to be a language with runtime checks for correctness. All of the overheads you mention are real and I won't disagree with them. I think that there are many domains where checked languages are appropriate and desirable. Since what you want runs contrary to the original design goals of the language, then I just can't consider your complaints valid.

    4. Re:Checking need not add significant overhead. by Animats · · Score: 1

      An "original design goal of the language" for C was that the compiler had to fit in a PDP-11 with 64K. That's why the language is so close to PDP-11 hardware. (The "++" operator reflects a PDP-11 hardware feature.) It wasn't until the late 1980s that C compilers started to optimize significantly.

      Once you have an optimizing compiler, the speed issues are quite different. The question is not how close the language is to the hardware; it's how well the compiler can understand the language. Issues like aliasing assume greater importance, because they interfere with optimization. Issues like whether you write *p++ or tab[i++] assume less importance, because the compiler will usually generate optimal code for both approaches.

      Once subscript checks can be optimized, about 95% of them go away or are hoisted out of loops.

      Subscript checking has a bad reputation because many existing implementations are terrible. The one in 1980s Berkeley Pascal was notoriously bad; it called a subroutine for every subscript check. A whole generation of programmers had their minds damaged by that. Some modern implementations do it by carrying around extra information with each array and pointer, which is similarly inefficient. It has to be done right, and in the compiler, to be efficient.

      Worse, C and C++ don't carry around the information to do it right. Previous postings in this thread indicate how the problem could be solved.

  101. I've always thought of his book... by alispguru · · Score: 1

    The Design and Evolution of C++

    as

    The Design Rationalization and Evolution^WMutation of C++

    for just that reason.

    --

    To a Lisp hacker, XML is S-expressions in drag.
  102. Garbage collection isn't a good fit to C++ by Animats · · Score: 1

    Garbage collection isn't well matched to C++, because C++ has destructors. Reference counting, like Perl and Python, is more appropriate. Microsoft did retrofit garbage collection to C++, in their "Managed C++ for .NET", but the result is horrible. Calling destructors from the garbage collector results in concurrency problems, locking problems, and indeterminism in otherwise deterministic programs. There are even some awful cases in Managed C++ where "re-animation" occurs and a destructor is executed twice.

    With reference counts, you get consistent behavior. You do need weak pointers (in the Perl sense, not the Java sense) to make it work. There are "smart pointer" classes for C++ which attempt to do all this, but they all flounder on the problem that at some point, you have to expose a raw pointer to use the object properly. This makes the reference counting system too fragile.

    1. Re:Garbage collection isn't a good fit to C++ by master_p · · Score: 1

      Garbage collection isn't well matched to C++, because C++ has destructors.

      Destructors are no problem for GC in C++: if you want determinism, don't allocate the objects on the heap, allocate them on the stack.

      Reference counting, like Perl and Python, is more appropriate

      All apps I have been a member of have referential cycles, which are pretty hard to locate especially if the cycle is introduced by subclasses.

    2. Re:Garbage collection isn't a good fit to C++ by luzr · · Score: 1

      Destructors are no problem for GC in C++: if you want determinism, don't allocate the objects on the heap, allocate them on the stack. Yes, that is naive solution. But that does mean that you cannot use objects with destructors as member attributes of GC collected objects. Think e.g. struct MyFoo { int x; istream bar; }; Now what? Will you call bar's destructor at sweep phase? Or are you going to disallow putting objects with destructors to GC?

    3. Re:Garbage collection isn't a good fit to C++ by master_p · · Score: 1

      No, it's not naive at all. When MyFoo is destroyed, it's destructor will be called as if object MyFoo has been manually deleted, and therefore calling the destructors of any member objects.

    4. Re:Garbage collection isn't a good fit to C++ by luzr · · Score: 1

      Well, that is probably better of two bad solutions and it is what M$ done in managed C++. One of disadvantages is that it hides a lot of hard to spot bugs. With generational collectors, forgetting to release resource will be in 99.9% hidden by GC, but in 0.1% will cause deadlock.

    5. Re:Garbage collection isn't a good fit to C++ by luzr · · Score: 1
      From GC faq:

      Many GC systems have a notion of "finalization." An object may be registered with the GC system so that when it is about to reclaim the object, it runs a function on the object that can perform necessary cleanups. Finalization is tricky. Some of the issues are:

      1. When can an object actually be finalized? This is trickier than it first appears in the presence of some normally-desirable optimizing transformations.

      2. In what thread, resource, or security context does a finalization function run? 3. What happens when registered objects reference each other?

      4. What happens if a finalization function makes an object not be garbage any more?

      Now add one special to this list: Destructors were not designed as finalizers in the first place....

  103. There, there. by Spaceman40 · · Score: 1

    Take two type-inferring languages and call me in the morning.

    (That said, the general sentiment that a standard should strictly define everything that is important is a great one. The problem is determining what's important. When your language is one that is meant to sit directly on top of machine code (like C), the size of a numeric type is important. Grr.)

    --
    I [may] disapprove of what you say, but I will defend to the death your right to say it.
    1. Re:There, there. by 2short · · Score: 1

      "When your language is one that is meant to sit directly on top of machine code (like C), the size of a numeric type is important"

      Yes. It is often very important that it be a size that is native to the machine in question. In well written code, this is often much more important than exactly what that size is. A concept C handles nicely.

    2. Re:There, there. by Schraegstrichpunkt · · Score: 1

      C99 has constant-size integer types. Previous versions might also. POSIX does too, apparently:

      #include <stdint.h>

  104. application code != library code by loqi · · Score: 1

    C++ is successful for the same reason that COBOL and Microsoft Windows have been successful: because they happened to appear in the right place at the right time, and were promoted by the right people, to become entrenched.

    You're half-right. C++ "won" the application development language contest for these empty reasons. However, part of its staying power comes from the fact that, sooner or later, you need a "low-level" language to actually write fast code behind a well thought-out interface, once, and call it a library. These are two vastly different purposes, and I'd agree that C++ is as ill-suited to large-scale application development as VB is to efficient library development. However, the folks out there who need fast linear algebra routines, or lean, memory-efficient text searching, or [insert well-defined write-once problem here] often choose C++ for the right reasons.

    Now, there's a legion of people that will shout "use C for that!", while trotting out the same application-level arguments they always use against C++. If there are any doubts in your mind about the advantage in expressiveness C++ has over C, take a look at the Blitz scientific computing package. C++, in some cirumstances, grants a pretty magical ability to create useful abstractions with essentially no abstraction penalty. Even if the code behind the abstraction is a template swamp, the code in front of it (the application code, the code that will be read and rewritten much more often) reads clear as day, without sacrificing performance. No, it's probably not the best language it can be, but for creating powerful, ruthlessly efficient, reusable abstractions, I don't see it as having any competition whatsoever.

    --
    If other reasons we do lack, we swear no one will die when we attack
  105. Re:He summarizes one of the big issues in SD now.. by roman_mir · · Score: 1

    You are of-course correct.

    On the other hand... On the 5th of October I had a first draft of a design document for a new system, I didn't quite understand yet on my hands. The deployment was scheduled on the 12th of November. The deadline was pushed down onto the development team from the absolute powers above. By the 10th of October I finally had an idea and a first draft of a design document, which actually made some sense. The system was supposed to be 'flexible', 'maintainable' and 'extendable'.

    Now, I take those three requirements with a grain of salt, especially given the deadline and the subjective nature of the words like 'extendable'. I didn't have a choice of deadline, I didn't have a choice of functionality but something had to give, so I talked to the manager asking for overtime permission and I got it. From the 10th of October until the 1st of November I put a few hundred hours into the project, by mid-October I had 2 more people start on the project. I kept the back-end framework, another developer kept the front-end framework and the third developer had to translate the business requirements into the framework. We deployed on the 12th, the system is extendable in form or interface implementations and database data setup. The system is fully documented and unit/integration tested (we wrote all of the unit and integration tests, no QA time was allocated except for the very last week before deployment) So we delivered the system by the 12th, the users are happy enough but obviously the next releases had functionality changes. However in the process of delivering this, we sacrificed our lives completely to the project.

    After the 12th, some of the new requirement came and we were able to deliver them (tested) within hours, since the original framework is sound.

    My thinking is that it always pays to build the project to the best of your abilities and to think of the design, it will pay off at the end,

    BUT only do it if you are getting paid for each hour of the work, preferably as a contractor.

    Cheers.

  106. Slightly OT: Curriculum of Languages by Spaceman40 · · Score: 1

    Forcing students to learn a few languages with different-looking syntax might help.

    Computer Science is a gigantic field, yet most colleges seem to think they can teach it as one big, coherent major (that usually requires a load of credit hours to complete). My idea for Computer Science curriculum, with reasoning (sorry if this is off-topic):

    CS101 (core): Scheme: Basic Algorithms and Data Structures Introduction to computer science. Scheme is a minimalistic language, and is a great one to slowly introduce concepts to a class. The general premise of the language is simple, and easy to teach in stages. It's also an interpreted, declarative language, which will provide a contrast to those learned later on. CS102 (core): RISC Assembly: Advanced Algorithms and Data Structures Introduction to computer programming. Assembly (imperative, hardware-dependant) is as far as you can get from Scheme (declarative, hardware-independant). This exposes students to the far reaches of their discipline, giving them some basic knowledge of what computer science is about. It also allows students to figure out early if they want to stick it out, or go into an engineering major (or business, for that matter). CS103 (elective): Overview of Declarative Languages Prolog, Lisp, etc. Prerequisite: CS101. CS104 (elective): Overview of Imperative Languages C, Java, etc. Prerequisite: CS102. CS201 (core): Products of Software Engineering Overview of the big systems. This class doesn't have a language attached to it because it won't have programming assignments. The idea is to take a look at the four wonders of the programming world: operating systems, database management and other large, integrated systems, compilers and interpreters, and artificial intelligence and expert systems. This is an introduction-type class, presenting the general ideas and concepts present in the major types of software. The field is a large one, and this major is not meant to produce experts at all parts of it. CS202 (core): Practical Software Engineering Team-based programming. This is a project-based class. The purpose of it is to take the class through the process of designing, constructing, and releasing a (small) project. Introduce source control, unit testing, and automation. Language and project up to the professor or (at best) the class itself. Scope must be small enough to complete in one quarter/semester. CS203 (core): Ethics in Computer Science What responsibilities do programmers have? To their clients? To themselves? To the general public? Less of a presentation or prescription than a discussion. Discuss open source/proprietary licenses, military/intelligence software, etc.

    After sophomore year, all classes are electives (except for one, see below). A student must take so many 3xx level and so many 4xx level to graduate. Choosing an emphasis (on the research - development axis, perhaps) determines the electives, or the student might talk to their adviser and create a custom/general major. Electives at the 300 level include expanded treatment of the topics in CS201 (systems programming and OS development, DBMS and web server development, programming language concepts and development, artificial intelligence and expert system concepts and development), and branch to more specific areas by the 400 level.

    The one other required class is a 400 level project class. It is taken independently, with few requirements: student(s) present a proposal to the CS faculty at the beginning of their junior/senior year, who accept or reject it based on its scope and perceived difficulty. Once a proposal is suggested

    --
    I [may] disapprove of what you say, but I will defend to the death your right to say it.
    1. Re:Slightly OT: Curriculum of Languages by try_anything · · Score: 1

      I disagree with many of your points, but I love your idea of starting at the extremes: a class in Scheme (a simple, safe, high-level, supportive language) and a class in assembly language (quite the opposite!) That's a brilliant idea, IMO, and easily the most interesting thing I've read this week. Replace Scheme with a purer, less flexible language, such as Haskell, and it's even more interesting, though perhaps less of a good idea.

      Here are two Corrections, two Objections, an Addition, and a Cool Idea:

      Correction 1: The Lisps (including Scheme) support imperative and OO programming as well as functional programming,.

      Correction 2: Scheme is just as often compiled as interpreted, but that doesn't really matter. At some point students should use a compiled language so they can learn to read compiler output and tweak their source to produce better object code. Beyond that, the implementation of a language doesn't matter. (Dynamic runtime features like class loading, function redefinition, and runtime code generation by no means require that a language be interpreted!)

      Objection 1: "Overviews" of languages are evil! You can't learn very much about a language without 1) doing a significant project, and 2) learning the language well enough to work around its weaknesses and discover its strengths. Students should be given at least a semester to learn a language that well, especially since they may be learning other languages at the same time in other classes. You don't want to teach xenophobia by setting them up to fail with new languages :-) If they became familiar with an assembly language and attained practical proficiency in C, Prolog, Haskell, and Java, and never saw any other languages at all, that would be a much better linguistic education than current CS majors get.

      Objection 2: Too much flexibility. Operating systems, upperclass-level algorithms, and the intro theoretical class ("languages and automata" or some such) should not be optional classes, if only because they're the vehicles for teaching basic literacy in topics that all CS majors have to deal with: models of computation, models of concurrency, fault tolerance, security, and others. Every student needs at least a passing familiarity with these topics, because every developer encounters them over and over again in their careers, even if they don't realize it. Plus, without some structure to the major, students could accidentally or intentionally graduate with a very limited education. For example, a student could decide only to study things that he already understands the value of, or avoid classes that require projects in a purely functional language. A well-designed curriculum should ensure that any path to a degree requires competence at fundamental skills and concepts (e.g., functional programming, concurrency analysis).

      Addition: Students should be given canned (preprepared) projects that require them to deal with already-written code. Hand them a 500,000-line poorly-documented monstrosity (maybe a specially prepared version of a dead commercial product) and tell them to make a 20% performance improvement or add a certain feature.

      Cool Idea for a first software engineering class: Second half of the semester: Students are given a specification for a piece of software and split into four groups that each complete the entire specification, producing a working, documented system. First half of the semester: Students are given a specification for a piece of software and specifications for a number of changes and extensions. Every change and extension must be added to each of the four implementations produced by last semester's students :-) Since they've just finished cursing the work produced by last semester's students, they'll be well-motivated to do good work themselves.

    2. Re:Slightly OT: Curriculum of Languages by Spaceman40 · · Score: 1
      Thanks for your response! Like I said, this was off-the-cuff, so please forgive my minor errors (I know about imperative Lisp code, compiled Scheme, etc.).

      Cool Idea for a first software engineering class: Second half of the semester: Students are given a specification for a piece of software and split into four groups that each complete the entire specification, producing a working, documented system. First half of the semester: Students are given a specification for a piece of software and specifications for a number of changes and extensions. Every change and extension must be added to each of the four implementations produced by last semester's students :-) Since they've just finished cursing the work produced by last semester's students, they'll be well-motivated to do good work themselves.
      I like it!
      --
      I [may] disapprove of what you say, but I will defend to the death your right to say it.
  107. It's the programmer, and partially the tool by Mock · · Score: 3, Insightful

    While you can bash the tools as much as you want, the point remains that the majority of the fault for bad programs lies with the programmer.

    Just as an adept sculptor can build a beautiful (though somewhat rough) art piece using a chainsaw, so can a good programmer make do in situations where he is forced to use the wrong tool for the job.

    Namespaces can be simulated with a good naming convention.
    OO can be accomplished in a procedural language.
    Technologies can be married together, and even replaced in part with other technologies at a later date (it's called refactoring, folks!)

    I currently program exclusively in Java. I learned from the ground up (Analog electronics -> Digital logic -> Machine code & Assembly -> C -> C++ -> other OO languages & scripting languages, AOP etc)

    I'd love to have multiple inheritance in Java, but I hate the fact that you can't rebind a reference in C++.
    I'd love to have real properties and closures supported by the Java language proper, but I make do with standardized boilerplate code in the meantime.
    I love the quick UI building you can do in VB, but I certainly wouldn't want to write business logic with it!
    Access is great for building quick and simple systems, and does its job well, but I'm not going to store 10 million records in it!
    Nothing beats the speed of a library written in assembler, but I'm certainly not going to write database access code in it!
    Perl is a great tool in the right hands. In the wrong hands, it is the worst disaster ever, and the first thing I get rid of when I take over support of a project (except for 10% of the time when the previous programmer was competent).

    I've seen horrendous code in every language I've ever encountered, and it's always a result of the programmer not understanding what he's working with. My personal opinion is that you shouldn't be programming unless you understand at least one layer below where you're working.

    Do you know how to examine a core dump? How about interpreting a Java HotSpot dump?
    Do you understand how the technology you're working with interacts with the operating system?
    Do you know how the auto-code generator deep within the script overlay you're using actually works? Have you even once looked at the intermediate output?
    How about the .S files created by your compiler? Do you even know what they are? Could you load an object file into a disassembler?
    What will you do when something goes wrong with it? Give up?

    Do you follow the generally accepted practices used in your domain? Do you even know what they are?
    Do you know what domain driven design is?
    Do you understand when it's a bad idea to use inheritance? (Answer: most of the time)

    I could go on forever. The point is that good programmers find the right tool for the job because they understand how it all works. Hackers do it fast, but forget to make it readable or maintainable. Bad programmers just plain do a bad job and make things shitty for everyone.

    1. Re:It's the programmer, and partially the tool by icepick72 · · Score: 1

      The problem is sometimes shitty code can be subjective, believe it or not. Some people label Picasso's paintings as kindergarten output while others call them a masterpiece, and everything in between. It all depends on who you have learned from and the context of the situation. Programming that is shitty in one domain is perfect in another, and everything in between.

    2. Re:It's the programmer, and partially the tool by Anonymous Coward · · Score: 0

      ...but I hate the fact that you can't rebind a reference in C++.

      Then use a pointer instead, dumbass.

  108. Re:The biggest problem is choosing the right langu by dcam · · Score: 1

    I'm not trying to get into a flame war but why should it never return null? Returning null can be a way of saying whatever your function wanted to do couldn't be done. Eg, the function is part of a class factory and the class could not be created with the parameters passed in.

    --
    meh
  109. Re:The biggest problem is choosing the right langu by QuantumG · · Score: 1

    I'm of the school of thought that errors should be represented by exceptions. So, to use your example:


    Foo *FooFactory::create() throws(OutOfMemoryException) {
            Foo *f = new Foo();
            if (f == NULL)
                    throw OutOfMemoryException();
            return f;
    }


    Now the caller to create() has a guarentee that create() will return a pointer to a Foo, or it won't return at all. It also means you can call multiple functions that throw this exception and do all your out-of-memory handling in one place.

    --
    How we know is more important than what we know.
  110. Firefox is not a quality application. by Generic+Player · · Score: 1

    Its a huge, bloated, slow loading, memory hogging pile of crap. Its painfully obvious from trying to use it that the code must be awful, or they endless parade of stupid bugs would actually get fixed.

  111. My point of view by DimGeo · · Score: 2, Interesting

    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.

  112. CSuperDuperDoublePlus was renamed D. by Generic+Player · · Score: 1
  113. Re:He summarizes one of the big issues in SD now.. by julesh · · Score: 1

    Ok, then please explain why Open Source projects are full of flaws just like commercial products.

    There are a multitude of reasons. Some of them:

    1. Most open source is written to fulfill the developer's requirements. It may not perform so well for other people's requirements, largely because that's not something the developer has bothered with.
    2. Most commercial software is professionally tested. Most open source software is tested by amateurs.
    3. Open source software is usually released before its ready in order to attract a wider range of developers. This is often fatal, because the new developers are more concerned about adding nifty new features than fixing the existing flaws. This is what has happened to Firefox, IMO.

  114. Re:the problem with programming are books by Bjarn by kraut · · Score: 1

    If you're having problems reading Bjarne's books, you're simply having probems reading. Or programming. Or both.

    Sorry, but they're among the best and clearest programming books around.

    --
    no taxation without representation!
  115. Jack of all Trades... by Anonymous Coward · · Score: 1, Insightful

    That's a stupid progression to take. First of all, they'll likely never use Pascal. It hasn't been used on the Mac in well over a decade. Delphi is basically dead. It really doesn't offer anything over C.

    When you get them studying so many languages, they'll never become competent with any of them. You'll end up with a shitty C programmer, a shitty Perl programmer, a shitty Pascal programmer, a shitty Common Lisp programmer, and a shitty Java programmer.

    It's better just to stick with C++ and Common Lisp (or Scheme). C++ will give them a real-world language that is suitable for a wide range of embedded to desktop applications, while Common Lisp will expose them to functional programming and other critical concepts missing from C++. So now you end up with a well-rounded student who has had the time to focus only on a small number of languages, thus becoming proficient (hopefully) in both. At that point, they should be able to pick up languages like Java, Objective-C and Python within a day or so.

    1. Re:Jack of all Trades... by DragonWriter · · Score: 1
      When you get them studying so many languages, they'll never become competent with any of them.


      I don't think that's true; most people I've known that are even moderately good programmers were exposed to lots of languages either in or before college; I'd say the breadth helps or at least doesn't hurt. I think a Computer Science curriculum ought to involve broad exposure to the breadth of programming paradigms, both in terms of techniques and implementations in different languages.

      That being said, I'm not sure in the current context, even as a high-school level introductory language, Pascal really has all that much to offer, though its certainly what I grew up on when I "graduated" from BASIC.

  116. With all due respect.. by Anonymous Coward · · Score: 0

    Open up D so we can use it! What good is making a sane replacement for C++ and then only releasing binaries for a few platforms? We use solaris on ultrasparc, openbsd on amd64 and ultrasparc, and some old IBM junk running AIX. Why don't you want us to use D? What benefit are you getting from turning potential D users and contributers away?

  117. Re:why not use for i/o? Side effects by 2short · · Score: 1

    "Following your logic would argue that multiply doesn't mean anything on pointers, so it is okay to make it an overloaded operator to increase the reference count and make a backup of the underlying object in a log file (multiply like rabbits). I think that would be a totally broken use of the multiplication operator myself."

    No, folowing my logic would argue that multiply doesn't mean anything on pointers, so it is okay to use the same operator (asterix) in a unary mode to mean "dereference". Thanks, that's a great example of how using the same operator to mean entirely different things can be perfectly reasonable is the right circumstances.

  118. Re:He summarizes one of the big issues in SD now.. by misleb · · Score: 1
    1. Most open source is written to fulfill the developer's requirements. It may not perform so well for other people's requirements, largely because that's not something the developer has bothered with.


    We're not talking about features. We're talking about quality. If business stifles software greatness, the implication is that without the demands of business, you tend to get better quality code. And it isn't the case, so I quesiton the original assertion that business stifles programming greatness.

    Where is the software development utopia?

    Most commercial software is professionally tested. Most open source software is tested by amateurs.


    So in this sense, business actually IMPROVES overall quality. This is the opposite of the claim I was responding to.

    Open source software is usually released before its ready in order to attract a wider range of developers. This is often fatal, because the new developers are more concerned about adding nifty new features than fixing the existing flaws. This is what has happened to Firefox, IMO.


    Firefox seems pretty feature-slim to me. What is included in the base Firefox install that shouldn't be there? Without extensions, it is pretty basic. I guess maybe you could take out the popup blocker. But who DOESN'T want a popup blocker? Spell checker? Don't want spell checking on text inputs?

    I think the Firefox team has done a pretty good job of keeping the feature bloat down. One could even argue that FF 2.0 isn't even worthy of a major version jump. Should be FF 1.6.

    -matthew

    --
    "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
  119. Your French? by BluBrick · · Score: 1

    I am quite willing to excuse your potty mouth.

    However, for "shouting" in upper case and for your use of excessive exclamation marks, you shall surely be darned to heck.

    --
    Ahh - My eye!
    The doctor said I'm not supposed to get Slashdot in it!
  120. Cowboy programmers should be shot by just+fiddling+around · · Score: 1

    You are completely off-path, young grasshopper. When you get some experience under your wings, you will see that good programmers do indeed have a lot of will both in thinking and writing, but great programmers have that and extensive theoretical knowledge.

    You see, the more theory you know, the less figuring-out you have to do on already-beaten footpaths. Then you can expend your precious, priceless, mental power on new problems. Of course, it may happen that you are forced to re-implement a B-tree or a Q-sort function, but if you don't have to think through it's intricacies it's just implementation; if you have to think and then write, you are wasting time and will probably not make it.

    This is all a part of the "standing on the shoulder of giants" template. If you ignore or don't know about the concepts, then you try to re-do the work of really clever people that already have ironed out the problem and it's solution.

    --
    You're not old until regret takes the place of your dreams.
  121. It's not all bad by scramjet · · Score: 1

    Hey, any code base that includes a "libpr0n" module can't be all bad.

    --
    --- All I ask is a chance to prove that money can't make me happy.
  122. Haskell is what you need by amitofu · · Score: 1

    Actually, you want Haskell. Haskell offers arbitrary infix operators. Just enclose any two-argument function in backquotes (`) and it becomes an infix operator. You can also define new operators using any combination of legal symbols.

    For example, if you had a function concat a b that concatenated the strings a and b, you could write:

    concat 'Hello ' 'World' -- The usual way to call concat

    Or you could write:

    'Hello ' `concat` 'World' -- the backquotes make concat an infix operator

    But best of all you can define the exact operator you want like so:

    (.=) :: String -> String -> String
    a .= b = concat a b

    Now you can write:

    'Hello ' .= 'World' -- Voila!

    1. Re:Haskell is what you need by Procyon101 · · Score: 1

      Syntactic sugar... but worse, by introducing infix you complicate the syntax of the language and make macros much more difficult. Not that Haskell isn't great, but arguing infix notation against Lisp macro championing is a losing argument ;)

  123. R.A.D may not be the point, but... by Wizard052 · · Score: 1

    you have to admit, almost everything has been packaged in libraries and stuff already. I also appreciate the nitty-gritty of coding myself, but I find that more and more, it's going to become somewhat irrelevant doing everything all over again. If something's been done already, why re-do it? But yes, in an academic environment this shouldn't be the case. Students should have to get down to understanding it all in detail.

    I think the internet ofcourse, fuels the progress (or not) of programming in general. It's like a java class I was in a while ago. One project pupils were asked to do was to make a 'hang-man' game. I thought that would be a real challenge for people...it turns out all it took was less than a minute of googling to get the exact source code from somewhere.

  124. Use Python by blippy · · Score: 1

    Monty Python, that is. I'll start. Use an abacus? Oo, the luxury. In our days, ...

  125. That sounds like quite a treat! by Wizard052 · · Score: 1

    It must have been quite an experience to be taught C++ by Stroustrup himself! But I imagine he may have spent half his time defending the mechanics of the language versus 'safer' implementations....but on the other hand, he seemed to have been somewhat an open-minded person judging from his interview with TechReview.

  126. Re:He summarizes one of the big issues in SD now.. by Peter+La+Casse · · Score: 1
    So what you are saying is that the quality of commercial code has very little to do with business pressure and is mostly just a result of unskilled and/or unmotivated programmers.

    No, I'm saying that commercial code quality is poor (mostly) because of business pressure and open source code quality is poor for (mostly) other reasons.

  127. Re:The biggest problem is choosing the right langu by dcam · · Score: 1

    I thought that might be the idea.

    My only problem with that is I've always taken exceptions as something to be used when there is a error condition of some sort. Returning null from a function does not necessary imply that there is an error.

    For example if you are querying for the existance of something and it doesn't exist, throwing an exception seems like a bad idea. It seems to me if you take the not null returns to its logical conclusion then you end up overusing exceptions.

    There are also some people who just flat out dislike exceptions. I'm not one of them, but the view does exist.

    --
    meh
  128. Re:Mod Parent Up: Funny! (n/t) by ChefBork · · Score: 1

    N/T

  129. Re:Stroustrup complaining about the quaility of co by nagora · · Score: 1
    I find the animosity toward Stroustrup in some of the posts very odd. Is it a pissing contest?

    No, it's just that Stroustrup is neither a good programmer nor a good language designer. Imagine trying to design a OO language without garbage collection! What a twat.

    --
    "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
  130. Good for gutters then by dazedNconfuzed · · Score: 2, Insightful

    For those of us working in the "gutters" - embedded systems stuffed into the sometimes gludgy real world - only a language like C++ will do. A polished user-level GUI app running atop layer after layer of abstraction can be written in something slick and aloof like Java, Lisp, or some nifty obscure language. ...but for those of us writing specialized critical apps running on minimal hardware and dealing directly with the real world, we need something that has only the thinnest layer of abstraction, is comprehensible and predictable, and will reliably affect reality.

    Sneer at "gutter"s as you like. Your house/apartment has them, your business/school has them, you don't notice them when they work, but they are quietly everpresent and designed by someone who had to think about them and use specialized tools to make them - and life would be less pleasant without them. Ditto for lots of C++ apps. You don't really expect a Java VM running on your toaster, do you?

    --
    Can we get a "-1 Wrong" moderation option?
  131. C++ by Ozgur+Uksal · · Score: 1

    students should really be studying computer science, not programming. They shouldn't learn how to do a binary search, they should learn why it's such a powerful technique. The implementation falls out naturally from the description. Likewise for trees of various flavors. Teach them how to identify the language features that best support the algorithms they need, and let them figure out which language is most appropriate for themselves.

  132. What are you talking about? by Generic+Player · · Score: 1

    Lisp is incredibly simple, it dumps almost nothing on your poor brain. It only takes a long time to understand how much power the simple language offers you, as you figure out how to use it in new ways.

    And saying ML dumps too much on you, and then giving nemerle as an example is just plain retarded. Nemerle has all the same complexities as every other ML implementation, it just has C style syntax. The semantics are all the same, there's just as much to learn, and it all works the same.

    Good languages don't get popular because most of the world doesn't want good languages. They want a large pool of replacable, base competance programmers. If you add the good things from good languages into bad languages like C#, they will end up just as complex and just as difficult for the mediocre to grasp as the good languages those features came from.

    And of course, why does popularity matter? The grandparent asked for a better alternative to C++. Ocaml is one of many such better alternatives. He didn't ask for an "industry standard", PHB approved alternative.

  133. Google comment - misquote? by Lothar · · Score: 1

    > Bjarne Stroustrup: Google! Can you even remember the world before Google? (It was only five years ago, after all.)
    Does he mean when Google became more publicly known or since they bought Deja.com? Or is he just talking rubbish... I find that hard to believe since its Stroustrup himself.

    I for one used Google back in 1999 and I'm sure most other geeks. I remember it totally blew me away compared to the old crappy Altavista.

  134. I'm confused. by MarkusQ · · Score: 1
    Thirty years ago? In 1976? Really? Don't think so.

    I'm confused. Are you disputing the existence of hash tables thirty years ago (which would be silly) or that the year 1976 existed at all (which would be slightly sillier)? I suppose that you might be disputing the present existence of people from this long forgotten era, which would be slightly less silly but vastly more insulting. We do in fact exist.

    --MarkusQ

    P.S. And yes, people really did dress like they show on TV. We thought it was normal then. Don't ask me why.

  135. HAH! by Anonymous Coward · · Score: 0

    No answer, huh? Looks like that dude owned you.