Object-Disoriented Programming

By Shamus Posted Monday Sep 27, 2010

Filed under: Programming 185 comments

I program in C++ for a living. I loved doing it in my late 20’s and early 30’s, but over the past few years I’ve gotten fed up with this language and its cryptic aggravating bullshit.

One of the strengths of the language is the way that you can use libraries written by someone else. The language is 31 years old at this point, and odds are good that if there’s something you need your program to do, someone else has already come across the problem, solved it, and put the thing out there for people to use. For example, if you need a really fast algorithm for sorting a big wad ‘o data, or generating high quality pseudo-random numbers, then you don’t need to knock yourself out. Just use what’s already been written. There’s no reason to do it yourself unless you see some flaw in the existing solution and you think you can do better.

Things get tricky when you have a solution that incorporates another solution which incorporates another, and so on. You go and grab a chunk of code for (say) calculating the shortest distance between any two wombats. You think you’re done, but when you try to use it you find out it depends on other files you don’t have. It turns out the shortest-distance stuff incorporated someone else’s code, which was a program designed to differentiate between wombats and hamsters, which in turn used some guy’s 1988 C code to rate things according to how furry they are. Suddenly you’re performing some sort of archaeological data mining, looking for fragments of code written by a teenage Bjarne Stroustrup in 1965 and trying to translate his comments from the original Danish.

When someone shares their solution with the world, they can do it in one of two ways: The first way is that they can compile their stuff into a library. This is a binary file that you can hand to just about anyone and it will (in theory) be fairly easy for them to plug it into their own program. The downside is that every platform will need its own library. Linux? PC? Mac? 64 bit? 32 bit? It will be frustrating if a Linux developer shows up and you only have the PC version of your library available. And you can’t compile for a platform unless you have access to it. So if you don’t own a Mac then Mac users can’t use your stuff, thus limiting the reach of your work.

The other solution is that you can throw the source files out there and let everyone compile it themselves, which requires little effort on your part and lots of effort on theirs. The directions to compile someone else’s project go something like this:

1) Download all the source code. Now go and download a program to open the archive because they’re not using the archive format native to your operating system. (Windows has .zip, Linux has .gzip, Macs have .iforget.)

2) Follow the directions in the readme.nfo, which is a text file with no line breaks. This will explain how to arrange your project directories so that it will be able to find the needed files. If you’d like to see the directions in English, you can get them at the following dead link.

3) If you’re compiling on an IBM z800 then the source should be fine. For all other platforms, go through all the files and replace all the double backslashes in the header file paths with single pairs of reverse-backslashes. You may need to precede this with a period. Consult with an older programmer who is like a mentor to you. He probably knows about this kind of stuff.

4) Don’t do the previous step if your filesystem is case-sensitive.

5) You’ll need the source for the RaymondSort algorithm. Yes, there are dozens of popular sorting systems out there but RaymondSort is proven to be 0.1% faster in single-threaded environments where the computer has less than 100MB of memory to work with.

6) Go to the back room of Uncle Raymonds Bar in Pineville, WV on a Wednesday night. (The password is “Bob-o sent me.” They only change the backroom password when a new version of Windows comes out, so this password will be good until Windows XP launches.)

7) Ask Uncle Raymond for the source to RaymondSort. Don’t be offended if he tries to goad you into a knife fight. He’s like that.

8) RaymondSort files are written in ANSI C and a profane variant of Esperanto. You may need to make a few hundred perfectly trivial edits to them to get a clean compile. In particular, Ray’s favorite variable names were bool, class, new, and delete.

9) That’s it! When it fails to compile feel free to email me at the address I haven’t used since the Clinton administration and I’ll be happy to send you back curt replies admonishing you to RTFM.

10) Do a Google search and discover a three year old forum thread where a half dozen people all had the exact same problem you’re having now, which nobody ever answered. The last post is someone saying, “Nevermind, I figured it out myself” without elaborating further.

This weekend I was looking for something that would let me “easily” create standard interface widgets (text boxes, buttons, scrollbars, and all the other doodads we’re used to seeing in a modern user interface) within an OpenGL window. Basically, put various controls over a 3D rendering window. Designing interface controls takes an enormous volume of code, and I was sure someone else had done all that legwork for me.

I did a search and found about a half dozen that seemed interesting. So then it was time to evaluate them according to various criteria:

1) Is it cross-platform? The rest of my project is (in theory) compatible with PC, Linux, and Mac. Will using this package exclude any of those?

2) Is it neat and easy to use? Or do I need to #include a dozen different files everywhere in my project and write ten lines of code every time I want to create a new button?

3) Is it well-documented? A feature-rich system is no good if I don’t know what the features are or how to use them.

4) Does it actually do what I need? Will I get the thing running and discover that it (say) can only show a single control at a time or that the controls always look like Windows 98? Or that the controls actually float in a separate window and aren’t actually superimposed onto the 3D scene. Does it actually work at all?

5) Is it sufficiently humble? It’s a bit hard to describe this in non-programming terms, but different packages have different ideas about just how important they are. Some behave like small power tools. They’ll plug into the power strip next to all your other power tools and you can use them as much or as little as you need. Others act like they’re the whole workshop and expect you to plug everything else into them. In programmers terms, sometimes a package will insist on running the show. You instance a class and interact with everything else through that class. It calls member functions when it pleases, and you don’t get to control the program flow yourself. The package imposes a certain structure on your application. The fun begins when you have more than one of these jackass systems and you need to figure out how to make them work together. Also, it’s a bitch to debug applications that are built this way because trashing the heap will often cause the program to crash somewhere in the bowels of this overlord library and you can’t actually tell what the hell it was doing before things went pear-shaped. And asking for help will always get you helpful suggestion like “don’t trash the heap”.

It becomes a tremendous time-sink to try out a dozen different systems like this, because getting them to compile and integrating them with your project is such an enormous chore. I wouldn’t mind doing the work if I knew it was what I wanted, but this is like assembling a car before you can test-drive it. It’s entirely possible to blow a couple of hours on something and find out it’s not at all what you need. And when you’re working on it you have no idea how much more time it will take before you can see it work. You solve a problem to find another problem, on and on, never knowing if you’re anywhere near the finish line.

I lost a whole day to this over the weekend, and I have nothing to show for my effort. Everything I tried managed to fail multiple items on the list above. Most of them failed 3 out of 5. I don’t mind that I couldn’t find what I was looking for. (Well, I mind, but that’s not what’s really bugging me.) What bothers me is just how long it took me to run through the list. Every package I tried was a bundle of inscrutable errors. So much time is lost laboring over compile-time vagaries and linker misadventures. Nothing ever “just works” out of the box. Some of this is because this stuff is all thrown together by people who would rather waste your time than theirs. But some of it is because there are just so many things that can go wrong.

I didn’t used to have this much trouble. Maybe I’m just getting older and have less patience for it. Maybe the mass proliferation of homebrew libraries has flooded the world with wobbly projects made of tape and popsicle sticks. Maybe this is due to the chaos arising from the halting attempts at cross-platform development. (In the old days, almost everything I worked with was 100% Windows based. Now a lot of stuff is striving to be multi-platform. That’s good in the long run, but the resulting development anarchy is treacherous to navigate.)

Still, it’s really common these days. I can’t remember the last time I grabbed some code or a library and just had it work without needing to fix it first.

 


From The Archives:
 

185 thoughts on “Object-Disoriented Programming

  1. Primogenitor says:

    Someone really needs to register dead_link.com

    But yes, I sympathize. I too have spent many hours tracking down dependencies and documentation.

    1. Nathon says:

      That’d be dead-link.com; _s aren’t legal in URIs. </pedantic>

      Oh, and it’s being squatted on: http://dead-link.com/

      1. Blanko2 says:

        now that is funny

    2. Deoxy says:

      heh – that was my first thought, too (after seeing that it wasn’t something Shamus has just for the this purpose, which was actually my first thought).

  2. Rick Tacular says:

    The Mac file archive format is “.iForget” I loled. =) Thank you.

    1. GreyDuck says:

      Sure that’s not iLOLed?

      *grins, ducks and runs*

      1. Rick Tacular says:

        *Nice*! =)

      2. Arquinsiel says:

        I’m pretty sure it’s .iMexpensive…..

        (It’s actually .zip it seems, for convenience).

        This is pretty much why I gave up on C and CPP (C* being an overloaded operator, much like the rest of C, I can’t use it to represent the entire C family…. damn language!).

      3. Arquinsiel says:

        Silly browser….. this whole commenting exercise has been awkward.

    2. D says:

      If anyone cares, the Mac archive format was .sit at one point (although really it was Stuffit’s archive format) but anything new enough to be using Mac OS X should handle .zip without fuss.

      1. Miral says:

        There’s also .dmg, if you’ve got enough stuff to throw around that you want to make a whole mountable disk image out of it.

      2. Jeff LaFay says:

        Strange, I thought it was .IDontCare :D

    3. MrWhales says:

      The sad part is, I believed it till i thought about it too.

  3. Jarenth says:

    “If you have a problem… if no-one else can help you… and if you can find them… maybe you can #include… The C-libraries.”

    [Queue theme music, which is just the sound of a 56k dial-up modem sped up over a drumbeat.]

    1. RTBones says:

      To which I will respond: I can program FORTRAN in any language. :)

      On a more serious note, I feel your pain, Shamus. I spent some years working in real-time simulation. We ran Ada execs that talked to a C wrapper around a FORTRAN core. We also had an awful lot of code re-use (mainly the FORTRAN and Ada) because it WORKED (I worked for an engineering house, so there was an awful lot of number crunching that FORTRAN is really good at). At some point, though, the decision was made to convert EVERYTHING to C++. Why? Because FORTRAN and Ada are not “sexy” (not generally taught in universities anymore) and getting programmers to use Ada and FORTRAN was getting difficult.

      It took years to get things “right” – for many of the reasons you mention. We were somewhat hampered because you could actually “read” the FORTRAN and Ada (which were written by hand and not using fancy IDE) but some of the C++ we integrated was more of a “black box”. We also changed platforms (DEC Alphas to PCs). We had the additional challenge of syncing everything up to make it run real-time. If that wasn’t bad enough, we found that you can take an engineer and teach him to code (the code is a tool) but it is exceedingly difficult to teach a coder (the code is end-all-be-all) and teach him the engineering behind model X Y Z.

      EDIT: 5 points to those of you who know what DEC stands for.

      1. Ingvar says:

        DEC is the first three letters of DECUS. But the DEC that is (well, was) DEC and the DEC in DECUS don’t, if I remember, stand for the same thing (and if you spot a stray Ken Olsen, you know what to do with him).

      2. omicron says:

        DEC: One of the older computer manufacturers. Made the PDP-8 and PDP-11, among others. (Thanks, old-timey nigh-unintelligible CS prof!)

        1. Nathon says:

          Also known as Digital Equipment Corporation. Now part of Compaq/HP.

          1. silver says:

            hands up if you’ve programmed on a DEC 2060 using a thermal-paper acoustic-coupler modem.

            man. and people wonder why I keep saying how old I am.

            1. Jarenth says:

              From poorly done A-team joke to computer history lesson in only five comments. That’s gotta be a record of sóme kind.

            2. RTBones says:

              Not quite, but how about programming a Gould running MPX-32? Oh, and we wont even get into working with a Compu-Scene

      3. Adeon says:

        My degree course (Aeronautical Engineering) taught FORTRAN as part of the standard course. The official reason was that a lot of Aero related programs still in use were written in it. Personally I think one of the professors just liked it.

        1. RTBones says:

          As someone with a Masters Degree in Aerospace Engineering, I can tell you – it isn’t because he likes it. There is a TON of FORTRAN still out there.

        2. somebodys_kid says:

          My honors engineering introductory course also taught FORTRAN…though the guy that ran it was an Aeronautical Engineer… I sense a conspiracy.

          1. LunarShadow says:

            They are using MATLAB now. Noe please excuse my while I go have A BSOD in the corner as I remember the hours upon hours upon hours I spent on those assignments getting things to work and then fixing subsequent problem that arose.

        3. And during my math course, they thought MSW Logo.

          Don’t see much Logo around though…….

        4. phliph57 says:

          My structured programming class towards my CS degree was taught in Fortran written on punched cards. Now who’s getting old?

  4. Andy says:

    You have my full sympathies.
    I was working recently with a computer vision library (OpenCV) that is generous enough to offer pre-compiled libraries in addition to source.
    The pre-compiled libs did everything I needed and I got the project completed in two days and sent off to the client.
    Who then offered to pay me a lot of extra cash to add one little feature they really wanted. This appeared to be as simple as changing one argument to one function in the code so the effort/reward ratio appeared to be more than worth it.
    Except there was a bug in the library.
    A bug in the library that only expressed itself when the argument was changed.
    A well documented bug that was trivial to fix.
    Implementing the bugfix and adding the new feature for the client took less time than writing this sentence.
    Rebuilding the library for the compiler I was tied to (due to other dependencies) took two days of web crawling and trial and error and wailing and gnashing of teeth.
    Finding many other forum posts with the same issue that terminated with “Never mind, I figured it out” particularly resonates.

    As for OpenGL-based GUI systems, it has been a while since I played with it but a while back the OpenFrameworks guys had several active threads discussing the benefits of various libraries to achieve this. Their forum is pretty active and they are a friendly lot so someone over that way may have iterated through this particular frustration loop and found the optimal library.

  5. JoeTortuga says:

    This is why I started requiring that any tools or libraries I used have been updated in the past 6months – 1 year (if people aren’t actively developing it now). Something that was perfectly great 5 years ago, may not work anymore, or may not work the way we do things now. You really get a feel for the way APIs and technology change when you try to use something older.

    I don’t want to disparage old, developed, even “finished” projects, but if I’ve got to incorporate your work into mine, I need to hope that you’re still around to ask. At least that was my initial motivation, but as I’ve used this system for several years now, I’ve found that the need to ask is less with newer stuff, too. Probably because things were designed to work in the same way, not because of any inherent improvements over coding practice or anything.

  6. Nathon says:

    Some reasons to hate C++: http://yosefk.com/c++fqa/

    Just in case you needed more.

    1. Heron says:

      I read through that site last year. Most of the guy’s complaints are basically “C++ makes it easier to shoot yourself on the foot than some other languages.”

      While this is true, it’s not inherently bad; nailguns make it a lot easier to nail your foot to the floor than a regular old hammer and nails, but nobody complains about that!

      Several of his other complaints are true of most languages.

      I realize that he’s specifically commenting on someone else’s comments on C++, but he tries to make the case that C++ is an inherently sucky language. I certainly agree that it can be complicated at times — I have no desire to mess with boost’s source code — but if a construction worker can’t handle a nailgun, you don’t blame the tool, you blame the worker. So why do people blame C++ when they have trouble with it?

      1. Deoxy says:

        “nailgun” isn’t really a good analogy, I think. “rotating saw” is better. Even the safest rotating saw CAN hurt you very badly.

        That doesn’t mean that a 36″ hand saw with no guard and more horsepower than a fighter jet is a good idea.

        Or, in the case of the nail gun, fully automatic with 12 triggers all over the place, all of them hyper-sensitive, super-sonic velocity firing speed, and a 10,000 nail capacity. But hey, let’s not blame the tool when that turns out badly….

        1. Jarenth says:

          Here’s to hoping Duke Nukem Forever incorporates both this nailgun and the earlier mentioned handsaw ‘o death.

          1. Neil Harding says:

            Here's to hoping Duke Nukem Forever incorporates both this nailgun and the earlier mentioned handsaw “˜o death.

            I think Duke Nukem Forever is just Duke Nukem with the expected release date, similar to Windows 95, 98 etc.

        2. Ingvar M says:

          Paraphrasing a lecturer at my old uni:

          “C is like a chainsaw. Powerful and lets you fell trees really really fast. C++ is the same chainsaw, only with a laser cannon mounted on it. This lets you fell forests relaly really fast, but the cannon rotates randomly and occasionally takes your head off.”

          Admittedly, this was 15 years ago and C++ was slightly… less… finished than it is today.

        3. MadTinkerer says:

          In my last programming class I made a program that Windows XP kept trying to report to Microsoft as a “dangerous program” whenever I compiled and ran it. No compiler errors, just Windows threatening to report my program to Microsoft. When I showed her the source, my teacher explained that recursive function calls don’t work quite the same in C++ as they do in Java and suggested that I stick to the stuff she had taught thus far when doing class exercises. She was impressed with the effort, though.

          Later on I managed to create something that caused a BSOD each time. Again, my teacher was pretty impressed, but suggested that I wait until her lecture on pointers before I tried to use them myself.

          Sometimes you need to be very careful when reading ahead in the book.

    2. Michael says:

      What a stupid website, seriously. Written by a troll who has too much time on his hands?

      1. skeeto says:

        While some of his points are arguable, he does point out some serious oversights in the design of C++. C++ does have a lot of nasty warts.

        My favorite example from the C++FQA is this one: how do you report an error in a destructor? The answer is that the language provides no way to do this! Destructors don’t return values, and you can’t safely throw an exception in a destructor.

        And don’t say that errors shouldn’t occur in a destructor. Doing something as simple as closing a file — a perfectly reasonable thing to do when tearing down an object tied to a file — can result in an error.

        1. Shamus says:

          Agreed. Some points are arguable, some points are dead-on. There are many shameful things about C++.

        2. Miral says:

          That’s what log files are for.

          If you think about it, there really isn’t anything else sensible that can be done. Destructors are required to be called in cases where it’s already handling an error (and cleaning up after it) — if you could raise another error at that point then chaos would ensue.

          1. skeeto says:

            And then what do you do when there is an error writing to the log file? :-) Log files all the way down?

      2. silver says:

        Trolling is going to C++ websites and saying “C++ sucks”.

        Making a website which is longer and more detailed than any subsequent flame war, and then not posting it to sites with opposing points of view, but just leaving it out there to be discovered – that is not trolling.

        1. Felblood says:

          Coming to a guy’s website and calling him a troll, for daring to share honest criticism on your favorite language’s library sharing features, is.

          Just ignore this flaming newbie, until he learns some manners or wanders off.

          1. Alan De Smet says:

            Check the nesting. He’s not calling Shamus a troll. He’s calling the author of the C++ FQA a troll.

            1. Felblood says:

              Right you are.

    3. Alan De Smet says:

      That guy took a lot of words to write, “I hate (and don’t really understand the purpose of) C, and therefore I also hate C++.”

      1. silver says:

        Strange comment, since most of the time he advocates using C instead of C++.

  7. Psithief says:

    Thanks Shamus, you reminded me to check the email address I’ve had for a decade.

    As a much younger programmer (25), I gave up on C++ before I even began.
    Now I’m learning the really deep things like concurrency in multi-threaded environments in Java, and I’m glad there’s so many things I don’t have to worry about.

    However just because every Java project has its own wiki, doesn’t mean there’s any useful documentation provided. Why is it that these days some developers just provide the source code instead of documentation?

    1. Nathon says:

      Haven’t you heard? The source _is_ the documentation. You should be able to determine everything from what a package is for to the intent and proper usage of a given function by simply reading the source. The horribly organized source full of single character variable names and global state that’s changed through 6 different wrapper methods. Oh, and some functions just write directly to the global state. They’re special like that.

      1. X2-Eliah says:

        Yes. How can you possibly use a sourcecode if you do not fully understand what it does? Blasphemy! Sacrelige!

        1. Psithief says:

          When people make sarcastic comments, it means they completely agree!

          1. Sumanai says:

            Which is why people find me so agreeable in person!

      2. RTBones says:

        No kidding. And Heaven Forbid someone should have to come BEHIND you and make sense of your code to integrate or debug it. Because as we’ve all said – nobody ever reuses code….

        1. Sumanai says:

          Oh yes they do, but they’re lazy little whippersnappers who need to be taught a lesson!

      3. ClearWater says:

        Most of the Java documentation I’ve read looks like this:

        aThingy getThingy()
        Gets a thingy.

        or

        public void doStuff(int aParameter)
        Does stuff.

        Parameters:
        aParameter - a parameter

        But then, most of the Java documentation I’ve written looks like that as well.

        1. silver says:

          What happens is when you tell people “you have to document everything!” instead of “document the really hard parts” they end up getting too lazy to document anything. So the hard parts get left undocumented, and the everything else is just whatever their favorite IDE inserted as the default javadoc (to help them document everything. because you have to, you know. because everyone loves to read “x = 3; // set x to 3”

  8. Friend of Dragons says:

    Yeah, I was working on something similar a while back. But then I figured it out.

    (not really)

  9. 4th Dimension says:

    Makes me happy I program in .Net C#.
    Tough I miss some of the performance of C++.

    1. John Lopez says:

      I’m with you on C#. I cut my teeth on 6502 assembly, worked through C and and then C++ before giving up on MAKEFILES forever and jumping ship to C#. Recently the big step up has been wrapping enterprise functionality into SOAP calls, which abstracts away that last level of interoperability between systems pretty well… now I don’t care what language others use and they don’t care we are using C#.

      I lose performance operating from the sky, but the efficiency in *time* connecting to a WSDL file and get skeleton code to consult the service is amazing. If that service connection ends up a bottleneck we always have the option to drill down into C#/SQL connections and even C++ for the incredibly rare case when *code* is the hotspot.

      Long live abstraction.

      1. Jabor says:

        Programmer time is a whole lot more expensive than CPU time anyway.

        1. Doktor Fears says:

          Not necessarily. It can depend on the expected running time of the program. If you expect your program to run for less than a few seconds, then sacrificing a 10% reduction in runtime for a 50% reduction in programming time is perfectly acceptable and should be encouraged.
          If you expect your program to run for more than 10 days, and it only takes 5-10 hours to program, then a 10% reduction in runtime for doubled programming time looks mighty appealing.
          This is why research into using graphics cards for non-graphics problems is so hot right now. Rewriting your algorithm for CUDA may take a few more weeks of research, but the 500-10000% faster runtimes are so very enticing. (And no, the “10000%” is not a typo. It’s probably an underestimate.)

    2. Kdansky says:

      http://shootout.alioth.debian.org/

      Actually, C# isn’t that much slower than C++. And Java is only a tiny bit below C++.

      1. Sumanai says:

        Assuming proper coding practices. Which seems to barely ever happen with Java or C#. Or it might be my habit of running multiple programs at the same time, which has a tendency to emphasize even minor resource drains.

        And apparently drawing attention to problems in garbage collection systems is some kind of sin? (Not pointing fingers here, just happened at one site where the owner commented on Flash’s garbage collection having undocumented features. )

  10. J Greely says:

    “For every software problem, there is a solution that is free, Open Source, and will probably compile on your system if you sort out the package dependencies, hack on the Makefile, and find the unsupported patch that adds the features you need.”

    -j

    1. X2-Eliah says:

      Let’s not forget that for every solution, there is a new problem.

      1. Will says:

        Two new problems. Sometimes more.

        Problems are like people; they are social creatures and usually turn up in crowds.

  11. Noah says:

    I spent so, so many hours on this. These days, I work in Ruby, both professionally and not. Not everything in Ruby is immune to bit-rot, but a huge amount of stuff actually works out of the box. It’s very, very nice.

    Python, Perl, etc can make the same claim, with basically equal validity. I’m not trying to say my language is better than any other — just that it’s in a good category of platforms for minimizing this specific frustration :-)

    1. silver says:

      Perl has gotten rather bit-rotty. It’s easy to add packages to CPAN, it’s hard to remove them and/or mark them deprecated.

      1. DarkLadyWolf says:

        One problem I’ve noticed more in Perl, but I’m sure occurs with other languages, is that often packages are included simply for one definition or function. I’ve ended up installing any number of packages in a ‘chain’, then when I’ve gone to look, found that only one thing in a package is needed by the one above, and so on.

        If I need ‘efficient’, it’s at that point that I often consider throwing away other’s work and starting from scratch (or nearest equivalent).

  12. Michael says:

    I don’t program at all, but I CAN’T STOP READING.

    I don’t even understand half of what’s going on, but it’s so entertaining, I couldn’t bring myself to stop when I [knew I] was in over my head.

    1. Hobo says:

      I know what you mean! I even get lost in shamus’ more newb friendly code talk but then I go onto read the comments and Acronyms and # start popping up. Yet despite all of this I feel drawn into it all, I have to stop myself from googling every other word that is mentioned.

      1. Yar Kramer says:

        Same here. XD

      2. Michael says:

        Oh.. my… Don’t you see what he’s done?

        He’s created C++Tropes! We’re doomed!

        If he ever adds a “See Also:” section we might as well stop breathing.

        (As an aside; it’s good to see I’m not alone. You two obviously have excellent taste.)

    2. Felblood says:

      I read this to my non-programming friend, to give him some insight into libraries.

      He got it.

  13. Mirthlani says:

    By the way… Uncle Raymond is pretty good with that knife.
    I still have the scar. He was nice enough to buy me a beer afterwards though.

  14. Heron says:

    Shamus, your first paragraph hates on C++, but (most of) the rest of your post applies equally well to most other languages, even languages that are ostensibly cross-platform by design… Anyone else here ever been frustrated by a string of dependencies in a Java library as long as your arm? Should I, perhaps, rant about how frustratingly complicated Spring is? (That’s one of those frameworks that tries to run the show but acts like it isn’t trying any such thing.)

    Oops, I let my current job frustration leak into this comment. Oh well…

    1. silver says:

      “Write Once, Debug Everywhere.” – Java motto made true.

  15. omicron says:

    And this is another reason why Java!

    1. Sumanai says:

      If you’re programming and there are no problems, that just means you don’t see them. Applies to all languages.

      1. Garden Ninja says:

        You know what they say:

        There are 2 kinds of programming languages: the kind people complain about, and the kind no one uses.

  16. kikito says:

    Hi Samus!

    A great laugh, and also a quite accurate description of why did I drop C++ from my toolset (I program in ruby now – pheew! what a change)

    I’d really love to know the names of the libs you were testing.

    Have you tried http://www.cegui.org.uk ?

  17. miroz says:

    Great rant, I share this troubles; my compiled/downloaded ratio is about 0.2.

    But thumbs up for “5) Is it sufficiently humble?”. I hate when a library seems to be the center of the world. IE, when I tried to add network support for a Python application somebody recommended me to try Twisted. I looked for the tutorial and there was a line: “You see, you don’t use Twisted as a library. Instead your application is a plug-in for Twisted.” Great.

    And please, do more rants about development.

  18. Michael says:

    Well, as much as I can feel and share your pain, this has NOTHING to do with C++ as a language.
    Instead, if a C++ project is still well-maintained, then compilation shouldn’t involve much more than a configure; make; make install on Linux platforms, or double-clicking on the .sln file and using Batch Build with VC++. Some projects use a slightly more involved build system (CMake, or Boost.Build), but I haven’t come across the doomsday-hell scenario you are painting yet.
    If a project is not well-maintained/dead, then there might be difficulties in getting stuff compiled, indeed. Then again, it’s always a risk to use “dead code”, be it written in C++, Python, Java, Pascal, etc. etc.

    Again, C++ is not to blame!

    1. Felblood says:

      I don’t think this is a rant against C++ so much as the culture that surrounds it (which is a product of the language’s philosophy).

      Thee are a lot of people who are married to dead C libraries. These will be the first guys to suggest a solution, and the last guys to help you get the release version working on your own machine. Many of them are using a heavily modified version of the library, which is actually much better than the release version they are sending you to download, having completely forgotten what a horrible mess it was before they beat it into shape.

      It’s far from 100% of C++ users, but the signal-to-noise ratio on C++ forums is still absolutely terrible.

      Compound this with the fact that a lot of archived forum posts from yesteryear feature obsolete advice that no-one would issue in this decade, and you have a recipe for hours of fruitless wandering.

  19. radio_babylon says:

    #10!! oh god, #10! that is far and away the most frustrating thing i have ever encountered. the worst thing is ill frequently find MULTIPLE threads on many sites about my problem… and *every*freaking*one* will end with “never mind, i figured it out”…

    but then, i think they get kicked out of the “arrogant asshole programmer’s guild” if they ever reveal the secret, or do more than #9 in reply to “i see you figured problem-X out, can you tell me what you did?”

    1. silver says:

      What’s sad is how many of these Q&A sites have started trying to charge you to see the replies. The replies that are probably a bunch of people saying, “me, too. what’s the answer?” and the odd “nevermind, I figured it out.” Wonderful.
      (but, actually, I don’t know. maybe those sites DO have the answers. I don’t pay, so I can’t say. But I’m guessing they just took the same old Q&A from forums and wrapped a pay site around it).

      1. Heron says:

        StackOverflow is a pretty good free site for these sorts of questions.

      2. Kyte says:

        Apart from StackOverflow, the pay-for-the-answer sites actually do a somewhat clever bit of misdirection: If you scroll down enough, the answer’s right there. For free. Because Google wouldn’t be able to index it otherwise.

        1. Dave says:

          On some of these, no names mentioned sites, this is no longer the case; however, if you switch your useragent string to that of a googlebot… you’d be surprised how fast the pay wall comes down on a lot of sites.

  20. Sydney says:

    I think “You Fool!” should be my new standard web handle.

  21. TehShrike says:

    I’d recommend http://stackoverflow.com/ as a far superior alternative to asking Billy-Bob from the Internet Forum for help.

  22. Corran says:

    Nevermind, I figured it out myself.

    1. X2-Eliah says:

      No, you did not.

    2. Felblood says:

      Friend of Dragons beat you to it by a full 15 minutes.

      It’s a dog eat dog internet out there.

      1. Alexander The 1st says:

        Full of cat pictures.

  23. skeeto says:

    For me it’s usually something like,

    sudo apt-get install libraymondsort-dev
    

    Or,

    cd ~/build/
    wget http://example.com/dist/libraymond-2.5.4.tar.gz
    tar -zxvf libraymond-2.5.4.tar.gz
    cd raymond-2.5.4/
    ./configure
    # check output, install dependencies if needed, repeat
    make
    make test  # if there's a test suite
    sudo make install
    

    If it gets more complicated than that, then it’s probably not worth using.

    1. Nathon says:

      Protip: aptitude > apt-get

      1. Ingvar M says:

        Semiprotip: it used to be (may be fixed now) that if you mixed using aptitude and apt-get, aptitude would hose your install (has happened to mew twice, I stopped using aptitude after that, as I actually prefer apt-get). However, apt-get and synaptic seem to get on well, if you prefer something more graphical.

    2. James says:

      Absolutely. Odds are, someone else (maybe even the author) has already downloaded it, documented the dependencies, compiled it, ensured the header files are all in the standard locations, and made a package. I hate to be That Guy, but I pity people who have to develop software on MS Windows – even Mac OS X has macports*.

      * – which frequently finds ways to screw me over but hey it’s better than downloading and compiling by hand.

  24. Meredith says:

    I haven’t done any programming since high school, but I feel your frustration on the looking for help parts. I can’t count the number of times I’ve run into that wall of defunct websites and unanswered forum threads. Rargh!

  25. Brandon says:

    I’m working my way through a computer science degree in university right now, actually, and C is the language they started us with in first year. I like my university though, throughout the years I’ve been here, I’ve had classes in C/C++, Assembly, Perl, Scheme, Prolog, Java, Python, and probably even some more I’m overlooking right now.

    It’s pretty important to experience a broad range of programming languages I think. I mean sure you can probably do anything you ever want, and many things you can’t even begin to think of, using just C++ or Java, or whatever, but why not use a language that’s built to handle the tasks that you’re trying to do?

    Which is all well and good until you end up working for a company whose hardware hasn’t been upgraded since the 80’s and the only language they can let you use is some really out of date version of COBOL or something. Or, so I’m told.

    1. Valaqil says:

      In school I studied C, C++, Java, Assembly, Prolog, Python, Scheme, Haskell, and Perl. (Maybe a couple of others I’m not remembering?) On my own, I indulged in Python because it’s “fun” to code in.

      My first two projects in the professional world? Legacy FORTRAN 95 and Ada. Blargh. Glad I’m not doing that lately.

    2. Michael says:

      I’ve still got an RPG book around here because, when I was finishing up my (comp-sci) degree (about 8 years ago) the bulk of corporate programing where I lived was still focused on that.

      At least I think I do, I may have finally pitched it in the last move.

  26. Valaqil says:

    I know it’s entirely unhelpful but this is, in large part, why I don’t download anything from the Net that isn’t, and isn’t intended to be, a completely standalone project. If I need a subsection, I either write x myself or don’t do x. I’m a number of years younger than you and I can’t stand that craziness either.

    Oh, and: The “never mind, I figured it out” has nearly made me quit Linux on a number of occasions. How many of us are experiencing the same problems with x package or config file and no one will post the solution? Gah!

    Sorry that you didn’t get it working. I hope you find something useful soon.

    1. Yar Kramer says:

      Yeah … when I program (in PHP, I admit), I only use 1. stuff I made myself, and 2. trivial stuff made by other people who didn’t use any “includes” or whatever.

  27. Rob Conley says:

    I dealt with VB6, VB.NET/C#, and C++. I vastly prefer the VB6 with COM or VB.NET/C# with .NET over C++. Unless I really need the control the managed environment is far more productive than anything I do in C or C++.

    However I also maintain a project that spans over two decades. A CAD/CAM application that creates and cuts parts on a metal cutting machine. I keep my use of 3rd party libraries to a minimum because things will change enough so that unless you have complete control over your entire application it will bite you in the ass.

    To make it worse it is still a trade off. Do you roll your own or save time by using a third party library. Each decision has to weigh the current circumstances. Going with your own is very time consuming.

    So far I had good luck with using ActiveX components with a handful of top of the line libraries like zlib for zip compression. But even with caution and preparation things like the VB6 to VB.NET/C# transition can really hammer you. But with careful design that takes in account things will change you can minimize problems like this. (Just about every major component in the software lies behind an interface. So as long as the new component can implement the interface I am good even if I had to use a new platform.)

  28. Sagretti says:

    Some of this is truly the result of a world wide web filled with more pit traps than Pitfall. I haven’t used C++, or any other programming, since high school, but I’ve had to teach myself HTML over the last year every time something goes wrong with our website (and our web people are mysteriously unavailable). I can’t count the number of Q&A sites I’ve found with the exact same “Nevermind, figured it out” at the end. Usually, I also find that the only answers available are from about 10 years ago, and thus no longer work for some reason. My next step normally is contemplating whether I can bash my head into the desk with enough velocity to break through the glass.

  29. MelTorefas says:

    Shamus, I love you. This article was pure platinum.

  30. Fenix says:

    Love these kinds of posts. They’re so fun to read. (sucks you had a bad day though)

  31. Murkbeard says:

    There is NOTHING worse than having to decipher other people’s poorly documented, obfuscated and wobbly code held together with pritt stick and prayers. It doesn’t get easier if you’re not a CS major; You haven’t seen bad code until you’ve worked with physicists/biologists/etc. Code made to do a very specific, singular job is not pretty. Your article resonates so strongly, it’s not even funny.

    Also wanted to say, that if you ever need documentation in danish translated better than Babelfish can do it, send me a mail.

    1. JB says:

      There’s nothing better, if you’re paid by the hour to do it.

      1. WJS says:

        Getting paid by the hour to do something less frustrating?

  32. Nutter says:

    And thus Shamus covers all of my points for writing all my own code. Yes I’m re-inventing the wheel, yes it takes me longer to code up anything even simple programs.

    However when it falls over it’s me who screwed something up. Plus usually I can work out why it’s fallen over and can work out how to fix it.

  33. Goliathvv says:

    And that’s how I spent many sleepless nights…

    The funny part? You spend a week trying to make it work, and after the goddamn example works, you only need 1 or 2 days to make what you wanted.

    That’s why I try to avoid C++ if possible. I don’t hate C++, it’s a very powerful and useful language and I use it often, but if there’s another option out there, I’d rather try it first.

  34. Jabrwock says:

    It’s not just a problem with C++. It’s with code in general.

    I program in C all the time, and I have similar issues.

    And then there’s #11, compilers.

    Does your compiler have some particular coding quirk that programmer A’s code depends on, and because you’re using a slightly different compiler, you cannot get it to compile.

    This one frustrates me on a daily basis.

    1. Matt K says:

      I’ve never understood this. I programed just 1 semester (for a req course) and always had issues.

      I just don’t get how a compiler can vary so much even using the same version on different machine made a difference.

      1. Kyte says:

        It’s the magic of “undefined behavior” and “implementation-dependent” on language specifications. They both translate to “every toolchain will do it differently”.

        1. Jabor says:

          I considered writing a compiler that formats the disk it’s run on if the code contains undefined or implementation-specific behaviour.

          Technically, it’s spec-compliant!

          1. Ingvar M says:

            I think there’s something along the lines of implementation-specfic behaviour having to be “sane” (so, say, wrapping a signed integer is “implementation-specific”, because it depends on if the host is using sign-magnitude, 1-complement or 2-complement, but wrapping an integer should never result in nethack starting or the disk being wiped). Well, in the C standard, that is.

            For a while, GCC would start nethack when seeing a #pragma, if it was installed.

            1. Cybron says:

              That is absolutely hilarious. Had to look it up because I couldn’t believe it was true…

              execl(“/usr/games/hack”, “#pragma”, 0); // try to run the game NetHack
              execl(“/usr/games/rogue”, “#pragma”, 0); // try to run the game Rogue
              // try to run the Tower’s of Hanoi simulation in Emacs.
              execl(“/usr/new/emacs”, “-f”,”hanoi”,”9″,”-kill”,0);
              execl(“/usr/local/emacs”,”-f”,”hanoi”,”9″,”-kill”,0); // same as above
              fatal(“You are in a maze of twisty compiler features, all different”);

              Someone had a lot of fun writing that one.

    2. Sumanai says:

      Here’s a fun little story:
      When coding at school I had to use Borland’s C++. I overwrote a piece (literally, I used Insert, not deleteting/backspacing). It complained about a missing ‘;’. Which was there. I asked around, and nothing seemed wrong.
      Then I took the end of the line which I had overwritten, deleted it and wrote it exactly the same again. It worked.

      For some reason the buggy little bastard of a software can’t handle overwriting, while seemingly supporting it. Ever since if I’ve practiced coding at school or home I’ve just used a text editor (with highlights, if possible).

  35. Mephane says:

    Ah, Shamus… now you know my life. Fairly regularly every day two co-workers and me are struggling with something very similar, of the “I run the show” kind, written in C (*) despite being so high level that for this kind of stuff you can’t even measure a real performance difference between C and something like Java. Someone higher up the ladder decided we shall to use this; “luckily” we have a C++ wrapper,with a class generator written in Java, which spares you some work unless you want to fix the memory leaks it produces because all generated code just a mediocre port from Java to C++.

    And instead of writing our own generic wrapper, even for tiny changes we know have to throw on the whole thing, rearrange all the resulting files (which are, for one rather mundane task like “rename this abstract entity”, always at least 2 full-blown classes, sometimes more – but you have like 10+ such tasks within the part of your project that will always be affected)… no, of course there is no time to even properly evaluate what to use – or even, if C++ is the right tool for the job, which it absolutely is not.

    Oh, by the way, does the acronym “SOA” sound a bell with anyone? It’s real “fun” implementing a database-based application when all you parts have to be stateless (well, transactions aren’t states, are they…). Basically, without all the aforementioned hassle, we could be like 3x faster, produce better code (in technical terms) and with less awkward external dependencies. But of all the people which were to make the decision what to use as our basic “framework”, none has to actually implement the thing.

    * P.S.: It’s the sort of C where instead of just using C++, they go the “we pretend encapsulation by only giving you pointers and no struct definitions” route, which means you have to call their “create xy” and “free xy” (instead of stack allocation, heh), which all sound like they would make for good member functions of a class, but instead (of course) they’re all global functions operation on pointer. Oh and every single function requires some “Environment” struct pointer to do automatic logging and whatever, i.e. just the kind of stuff a good inheritance hierarchy would do without anyone using the library ever having to bother about it.

    P.P.S.: I know of one library that is particularly easy and straightforward to use: boost. Ever since I started using it, I can’t imagine not having it at hand any more. Heh.

    P.P.P.S.: There is, however, one major deficiency in C++. Binary interfaces for class exports (in a dll etc.) are not even defined, hence they are not just platform-, but compiler-specific. Just great, isn’t it.

    1. Miral says:

      Some of those gripes are the reasons for the other gripes. :)

      For example, libraries providing a C-only interface with opaque pointers and their own create/destroy functions is actually a Very Good Thingâ„¢, since it means a single .DLL will work with any C/C++ compiler (since, as you noted later, the C++ ABI is not standardised; neither is the memory allocation code).

      And boost is definitely powerful, but woe betide you if something weird happens and you have to go tracing through its source to find out where the problem happened.

  36. Richard says:

    You know, I know essentially nothing about programming… but I still love these columns, since they explain things well enough that I can follow it, and they make me feel smarter when I’m done.

    1. Mephane says:

      You know, I’ve come to the point (and I am not old) where I find the actual programming the easy part. What Shamus properly describes is, if you ask me, a lot more complicated and far more hassle than the actual task programming (which includes debugging etc.). I’ll happily write you a generic memory handler that acts both as a factory and as a sink for otherwise unmanaged heap-allocated objects, and you won’t have to include that gazilion other libaries to use it, just include a template file, done. I have done exactly this at work a couple of months ago, was the best time in my programming career so far.

      But don’t force me to retrieve some library that requires you to jump to 5 hoops the documentation never talks about (2 of them on fire, and the last one has to be fixed with duck-tape), requires major restructuring of the whole project in order to use it and in the end severely limits the things you can still do, while providing a benefit that could have been implemented in the same time it took me to get the whole thing up and “running”.

      1. Richard says:

        It’s not so much that I see programming as overly complicated, as it is that I’m not good with technical jargon or extremely specific requirements. I like stuff where there’s room to do things in your own style. I’m sure programming allows for that in some ways, but the overall framework is still pretty rigid, from what I understand.

        1. Will says:

          The existence of this article proves otherwise.

          If programmers all did things in the same way, these kind of compat issues wouldn’t exist. It’s because everyone does their own thing that this happens.

          1. Richard says:

            I don’t think I’m explaining myself very well.

            Yes, you can do things in different ways, but it’s still considerably more rigid than, say, writing.

            1. Rats says:

              programming is not really any different from writing. You can think of the two as the same. The words and the syntax is important, but not how you present it. The sentence (line) must be understandable. All the words must be spelled correctly. One line must follow the last. I would advise any programmer (or writer) to adhere to a peice of advice from larry niven though,

              “If you’ve nothing to say, say it any way you like. Stylistic innovations, contorted story lines or none, exotic or genderless pronouns, internal inconsistencies, the recipe for preparing your lover as a cannibal banquet: feel free. If what you have to say is important and/or difficult to follow, use the simplest language possible. If the reader doesn’t get it then, let it not be your fault.”

  37. Manny says:

    I had my weirdest experience with this sort of thing when I wanted to use a java wrapper class I found on the net for the FFTW C-library.

    It did eventually compile, but a “segmentation fault” (gha!) occured regularly. When I found the cause I was stumped- it was a trivial error where a non-existing element of an array was accessed. But the array didn’t even have a dynamic length! The guy just created a 3-element array and tried to write into the 4th element like 3 lines down! Did he never actually use his function before publishing, or did he deliberately introduce some error to make it a bit more tiresome for other users? I never contacted him to know.

    Amazingly enough the rest of the code worked fine…

    1. ClearWater says:

      I understand that’s what Galileo did with his design for an armoured tank: he deliberately put bugs in the design so that if anyone tried to steal the design they would have to come back to him to ask how to make it work.

  38. asterismW says:

    Oh man, that was the funniest techy rant since your graphics card fiasco. I’ve had those problems many times, though far less often now since coding is not my primary job function. I still fondly remember all the times (both of them!) when borrowed code worked with little effort on my part. Of course, it’s NEVER worked right off the bat.

  39. toasty_mow says:

    Ugh…. and this is why I dropped Programming. Its the kind of crap my mother, the ultimate problem solver in our family LIVES for, which is why she just about had a minor in computer engineering before dropping the last few courses and deciding to go for higher grades towards her major (Medical Technology) instead. But she is still one of the best computer people I know, and I think that if she didn’t really have a passion for Healthcare, then she she should have gotten a degree in computers.

    Me? I’ll stick to English writing. Its much nicer. :D

    1. Owen says:

      Funnily enough I’m actually dropping a career in computers (just support, not coding) and studying Proofreading and Copy Editing because I’ve had it with the vague and stupid crap computers get up to.

      I’ll nth the looked through 20 forums only to find out that they “Solved it themselves” complaint.

  40. FutureHero says:

    As a 19 year old who was thought C++ in high-school, I can say I’m not eager to continue….

    I’m much more of a graphical design person anyway :)

  41. Tomas says:

    After switching to C# a few years ago, I soon realized that C++ made me spend a helluva time on stuff that was not really part of the problem I was trying to solve. Much of the work was stuff like getting include files right, solving linker errors, targeting generic string types with obscure macros, and (of course) making sure memory always got deallocated.

  42. Ben says:

    82 posts in 6 hours.

    In case we were wondering how many of Shamus’s readers are programmers…

  43. Mark says:

    All languages have these problems, but C++’s… quirks… make them worse. C++ was built to do everything; consequently, it does nothing well. Not only are there multiple ways to solve every problem (which is good), but there are multiple ways to apply the same solution to every problem. Most of them have complications if you don’t know more about them than you should have to. It has elementary oversights and lacks contemporary amenities. Hell, even the syntax is inconsistent.

    C is creaky but it still works great. C++ is just a mess, though. I hate C++ in the way that only those who have worked extensively with it can.

  44. krellen says:

    And this is why, despite my degree being in programming, that I now work manning a help desk instead.

  45. LintMan says:

    I can't remember the last time I grabbed some code or a library and just had it work without needing to fix it first.

    Interestingly, the last time for me was when I grabbed the source for the Mersenne twister algorithm library you link above. It built with no problems and worked perfectly. (Admittedly, that’s a rather small library).

  46. Freeze_L says:

    I have been learning to program and through out all of the books i have been using to learn C++ several returning themes pop up: You need to learn to write code, But you will spend most of you time debugging other pepole’s code; Comment all the time; and FOR THE LOVE OF GOD PLEASE DON’T USE A SCREWDRIVER TO HAMMER IN A NAIL! The most informative and useful book i am using spends most of the time talking about programming style, and how if you write a programming in a good simple format then you will be able to reuse it and have it for when ever you need it, and other pepole will use it and have it and be able to use it; if you don’t, however, write it well then no one is going to be able to use it and everyone will hate you, include yourself when you go to use that code.

    The more and more i learn the more and more aggravating it is to see some code, as i draw from other sources to make the arbitrary programming i am working on at the time it becomes more and more apparent that the advice of this book is hardly followed, and it is increasing aggravating to try and use other code than take my time to write my own. Right now i am not coding anything nearly that advanced and i am getting frustrated by some of the things i find, i can’t imagine how much worse that must be.

    Some of the stuff is meant to show me poor code and i guess that adds to it, but looking at example a compared to example b, and they both do the same thing and i need to take part of the code to put in mine, and part a takes 10 minutes to dissect and use and part b requires me to debug and then decode the program and then it does not work in the right way and i have to re-write half of it anyways, really gives a good example of what “bad code”. I was secretly hoping that most pepole don’t do the things you described but I doubt that hope has any validity.

    Wow that was a long post, and i am not sure if my perspective as a beginning programmer will add much to the conversation.

    Good luck on your project.

  47. Downtym says:

    I had a particularly soul crushing experience when trying to bring in various technologies into a Java development environment. I would go out to find Awesome Library of Awesomeness(lgpl) which requires Awesome Library(apache license) which requires Sort of Neat Library(?! license) which requires Common Library Everyone And Their Mother Uses(Doesn’t even have a license file…) which… You see where this is going, right?

    After playing internet archaeologist I finally managed to find all the libraries – well, library collections as each had their own comedic chain of dependencies. This is made significantly harder than it ever needed to be due to the Java Development Community’s insistence on naming the JAR libraries arbitrarily. For example, Awesome Library of Awesomeness wants HappyCat.jar which forces you to spend two hours deep in the Googles looking for anything that is in the intersection of “HappyCat” and “Java” before discovering a dust covered UseNet post about the TcpDiscombobulator Project on Sourceforge which, for some reason, the authors decided to compile together into HappyCat.jar – oh, look, the SourceForge page for it has a picture of the primary dev’s happy, smiling cat. FFffffffffffuuuuuuuuu.

    Now I have a huge pile of 3rd party code which I will never have a chance to properly audit so Lord only knows if any piece of it will open a socket to Bora Bora so that enterprising individuals can pull take over the system I’m writing at any given second. I line up all the code, chant the proper incantations to the compiler, and… FAIL. Oh, great. It seems that I have multiple versions of the same library in the dependency chain. And experimentation reveals that the parent dependency depends on that explicit version. I must have been a mass murderer in a previous life to end up with this sort of karmic debt.

    Digging around even more – UseNet, seriously, who still uses UseNet – I discover on a far flung blog written in a language that is sort of English and sort of Not a very short, one sentence hint that leads me to dive back into the Googles. It seemed that the answer was that when this entire ball of failure was initially put together it used these incredibly specific versions of libraries. Attempting to use any others will result in complete and utter failure at least until the development team is able to fix the linking problems in the next revision (This page last updated 2007-04-12 at 04:27:18 GMT). Nowhere in the volumes of FAQs, APIs, or User Guides is this fact even hinted. It’s just assumed that you know this because, I mean, who doesn’t?

  48. Blake says:

    This is the sort of pain many will never understand.
    The only time I’ve included a library and had it just work was for the FMOD sound system, ok sure it’s a proper professional sound library that works on all kinds of computers and consoles but it’s still a rare thing to see.
    Their documentation on the other hand leaves much to be desired.

    These angry rant blogs are good. You should get angry more often.

  49. Mari says:

    I was once hired by a small company (terrible, terrible company) to write an interface for petroleum roustabouts to use for checking and controlling the small company’s pump-off controllers via radio telemetry. The controllers themselves spoke only machine code, of course, so my program was supposed to act as a translator. I think I wrote maybe 2 libraries in the whole project. The rest was all borrowed.

    I would feel bad about that except the company in question A) wanted me to do it in 6 weeks so that they could hand it off to a “real” programmer to “polish” B) paid me minimum wage C) made me share a CLOSET with a guy who literally didn’t have RUNNING WATER in his home (I hosed him down every morning with air freshener and he LAUGHED) and D) fired me for getting pregnant.

    1. krellen says:

      D) is typically illegal. I’m guessing you were poor and powerless at the time and just let it go?

      1. Veloxyll says:

        Or the job was so horrible that she didn’t want to go back, which A through C seem to support

      2. X2-Eliah says:

        Not everyone has the luxury of time and will to undego lawsuits & countercomplaints etc.

        Sometimes it’s best to just move on.

  50. Kamil says:

    In my previous work, I used a hybrid of C++ and Python using boost.python. It’s pretty cool, all the low level stuff like networking is done in C++ but the business logic is done in python. It’s fun to mess around the behavior in python because you don’t have to recompile the whole program, but since python is used as script it’s kinda hard to debug.

  51. CrushU says:

    http://www.thedailywtf.com
    That is all.

    Well, that and I’m in CS right now. I taught myself C++. With a book. I do… alright, with it. I lost the only decent-sized program I made in that language. College is teaching me Java, and a specific professor loves C enough that he’ll give bonus points for people making ‘Java’ projects in C. I did a Cache Simulator (for an Assembly/Computer Organization class) in C when everyone else used Java and he was happy. I prefer C for pretty much anything that doesn’t need methods that only work on specific objects, because C requires less setup and I freaking love #define :p Java’s not as bad as I was first led to believe. I think the JIT helped it a bunch.

    For ‘professional’ programming, I’ve only done a relatively simple setup for Training new hires where I work, HTML+Javascript based exams that email them to the trainers. It works, at least.

    (Ooh! I’m first comment on a second page.)

  52. Veloxyll says:

    And this is why I decided early in my life I am not made to be a programmer.

  53. thebigJ_A says:

    That was fascinating, even though I know absolutely nothing about C++. Or programming in general.

    For instance, wtf is “trash the heap”?

    1. CrushU says:

      ‘The heap’ is the part of memory in your program that has mildly important things like anything you want to persist beyond one function call. I would imagine he’s referring to the Stuff that the library is persisting beyond one method call. He calls an operation to clear that stuff outta memory because he doesn’t need it any longer… And Crash.

      That’s my guess, anyway. My first thought was that ‘trash the heap’ meant dumping EVERYTHING that was on the heap, but that… er. makes no sense unless you’re closing the program.

  54. Shamus, it sounds to me like you’d really enjoy PureBasic http://www.purebasic.com/
    It’s cheap, lifetime license, Windows and Mac and Linux.

    It’s got a native mersienne twister type of PRNG, creating GUI’s are really simple. you can create a window with a button in only 3 lines of code (3-4 more if you count the window loop).
    It’s got a 3D GUI for games, it’s got the OGRE 3D engine, and over 800 native functions.

    It’s procedural so none of that OO mess, although you can go pretty wild with interfaces and lots of other stuff to do OO’like things if you really want.

    You can create really tight executables. (no huge runtime dlls or similar needed) You wanna make a simple small program only a few KB big? you can do it!. It’s got a basic’like syntax, but more mature and logical (guided by the vision of a single developer over the last 10+ years), speedwise it’s on par with C, and you can easily do inline asm as well, and API programming (especially easy to do Win32 coding), x86 and x64.

    And the forums are awesome http://forums.purebasic.com/
    always active, full of nice code and examples ranging from beginner to pro, the developer frequents it, as do some of his helpers, lots of vets, the language itself is great but what really sold me over was the community.

    Check out the demo version to get a feel for it. (no API stuff possible and you can’t make large programs with the demo but it’s otherwise feature complete.)

    I’ve been coding for it for some years now and prefer it over C and C++,
    in some ways it reminds me of how easy it is to just whip up a PHP script to do something on a webserver, so I often just whip up a quick small program in the IDE, code a few lines and run right there and just close it when done.

    PureBasic is a often overlooked and underrated language, and do not let the basic in the name fool you, it might as well been just called “Pure”, but it’s got a basic’like syntax ad it was a competitor to VB and other basic languages back in the day, and the name kinda stuck around.

    And since you can use dll’s (or .so on Linux) and create them it’s very easy to mix with binaries made in other languages, so some of that C++ mess might be made easier by mixing in some PureBasic *shrug*.

    1. Shamus says:

      Tried the demo. Loaded up the OpenGL demo. Doesn’t work with the demo version. Sigh.

      Interesting platform. $100 isn’t unreasonable, although I wouldn’t put up that cash without knowing it was going to do what I wanted.

      Thanks for the link.

      1. Yeah the price is nice, though back when I got it, it cost like almost half that but.. It’s a lifetime license so all future updates/versions are free.

        Anyway, the 3D GUI engine that PureBasic uses is CEGUI so you could try that directly with your project, as per the features list it has a OpenGL renderer etc. http://www.cegui.org.uk/

        Although looking at the screenshot of you mockup transparent menu,
        personally I’d do that in PureBasic (if I had made your program in PureBasic that is…) by simply tapping into the Win32 API, getting the handle to the menu “bitmap” and modifying it’s transparency/opacity. check out SetWindowLongPtr() etc. on MSDN http://msdn.microsoft.com/library/

        As I think you might be able to find some clues there.
        And combine that with opacity (Win2000 and later introduced that ability if I recall correctly).

        If you are lucky you might get the Win32 api to create your menu with opacity from the start, never had the time to check stuff like that out so who knows, there’s so many flags, and there there is the xxxxEx() functions in later windows versions..,

        Although at worst you might have to do a ownerdrawn menu,
        in which case it might just be more fun for you as a programmer to create your own vector based menu system. *shrug*

  55. Eddie says:

    I don’t really understand this stuff, but I read the first bit.
    But, speaking as an Australian, if you need a computer to differentiate between a wombat and a hamster, then there is something seriously wrong with your eyesight; please consult you optometrist.

    1. swimon says:

      I don’t think that he has any problems himself, I think he’s building a general AI. That AI could hardly take over the world without being able to differentiate between wombats and hamsters.

      Yeah I don’t understand this either, never did anything more complicated than a few Matlab programs that’s supposed to calculate integrals (poorly) or a few simple quests in Never winter nights ^^

  56. Drew says:

    *reading post*

    “holy crap, I don’t think I’ve ever seen Shamus curse before… what’s going on?”

    *reads on*

    “Oh… Wow. Yeah, I’d say that’s worthy of a good swearing.”

    Seriously, were I in your position (which I might unfortunately be, in a few years) I would probably be incapable of any communication beyond sporadic screams of frustration. Also: I’m pretty sure most people don’t post how they figured something out because their problem solving-approach was less a logical series of modifications, and more just tweaking things at random until the errors went away.

  57. technogeist says:

    The only libraries I’ve successfully compiled without major dependency hell, also had complementary books published too. But they were C libraries, not C++.

    C Interfaces and Implementations. D.Hanson
    MultiC by MMix Software

    Also given up on C++ and the dependency hell of linux coders.

    Coding on the Mac is much better than it used to be. (Codewarrior? ThinkC? Apple Tools?) The bundled Xcode tools are excellent, and if you must use gcc from the command-line it’s no sweat. (well, fairly painless)

  58. Doug says:

    Its no wonder some of this code doesnt work, its been put together by programming wannabees. As a professional programmer I have to follow standards and procedures and test my code properly. I wonder how much of this open source stuff has been actually designed, rather than just coded??

    1. WJS says:

      Riiight, because nobody who gets paid for it ever writes bad code, do they?

  59. Fred says:

    Tsk, dependency hell, what I do to eliminate dependencies is to custom compile all libraries that I use, instead of using .dll or .so I use .a static library. And then compile my library. And if I need to use my library, it will only need my library and no one else’s. Unless its system level deps than I’ll include them and thats about it.

    Its probably not the best way to do it but it been helping on my simple 2D cross platform game engine I’ve been working on for the past 2 months. Also I had the same issue with opengl gui libraries too. What I need was a simple gui and nothing else. But most where just over bloated, and well acted like and end of all solution which hindered on my game engine which is the solution. So I just rolled my own simple one and it works for the most part.

  60. Simulated Knave says:

    Since no one else has pointed it out, I just thought I’d mention that these steps heavily resemble the process of trying to get a Windows 95 game working on Windows XP or Vista. Or trying to research a computer error message. :P

  61. BrainiacV says:

    My attitude towards 3rd party code is that while it is all fine and good to buy their solutions, you are also buying their problems. Too many times I’ve encountered problems in packaged code to be told “we are aware of it and it will be fixed in our next release.” When is that? “In 6 months.” I have a 6 week deadline. So out goes their code and I roll my own.

    BTW FORTH is the only real language, the rest are for pussies.

  62. nickels says:

    yep, been there!

    It makes me love the old school C libraries like zlib, jpeglib, etc… Those were so easy to download.
    C++ makes things harder with all the class dependencies.
    C was nicer since there were only link dependencies!
    Funny article :)

  63. nickels says:

    p.s.

    Anyone who uses the word ‘troll’ online is a troll!!
    Oh, wait a minute….

  64. Ivan Hanakaze says:

    This is not privative of C++… It happens in nearly any language, the main difference may be that new langs such as Python, C# and such still dont get as old as to get the deadlink.com link expire and dissapear, so many of them are still functional.

    Besides, I was challenged by Uncle Raymond… and I win >_<, so no more source code :(

  65. Peter da Silva says:

    This is why when I want to try out a new package, the first thing I do is look for a FreeBSD port of it. Even if I’m not planning on running it on FreeBSD. If there is, I “cd /usr/ports/foo/bar” and “make install”… and now I’ve got all the dependencies for the program squirreled away in /usr/ports/distfiles, along with documentation on where they came from.

    If there isn’t a port for it, I look for the solution with no dependencies. If there isn’t one, THEN I start panicking.

  66. dinosaur says:

    I’m so old I was already programming when there weren’t any languages yet.

  67. I admit I don’t code MUCH in CPP, however, I’ve programmed in several languages (some 10+, but of course, I only excel in a few).

    The thing is, the frustration I got from CPP is something out of this world. Really.

    For example, I don’t recall EVER building SUCCESSFULLY any CPP program which is not mine. Ok, I’m talking about Big programs, spanning thousands of lines (not counting empty ones ;)).

    Not to boast or anything, but I DID try compilation over a dozen MSVCPP versions, MinGW and of course BorlandC++, with various degrees of FAILURE.

    For instance, I tried several times to build PHP, but I never got it done ONCE. And that IS a Big program with Lots of developers. What gives??!!

  68. allan says:

    I suspect that this may be one of the OpenGL libraries you were complaining about in your post, but just in case it isn’t, have you tried PUI? It’s C++.

    http://plib.sourceforge.net/pui/

    I haven’t tried it, as I do not work in OpenGL that much, but when your mention of needing OpenGL user interface widgets tickled my memory about something on the Omniverous Biped FAQ.

    Hope that helps, or at least does not seriously annoy.

  69. MaxDZ8 says:

    The state of C++ libs is absolutely ugly.
    It is better to say that the state of C++ libs isn’t at all.
    GUI and internationalization is unbelievably BROKEN in a big way.

  70. Aybe says:

    I think you are right, sometimes (if not most of the time) it takes a ridiculously amount of time to try some library for your software and most of the time, it turns out to be a compromise.

    I dreamt of C++ but never used it, it’s so complicate and I did read that it’s very easy to make bad C++, so I decided to not use it. Even simple things like making a managed wrapper needs quite some knowledge. I started with VB and now it’s a few years I’m doing exclusively C#, I am certain I wouldn’t have learn that much in that time frame with C++.

  71. Henry XXXVI says:

    This is old, but it’s funny that you refer to the five things you want in a library you use; if you look at the language of C++ as a project itself, it definitely fails on several counts: it’s only as cross-platform as your compiler suite, C and C++ headers/libraries compete with each other, documentation of the idiosyncrasies of a given compiler suite tends to be spotty, although it does manage to get the job done.

    Unquestionably, C++ is not humble. It tries to be and do everything: an object-oriented, C-compatible, high-level language with low-level functionality, that retains the flexibility of run-time systems without taking a performance hit. The end result is a language that, to some extent, achieves nearly all of these goals, but at the cost of byzantine syntax and a hellish development environment.

  72. ricedilla says:

    Scroll scroll scroll for the answer to only find “Nevermind, I figured it out myself”. A troll’s masterpiece! How I hate it!

    or even better

    When you google for “something”, find a forum thread about “something”, but the only reply given is “GOOGLE it you moron!!1”. IJUSTDIDITZOMGinfiniteloopzFUUUUUUU!

  73. Andrew_C says:

    After reading this post, I like to think that you have actually gotten into knife fights with Eric S Raymond and Richard Stallman over the quality of their code.

    Also I know how you feel about “never mind, I figured it out” posts. When I see them and the thread is still fresh I usually make a point of asking them to tell us how they did it for posterity. unfortunately the sort of person who does that usually never bothers to revisit the thread.

  74. WJS says:

    It kind of sounds like you’re saying that the ability to use libraries is a good point of C++, which is a little weird; are there any languages that don’t have the ability to use some form of library or another?
    (I’m pretty sure you’re talking about the sheer volume of C libraries, rather than their existence)

  75. WJS says:

    Coming back to this, I’m a bit confused by

    You can't compile for a platform unless you have access to it. So if you don't own a Mac then Mac users can't use your stuff.

    Um… isn’t that what cross-compilation is for? A decent compiler should be able to compile for all the common platforms, not just the one it’s running on. Ahh, wait… you use MSVS, don’t you? Never mind, then. That explains it.

  76. Alarion says:

    Sorry for reviving the post, but I’ve stumbled upon it from the front page and re-read it, and found the character encoding to the e-mail at “9) When it fails to compile feel free to email me at the address” broken. It probably should be a “You fool!”.
    Character encoding absolutely sucks. It can break in thousand places, and seems to propagate everywhere. It’s annoying whack-a-mole, is what it is. It would figure I have to deal with it in German, the language of the Umlaut. Vorzüglicher Spaß!

    Edit: Huh, and it also seems I just now broke the comment above me and the featured posts below me. Sorry about that. -.-
    Screen: https://imgur.com/a/TlZPb

  77. Olivier FAURE says:

    Looking at this a few years later: OH MY GOD YES on the “humble” part.

    This is the reason I can’t stand tools like Ogre3d or Qt. They expect your entire workflow to revolve around them, which makes it a pain in the ass to set up small test applications with them.

  78. SG says:

    I like object oriented programming, though my code is mix of object-oriented and procedural.

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>

Leave a Reply to Psithief Cancel reply

Your email address will not be published.