Slashdot Mirror


Outstanding Objects (Developed Dirt Cheap)

Mark Leighton Fisher writes "Some readers might be interested in Outstanding Objects (Developed Dirt Cheap); or "Why Don't Developers Search the Literature?" It seems like I still see a lot of wheel reinvention going on, even with the wealth of code and information now available on the Net."

397 comments

  1. Simple explanation by rickms · · Score: 5, Informative

    It's because all us developers think our way is the better way :P

    Rick

    --
    Making something out of nothing : MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
    1. Re:Simple explanation by ERJ · · Score: 5, Funny

      Well, of course, my way IS better.

    2. Re:Simple explanation by Anonymous Coward · · Score: 1

      Seriously, how can I trust another person's code? If it fails, I will take the responsiblity.

    3. Re:Simple explanation by realdpk · · Score: 1

      And some of us developers know and can demonstrate our way is better, quite frankly.

      Especially when it comes to perl, where the more times you use "use", the slower your code runs per instance.

    4. Re:Simple explanation by fgb · · Score: 3, Funny

      I agree. But my way is BEST.

    5. Re:Simple explanation by vladkrupin · · Score: 4, Insightful

      It's because all us developers think our way is the better way :P

      No, it's because re-inventing the wheel is a lot easier than customizing someone else's utra-cryptic-spaghetti-coded "wheel".

      For instance, I was just looking a good SMTP AUTH solution (aka roaming SMTP) that would integrate well into our customized version of qmail. There were a few solutions that almost did the job, but not quite, while offering a ton of extra bloat that we didn't need. A few hours and a hundred or so lines of C code later I had a working solution. Yes, I re-invented the wheel, but it was a whole lot quicker than figuring out and fixing someone else's code, and without all the bloat attached.

      My point: Often re-inventing the wheel is good, and sometimes is the only way to go.

      --

      Jobs? Which jobs?
    6. Re:Simple explanation by Anonymous Coward · · Score: 0

      Interestingly enough, the article said just that and eleborated on the subject. And the author did a fairly good job too. Since your way is the better
      way, perhaps you should propose corrections to the article to make it even better.

      (I know, this might be too subtle for /., I thought I'd try anyways.)

    7. Re:Simple explanation by stephens_domain · · Score: 1

      A zero length string is not nothing.

      --

      ..
    8. Re:Simple explanation by RealityMogul · · Score: 1

      I'm all for that.

      I had just figured 3 days to fix existing bugs with processing a specific file format.

      I wasted a whole day trying to figure out how the code was even functioning at all in its current state.

      I spent 30 minutes the next day writing a spec for how it "should" work, deleted the existing code and rewrote it from scratch in about 3 hours, spent an hour debugging and it passes all tests and is ready to ship. Added bonuses include the new code being readable, documented, and replaced 4 separate routines with 1 all-purpose routine that is smaller than any one of the previous individual routines.

      One thing I've learned is that when I (or anybody else) does the code-guru thing and just assumes that whatever they're writing is so simple it doesn't need to be documented or even spec'd, it usually turns into a maintenance nightmare later on where a rewrite is the only way for most people to handle it. Even if the person maintaining it is the original author.

    9. Re:Simple explanation by L7_ · · Score: 1

      use strict; ?

    10. Re:Simple explanation by Anonymous Coward · · Score: 0

      Yep, that one too. Although not as much as most. (fwiw, it's not a built-in, as far as I can tell. truss indicates that it is a file that gets read in.)

    11. Re:Simple explanation by silentbozo · · Score: 1

      Even though it doesn't show visible results to customers (or even management) ongoing rewrites of the existing codebase are the only way to keep on top of changing/added features. You do something one way for one routine - ten mutated versions later (each customized for another purpose) it's time to do a rewrite to consolidate the common portions, and break all the custom stuff off into their own fuctions (or function).

      Not as sexy as more bells and whistles, but then again, this is why a lot of the code out there these days is buggy as hell - too much writing, not enough re-writing. And re-writing includes comments. LOTS of comments - at the bare minimum, a function should have at least one sentence describing what it's SUPPOSED to do, so that when it doesn't do that, you have an idea of what should be happening...

    12. Re:Simple explanation by bobthemuse · · Score: 1

      More specifically, I find that reading someone else's code gives me insight into their thought process behind the solution they chose. Especially the comments and commented out lines. Combining the ideas of a few other people and my own, I get all the benefits of understanding as well as easier bug fixes.

    13. Re:Simple explanation by clem · · Score: 2, Insightful

      Yeah, but MY way is...oh, wait, it's not funny anymore, is it?

      --
      Your courageous and selfless spelling corrections have made me a better person.
    14. Re:Simple explanation by Samrobb · · Score: 1
      More specifically, I find that reading someone else's code gives me insight into their thought process...

      <shudder>
      Man... there's code I've looked through where I specifically do not want to have any insight into the author's thought process, because it's fairly obvious that they're drooling syphilitic idiots who have unnatural urges that involve unlubricated farm equipment.
      </shudder>

      --
      "Great men are not always wise: neither do the aged understand judgement." Job 32:9
    15. Re:Simple explanation by Anonymous Coward · · Score: 0

      It never was.
      YHL. HAND.

    16. Re:Simple explanation by torpor · · Score: 1

      Not to mention the fact that it is getting easier and easier these days for people to write good C code. The myth of "good C is difficult" is really not that relevant any more, I think.

      More people are using it than ever, it is a common language at this point, and its not difficult to take existing C codebases, learn a *lot* from them, and then do things better.

      I think most of these 'pundit' type stories about the conditions of the computer industry tend to overlook one simple fact, consistently: the computer industry is new. It still has a loooooong way to go.

      So of course we'll see more programmers writing their own code. Duh.

      --
      ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
    17. Re:Simple explanation by xtrucial · · Score: 1

      Hehehe. You made me laugh.

    18. Re:Simple explanation by Beliskner · · Score: 1

      If we admitted the truth that our application can be code from 500 other existing code fragments, we'd be out of a job. Do assembly line workers every say, "Hey, a machine could do my job as well as I can"?

      --
      A caveman dreams of being us, the incalculable power and riches. We dream of being Q, then what?
    19. Re:Simple explanation by jpkunst · · Score: 1

      Often re-inventing the wheel is good

      Agreed. Often re-inventing the wheel is the only feasible way to understand how the wheel works.

      JP

    20. Re:Simple explanation by whereiswaldo · · Score: 1

      Seriously, how can I trust another person's code? If it fails, I will take the responsiblity.

      That's a little heady, don't you think? Considering how much you use "other people's code" every day to write your own code, not to mention other people's code makes up your operating system.

    21. Re:Simple explanation by jorleif · · Score: 1

      Well MAYBE. But my way is faster.

  2. A few reasons by kin_korn_karn · · Score: 4, Insightful

    1) There's no pride in using someone else's code.

    2) GPL'd code can't be used in commercial apps (blah blah, technicalities, yeah yeah, just try to get it past your boss)

    3) If you're paid by the hour, what's the rush?

    1. Re:A few reasons by Bull999999 · · Score: 2, Funny

      4) You may get sued by SCO.

      --
      1f u c4n r34d th1s u r34lly n33d t0 g37 l41d
    2. Re:A few reasons by Anonymous Coward · · Score: 0

      Yup. About the only way to win is to own your own business and screw your fellow Americans. We live in a society built around sociopathic greed.

    3. Re:A few reasons by cp5i6 · · Score: 3, Insightful

      1) You waste alot of time

      2) Since when can't GPL'd code be used in any commercial application?

      3) I'd have to agree with you on this one tho :)

    4. Re:A few reasons by kin_korn_karn · · Score: 1

      I see you know my top 40 hit. For my next number I will play the classic "Feelings"

    5. Re:A few reasons by Anonymous Coward · · Score: 0

      Well, *I* for one am not doing anything for them, because it's not my fucking job to prop up Indians or Romanians. It's my job to prop myself up. If I have to do it for myself, they have to. If they don't want to, they suffer the consequences. That's how social Darwinism works in my world.

      You confuse corporations with charities. Corporations are not benevolent. They use what they can to increase the stock price and then dump it when it has no further use to them. The increase in standard of living is a side effect, not a goal, of globalization. The goal is to make the golden parachute worth something so that when the CEO makes his/her first mistake and gets shitcanned he'll still be able to keep the payments up on his house and Benzes. If they bring some Indians out of the slums, it's good PR and nothing more to the corp.

    6. Re:A few reasons by Anonymous Coward · · Score: 0

      But remember: analysts aren't paid to help you; most of the time you're not getting the bank's research ... those guys are really more for the institutional/reallyreallyreally investors.

      as with anythign you spend money on, you should always do your own research. Any company that's public must file a form 10k to the SEC which gives you the financial information of a company. (unless the company lies.. :))

      you also have rating agency's that give you a somewhat more fair view (at least to the private investor)... so basically if a company has a research department and they're researching one of their own clients then find another bank that doesn't have the company as a client and compare results.

    7. Re:A few reasons by kin_korn_karn · · Score: 1

      It's a nonstop block of kin korn karn hits!

    8. Re:A few reasons by PhilipMatarese · · Score: 1

      I don't think pride has that much to do with it, although I do take pride in a well crafted segment of a program. I think the biggest reason is faith in the code. If I write it myself, I know that it does what I need it to do, and I could quickly add to it if I needed to.

      I don't mean to say that writing it myself is always the best choice - I've used plenty of components that worked better than I would have ever written and had intuitive interfaces.

      But, there are also a lot of components that I've wasted a coupled days fooling with only to find that they don't fit my needs, don't work reliably, or have confusing interfaces.

      I believe the author refers to this as impatience (no rush though, researching is just boring).

      2) GPL'd code can't be used in commercial apps (blah blah, technicalities, yeah yeah, just try to get it past your boss)
      I don't think most people are worrying about GPL'd code if they're writing linked lists or bubble sorts.

    9. Re:A few reasons by kin_korn_karn · · Score: 3, Interesting

      I work in a mixed Perl and Java shop. We use some third-party stuff, but it's preferred that libraries be developed in-house. There's a distrust of public-domain software here, and there's an extra layer of process related to integrating third-party code. The CM and Ops guys don't care, but the QA and development guys are scared to death of anything that might have a bug that we didn't write.

    10. Re:A few reasons by Xzzy · · Score: 5, Insightful

      4) Other's people's code is documented by monkies, if at all.

      5) Integrating foreign code can be more work than just writing it yourself.

    11. Re:A few reasons by Pxtl · · Score: 1

      4) the documentation invariably sucks. I'm working on my first major C++ project. The system involves a deeply embedded Python interpreter, and a large amount of STLport. By most accounts, these are well-documented libraries.

      I am quickly losing my mind trying to track down poorly written documentation through conflicting and dated sources. And nobody puts any friggin' useful comments in their code. Hell, it took me the longest time to find out that auto_ptr's aren't meant to go in container objects, when at first glance it looks like that's what they were exactly designed for.

    12. Re:A few reasons by jared_hanson · · Score: 1

      4) You may get sued by SCO.

      It works more like this actually:

      1.) Develop your own code.
      2.) Put code on 'net.
      3.) SCO uses your code.
      4.) You may get sued by SCO.

      --
      -- Fighting mediocrity one bad post at a time.
    13. Re:A few reasons by top_down · · Score: 1

      And I have seen so many people explaining you shouldn't put auto_ptr's in containers that I probably bombmail the next one who writes about it.

      The STL is very well documented, you just got to pay for the quality stuff. The Josuttis book is your friend.

      --
      Anyone who generalizes about slashdotters is a typical slashdotter.
    14. Re:A few reasons by dsharp · · Score: 1

      Hell, it took me the longest time to find out that auto_ptr's aren't meant to go in container objects, when at first glance it looks like that's what they were exactly designed for.

      Read Scott Myer's books, Effective C++, More Effective C++ and Effective STL. It will point out a lot of things like not using containers of auto_ptr, that aren't always obvious.

    15. Re:A few reasons by bad_fx · · Score: 1

      4) You may get sued by SCO.

      errr.... "may"?

    16. Re:A few reasons by Anonymous Coward · · Score: 0

      You use Perl and the first thing you do isn't look on CPAN for a module? You poor schlob. You need to give your QA people a boot to the head or something.

    17. Re:A few reasons by corbettw · · Score: 4, Insightful

      "I work in a mixed Perl and Java shop...There's a distrust of public-domain software here...."

      What's there that doesn't make any sense??

      Your company doesn't trust "public-domain software", but codes in Perl??

      --
      God invented whiskey so the Irish would not rule the world.
    18. Re:A few reasons by Ed+Avis · · Score: 1

      But 'faith in the code' is very often misplaced faith in your own abilities. Some programmers are true experts and can do as good a job as a decent library, but most cannot. It's a mistake to assume that if you wrote some code specially for a given task it will be better than a more general library. This is certainly true for things like the standard library (in whatever language), zlib, XML parsing, and other libraries that get a lot of testing. But even further down the suckiness scale you may find that a slightly buggy and not-too-well-documented library is nonetheless better than what you could write yourself in the time available.

      The instinct to throw things away and start again is very strong. But you have to resist it! At the very least you should investigate what libraries are available for a task and play with one or two of them before making an _informed_ decision to roll your own. Most times I've seen wheels reinvented it has been through ignorance or through an (almost always mistaken) belief that the programmer knows better than the library developer.

      --
      -- Ed Avis ed@membled.com
    19. Re:A few reasons by Snotnose · · Score: 1

      4) Often it takes longer to evaluate the 12 half-finished projects out there than it takes to develop your own.

      5) As someone else has already said, often the documentation was written by monkies on valium.

      That said, I tend to reuse my own code a lot. I've got a logger or two, some code timers, command line parsers, etc that I wrote 10 years ago and just modify here and there.

    20. Re:A few reasons by Fulcrum+of+Evil · · Score: 1

      Your company doesn't trust "public-domain software", but codes in Perl??

      Where's the conflict? Perl isn't PD.

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    21. Re:A few reasons by Anonymous Coward · · Score: 0

      that's really ironic that you don't want to use any "3rd party libraries" when many, if not most, core perl modules started out as a "3rd party" (what does that mean in the context of a loosely-grouped colaborative project, anyway?) module written to solve a particular problem. in fact, the same is true about perl.

      but i do understand your fear and distrust of some of the lesser used crap on cpan...

    22. Re:A few reasons by Anonymous Coward · · Score: 0

      Whoa, I thought you had said a "mixed urine and feces shop", until I reread it, and realized you said the functional equivalent.

    23. Re:A few reasons by Ryan+Amos · · Score: 1

      GPL'ed code can be used in commercial apps, but then you have to GPL those apps. Most companies would rather pay you to reinvent the wheel than GPL the code they paid you good money to write. Also, people who like GPL'ed stuff hate paying for it. If you released a GPL commercial office suite, you'd have to release the code as well, and other people would just fill in the rest and develop a free-as-in-beer version with the exact same features and functionality as your product. Thus making your product worthless. So in other words, the GPL community makes corporations avoid it like the plague.

    24. Re:A few reasons by Ozan · · Score: 1

      1) There's no pride in using someone else's code.

      This is ridiculous. Do you always do everything by yourself, do you refuse to buy a readymade table but instead go out to the woods, chop the trees yourself and carpet everything on your own?

      Who told you the only way to get pride is to make everyting for yourself? Only a fool does think so. Since the bronce age or even earlier mankind makes use of division of labour.

      Instead of inventing the wheel for the millionth time real pride comes from making something new.

      2) GPL'd code can't be used in commercial apps (blah blah, technicalities, yeah yeah, just try to get it past your boss)

      GPL'd code is not the only source of prior art, and furthermore even GPL'd code can be reused in the way of implementing an algorithm in your own code instead of just copying it.

      3) If you're paid by the hour, what's the rush?

      To make it short: If you can't find yourself other work than reinventing the wheel you should adjust you attitude. Unlike most other things there is never too few work. There is always something to do, and if it is "only" QA. Tidy up your code, comment it, document your work, test the new function. Come on! Is your boss so dumb that he only accepts sweatshop-like hacking without any research? I have to tell you, if I was him, and your attitude is like that I would condider you as one of the first to go in a case of a layoff.

      There are reasons to ignore other's work, but these certainly belong to them.

    25. Re:A few reasons by Anonymous Coward · · Score: 0

      If you code perl and java who cares if you
      reinivent the wheel.
      It couldn't really be done worse
      the second time around.

    26. Re:A few reasons by Anonymous Coward · · Score: 0

      My monkey definitely writes better code than
      your monkey.

    27. Re:A few reasons by Anonymous Coward · · Score: 0
      The CM and Ops guys don't care, but the QA and development guys are scared to death of anything that might have a bug that we didn't write.

      Well, dunno about where you work, but I've got a few QA folks around us who just love PD software - exactly because it lets them turn issues outside of our control (bugs in 3rd party software) into "stop ship" issues. We eventually end up documenting the bugs and shipping anyways, but they seem to get an inordinate thrill out of having showed just how important they are.

      And before anyone starts whining about how QA is right, these should be stop-ship bugs, and everything is open source, so why don't you just fix it? Well... tell me: would you want to have to upgrade to a special build of Gnome because Some Weird Commercial App required it? Or would you gleefully tell us where to stuff it and find Some Other App that had the same functionality, but didn't require a massive system upgrade in order to run?

    28. Re:A few reasons by Tangurena · · Score: 1
      4) I wrote it for companyA, and now I work for companyB. The code I wrote for companyA belongs to them now. In order to write the code for companyB, I have to reinvent the wheel.

      5) In general, I do usually find matches for something related to the company's needs browsing the research literature, but I tend to get in trouble a lot for browsing the web or reading magazines or books on company time. So call this one the look busy factor.

    29. Re:A few reasons by kin_korn_karn · · Score: 1

      we can't all be as stunningly perfect as you. If you find what I said offensive, it's your ulcer.

    30. Re:A few reasons by kin_korn_karn · · Score: 1

      Semantics. I work for a lot of IT and software old-timers that value reliability over flashiness. They trust perl because it's been proven for years to work. They don't trust random stuff off of CPAN because some of it's crap and hasn't been proven.

    31. Re:A few reasons by be-fan · · Score: 2, Informative

      Maybe you should learn the use the STL first. One of the first things they teach you when learning the STL is that auto_ptr cannot be put in containers (try boost::shared_ptr for that). Its one of the most well documented libraries I've ever used. Try the SGI STL site, as well as Dinkumware's STL reference. Anyway, Google is your friend. A search for auto_ptr nets this article, on using auto_ptr effectively, as the first hit. It has an entire section titled "Things Not To Do, and Why Not To Do Them".

      --
      A deep unwavering belief is a sure sign you're missing something...
    32. Re:A few reasons by Ben+Hutchings · · Score: 1

      I suggest you read some of the good C++ books - Accelerated C++, Effective C++, More Effective C++, Effective STL, Exceptional C++, More Exceptional C++ and Modern C++ Programming are all well worth a look. Also try subscribing to some of the C++ newsgroups - comp.lang.c++ or comp.lang.c++.moderated are the main ones.

  3. AC/DC by blackmonday · · Score: 4, Funny

    I wasn't aware that AC/DC was involved in software development till now.

    1. Re:AC/DC by Roto-Rooter+Man · · Score: 5, Funny

      After the dot-com bubble burst, AC/DC were hired as consultants by a number of tech firms. Apparently due to their expertise in getting "back in black".

      --

      The goatse guy for president. Win one for the gaper!
    2. Re:AC/DC by Anonymous Coward · · Score: 0

      It's a good thing I've got a life, otherwise I'd be pissed.

    3. Re:AC/DC by kin_korn_karn · · Score: 5, Funny

      For those about to pun, get on the highway to hell.

    4. Re:AC/DC by SlashdotLemming · · Score: 1

      Actually they are....
      Check out their site at http://www.acdc.com

    5. Re: AC/DC by Black+Parrot · · Score: 1


      > For those about to pun, get on the highway to hell.

      I was already there.

      --
      Sheesh, evil *and* a jerk. -- Jade
    6. Re: AC/DC by kin_korn_karn · · Score: 1

      You're not faking?

      That's dynamite!

    7. Re:AC/DC by BigBadBri · · Score: 1
      Well, I've heard it said that there's a whole lotta Rational Rosie out there...

      --
      oh brave new world, that has such people in it!
    8. Re:AC/DC by operagost · · Score: 3, Funny
      For those about to hack...

      FIRE!

      --

      Gamingmuseum.com: Give your 3D accelerator a rest.
    9. Re:AC/DC by iago · · Score: 1

      I'm not worried about life in hell.

      Because I got the biggest balls of them all.

      --
      Worst Sig Ever
    10. Re:AC/DC by finkployd · · Score: 1

      Five words:

      Dirty deeds, done to sheep :)

      Finkployd

    11. Re:AC/DC by leshert · · Score: 3, Funny

      Whew.... I'm glad I wasn't the only one who thought of AC/DC when reading this summary:

      Outstanding objects, and they're developed dirt cheap
      Outstanding objects, and they're developed dirt cheap

      Functors... serialization... patterns...
      Developed dirt cheap
      Regex... templates... iterators...
      Developed dirt cheap

    12. Re:AC/DC by primus_sucks · · Score: 1

      They also worked during the dot-com boom doing HTML for $200/hr.

    13. Re:AC/DC by igrek · · Score: 1

      One of their first albums^H^H^H^H^H^Hcontracts:

      "Dirty deads done dirt cheap"

  4. Laziness by tomakaan · · Score: 1

    Looking at myself at least...

    Most of us are lazy by nature. It takes a lot of effort to go out and find what source code I need. Why would I do that when I can just write it all?

    And of course, my code is better than whatever else I could find. Why would I want to use someone else's?

    1. Re:Laziness by Anonymous Coward · · Score: 0

      Like your Corporate webpage?

      Might want to put something up there before you go advertizing and shit, It's kinda unprofessional, and makes you look like an ass.

    2. Re:Laziness by L.+VeGas · · Score: 4, Funny

      Most of us are lazy by nature.

      I completely disagree. As a matter of fact, I have an article that totally disproves this, but I don't feel like finding it right now.

      Maybe after my nap.

  5. Because... by Znonymous+Coward · · Score: 0, Troll

    they all use visual basic!!!!11

    In which case they are not inventing anything.

    --

    Karma: The shiznight, mostly because I am the Drizzle.

    1. Re:Because... by Anonymous Coward · · Score: 0

      Congrats on being the first flame

  6. Reinventing the wheel by Roto-Rooter+Man · · Score: 1

    Why search the literature when you can just patent the wheel? A bunch of lawyers will come around and tell you all about the previous ideas, and you avoid doing even a second of research.

    --

    The goatse guy for president. Win one for the gaper!
    1. Re:Reinventing the Wheel by porkchop_d_clown · · Score: 2, Insightful

      Except that your training yourself to reinvent the wheel every time, which means you won't know where to look for "conventional resources" when you need them.

      Which is pretty much what happens everywhere...

    2. Re:Reinventing the Wheel by malfunct · · Score: 1
      Yeah, but do you grab the quicksort routine out of the library that comes with your language (most have one) or do you write it yourself?

      I for one use TONS of external libraries to do things for me (XMLDom, WININET, higher level windows network objects, string and collection libraries).

      I think that code reuse happens tons more on the lower level things that are a pain to do on your own. I think it also depends on who develops the modules, I'm far more likely to rely on something that ships inside windows (eh they can be buggy but for the most part I trust the platform) than I would on something third party. I know the windows modules will be there on all my target platforms.

      --

      "You can now flame me, I am full of love,"

    3. Re:Reinventing the Wheel by Spuggy · · Score: 2, Interesting

      You do have a good point there about owning the code. I've found this repeatedly at my company with using external/free software solutions in general.

      It's a completely idiotic approach to take. They have no problem paying for a god-awful piece of software that somebody thought was cute, but never bothered to check and make sure it'll support everything we need (or even bother to ensure that it'll scale properly), but they are vehemently against using any type of open source software and discourage use large chunks of external code in your apps.

      A lot of this stems from code-ownership. They want somebody that they're paying to come back and blame; whether it be me, the outside vendor, or whomever. It's ridiculous and I've tried to make my case time and time again when trying to deal with some of the morons at support, that if we were dealing with an open solution and I could see the code, that I could figure it out for myself. Sure a lot of times it's nice to be able and call and throw it in their laps, but when you hit that week mark and your support vendor isn't able to come up with a solution and you've reached the limits of what isn't in a binary format, you start to get a little frustrated.

      I'm slowly making in-roads though; I can see a lot of managers' concern with using Open-source because if you don't get a support contract, you're relying on your in-house people to support everything, which obviously causes a problem if those in the know leave. But is it really necessary to pay a small fortune for a SQL Server, Windows 2000 Server running IIS to produce some basic web applications when Apache/PHP/MySQL|PostgreSQL are all available out there. (And this is the reason that I'm loving .NET & the mono project--should be easier to push this if I can say the same (intelligently) written code will work in Linux).

      Ah well, got off topic there, but I'm always a big fan of using external code, but have found repeatedly that I'm not allowed unless I sneak it in and take credit for it myself (which I have/will never do).

  7. The catch-22 of code reuse by Cally · · Score: 5, Insightful

    If it's generic enough to be scratch your particular itch, you'll need to do a lot of work to implement the specifics of your case. If it's very highly specialised, you'll need to do a lot of work to adapt it to the specifics of your case.

    Given the choice, would you rather work on adapting someone else's code for your situation - or would you rather write your own from scratch?

    (it's a rhetorical question ;)

    --
    "None are more hopelessly enslaved than those who falsely believe they are free." -- Goethe
    1. Re:The catch-22 of code reuse by Anonymous Coward · · Score: 0

      ROFLM~F~AO!

      Like everyone else I got all got all pissed off with Caldera/SCO for their petty, vindictive & malicious behaviour. But now look at 'em... the management team will never work again in corporate America, the company will be bust quicker than you can say "busted flush", and the shareholders (if there's any justice) will be left with nothing. How hilarious! :))

    2. Re:The catch-22 of code reuse by etcshadow · · Score: 4, Insightful

      This is honestly very often the case. I think that the best comprimise (from my own experience) is to take overly-flexible packages and write your own middle-layer that glues together the powerful but too flexible to be useful code with your own specific needs.

      Of course, the humor is that you find yourself writing wrapper layers for wrapper layers.

      --
      :Wq
      Not an editor command: Wq
    3. Re:The catch-22 of code reuse by Anonymous Coward · · Score: 0, Redundant

      Contrary to what a lot of people seem to think, I really do think that software engineering is different from software craftsmanship. Although you can take many of the things said about software engineering and come up with an application of them similar to an application you could come up with for software craftsmanship, but in practice you wouldn't. This is because the underlying philosophies are very different, and they exist for different purposes. The philosophies/purposes break down like this:

      Software Engineering: make the development of software a controllable business process.

      Software Craftsmanship: make the best software.

      The basic notion of software engineering is to create a *process* which is so perfect that no personal weaknesses in your programmers can hurt the company. A subtle side effect of this is that it also tends to prevent any extremely great individual contribution from having a large impact. That is, the goal is to make all of your coders cogs in a machine. The business owners and managers would much rather have this setup because it makes it easier for them to sleep at night.

    4. Re:The catch-22 of code reuse by siskbc · · Score: 2, Informative
      Of course, the humor is that you find yourself writing wrapper layers for wrapper layers.

      And that leaves you with an application having an efficiency similar to that of a big SUV. OK, so I do it too, but that's no excuse. ;)

      --

      -Looking for a job as a materials chemist or multivariat

    5. Re:The catch-22 of code reuse by etcshadow · · Score: 1

      Holy crap! Do I have a fan-club or something? That talk sounds awfully familiar.

      --
      :Wq
      Not an editor command: Wq
    6. Re:The catch-22 of code reuse by etcshadow · · Score: 1

      Yeah, but one of the ironies of software development in this day and age is the concept of total cost:

      It used to be the computation cycles were incredibly expensive things, and programmer work-hours were relatively inexpensive in comparison (well... I don't mean literally cycles compared to hours... but say billions of cycles compared to hours or some such). Of course, in today's world, the time of a *good* programmer can be fairly expensive, whereas big fast computers are fairly cheap. When you look at the total cost to do develop and run and maintain a software system over its lifetime, you begin to see an advantageous trade-off emerge. Quicker time to develop and easier maintenance, even at the cost of a significant degredation in application performance (within reason, of course) is a REALLY GOOD DEAL. It's not about laziness, it's economics of the simplest sort: all things being equal, lower costs (total costs, of course).

      Anyway, this is nothing new or insightful... but it is apropos to the comment.

      --
      :Wq
      Not an editor command: Wq
    7. Re:The catch-22 of code reuse by kawika · · Score: 1

      Amen, brother!

      Just a simple example: I was looking for a good C++ class that would encapsulate the mess that is the Windows Registry. There are several out there, but they all manage to drag in massive functionality or frameworks that I am not currently using and would prefer to avoid. I am not going to start using MFC just to read a few registry values.

      The C++ string mess in Windows makes me cry every time I have to deal with it. I'm sick to death of converting between BSTR, TCHAR, WCHAR, char, CComBSTR, TString, STL string, and several others every time I want to pass a few characters around.

      Things are much more reusable in Perl or JavaScript or just about any other language, and there are fewer excuses for avoiding code reuse than in C++.

    8. Re:The catch-22 of code reuse by siskbc · · Score: 1
      Quicker time to develop and easier maintenance, even at the cost of a significant degredation in application performance (within reason, of course) is a REALLY GOOD DEAL. It's not about laziness, it's economics of the simplest sort: all things being equal, lower costs (total costs, of course).

      That's true of course - my personal tradeoff is I'll always be a smartass even at the expense of absolute truth. ;) The one caveat I will say is that your analysis is 100% true for up-front development, but not necessarily maintenance. Put too many glue layers in and whoever has to maintain that code is either going to cry or hunt you down and kill you. And since you could be maintaining your own code, that could get messy. ;)

      --

      -Looking for a job as a materials chemist or multivariat

    9. Re:The catch-22 of code reuse by etcshadow · · Score: 1
      Put too many glue layers in and whoever has to maintain that code is either going to cry or hunt you down and kill you.

      Oh, that's absolutely true... I was replying more to the general notion that slow code is bad code (as a general rule). The whole point was about total cost, and the oft-quoted figure is that there is about a 10 to 1 ratio of development work to maintenance work on any body of software... so you certainly don't want to sell out maintenance costs to development costs. The flip side to that, though, is that there is frequently much higher *opportunity cost* to development than to maintenance... the rush to market, and hence the need for rapid prototyping. How many businesses failed because they were trying to write their code in the "right way" instead of the "right now" way... only to find that before they had finished, some competitor whose system was held together with spit and duct-tape had pulled off a land-grab. If you're an MBA-type, you can probably assign some sort of dollar-value to that stuff, and then compare it against maintenance costs...

      ...and to make a long story short, that's why I program primarily in perl these days! :-D

      --
      :Wq
      Not an editor command: Wq
    10. Re:The catch-22 of code reuse by siskbc · · Score: 1
      he flip side to that, though, is that there is frequently much higher *opportunity cost* to development than to maintenance... the rush to market, and hence the need for rapid prototyping. How many businesses failed because they were trying to write their code in the "right way" instead of the "right now" way... only to find that before they had finished, some competitor whose system was held together with spit and duct-tape had pulled off a land-grab.

      Yeah, that's always the risk - and as you say, damned tough to balance. Probably why most "version 1's" in competitive fields suck, and you hope that decent companies patch it for v2. Hate to spend years making a good program that you have to end up kludging at the end anyway because the good version got outdated...

      For what it's worth though, I wonder how many fields are really that competitive. I'm not really a software engineer (I just write stuff to support my research), so my stuff isn't all that mission-critical, there's no chance anyone will ever maintain my code, and no one will beat me to market (since I'm the market!). So I can't really comment on the competitiveness angle, but for custom/contracted software, I'd definitely err on the side of doing it right the first time. It's funny - I always used to think I'd remember how I did something, under-comment the code, forget, have to make changes, and hate myself. ;) Do that a couple of times, and you end up commenting like a madman and structuring things cleaner. Assuming you have a boss that lets you spend the time to do it, of course.

      ...and to make a long story short, that's why I program primarily in perl these days! :-D

      No doubt. C may be faster and all, but damn those segfaults! ;)

      --

      -Looking for a job as a materials chemist or multivariat

    11. Re:The catch-22 of code reuse by Ian+Bicking · · Score: 1
      I really dislike layers, and not because of the CPU overhead. It creates a conceptual overhead.

      In the original article, and in some of the defenses of layers that follow in this thread, there's a notion the problem is how much time a program takes to develop. Writing it the first time isn't the hardest part, in my experience, it's maintaining it.

      Layers can work well if each layer is robust, and its role clearly delineated and described. When that is not the case, the system is conceptually heavy and pieces cannot be understood or modified in isolation. One common problem is that a bug in a lower level will propogate to a higher level, but in a way that is mysterious and difficult to debug. Or different layers, when first put together, will interact in unpredictable ways. Everything should be predictable -- that's the most important quality I see in a library.

      Some things work great. I certainly don't mind layering my network code on a socket library. Of course, everyone has been over that for a couple decades -- as time goes on the foundation expands. The safety of layering improves, but you have to identify the underlying layers that can really be trusted.

    12. Re:The catch-22 of code reuse by etcshadow · · Score: 2, Informative

      Yes, wrappers or layers are just a type of abstraction/encapsulation... and you always have to be careful when creating new abstractions. (See "Leaky abstractions" etc.)

      What I was saying about wrappers for wrappers was meant to be just sort of a joke... pointing out the fact that if you are making a wrapper around some standard tool to tailer it for your own use, you have no idea what that tool is in fact a wrapper around, itself. Just the irony of building a black box around a black box creating a new black box... and while thinking about that you have to wonder about what's inside the box inside of yours (was that inoherent? probably). China dolls? Who knows. Anyway... now I'm just rambling.

      The point of talking about layers is simply to address the concern raised further up the thread that people can't reuse code because it is either too general, or too specific (for something else). Wrappers are a good way to make a general tool into a tool that is specific for your purposes... and it is often easy to create a simple but robust wrapper that just makes a general tool more useful. Some simple (possibly over simple) analogies are shell scripts ad aliases. Think about what you are doing with these... you're just taking powerful tools and tailering them to the particular use-cases that you want them for.

      Or here is (probably) a much better example: XML parsers. A truly compliant XML parser is an incredible pain in the ass to a typical application developer, because it leaves far too much work for the developer. How often does a developer simply want to use an XML parser/generator simply for serialization/deserialization of complex data objects? (I know that I do this all the damn time.) What you need is not a powerful, compliant XML parser, but a nice little wrapper around one that does everything you need and nothing you don't. Of course, different projects may have different notions of what is necessary and what isn't... hence you end up making your own wrapper around a very general tool... then you end up using that wrapper all over your code.

      --
      :Wq
      Not an editor command: Wq
    13. Re:The catch-22 of code reuse by Anonymous Coward · · Score: 0
      You'd wish eh?

      Do you live in an imaginary world where if someone on IRC pissed you off, you could make a few calls, and have them wiped out of existence?

      Or maybe you live in a world where you think to yourself, "oh those bullies that harrass me, they will eventually get what they deserve when the day of the vampyres come."

      Caldera/SCO's management will do *just fine* in coprorate America. If anything they'll do better than regular peple. The company will probably survive, but if it doesn't, it won't be because of the lawsuit that it goes down. And the shareholders... they will probably not even lose half as much money as if they had some stupid dot-com share from 2 years ago.

      Wake up and smell the coffee... there isn't any vindication coming your way.

    14. Re:The catch-22 of code reuse by pVoid · · Score: 1
      Who the fuck are you? Are you for real?

      You are the biggest troller I've ever seen. The windows registry is as much a mess as a file system is. You open a handle, you read a value, you close a handle.

      The C++ string mess in Windows...

      BSTR, TCHAR, WCHAR, char, CComBSTR, TString, STL string

      BSTR = typdef OLECHAR = typedef wchar_t

      TCHAR = char or wchar_t (depending on your target)

      WCHAR = typdef wchar_t

      char = char

      CComBSTR and STL strings are the only two things that you talk about which aren't intrinsic types and are actual classes (I don't know what TString is)...

      If you are afraid of handling strings in C++ my friend, you really shouldn't be using C++. You should even less be complaining about how "Windows strings" are a mess... because these strings are as Windows as flour is Nabisco.

    15. Re:The catch-22 of code reuse by Anonymous Coward · · Score: 1, Informative

      Win32 string handling is a confusing mess.

      • BSTRs appear throughout COM and just about nowhere else. BSTR is compatible with wchar_t[], but not vice versa: a BSTR has to be allocated long-aligned on an otherwise-inaccessible heap in the library, preceded in memory by its length. There are no BSTR literals.
      • They cloned almost the entire API (with a kludgy preprocessor mess instead of templates and overloading, even when compiling C++) just to allow UTF-16 as well as legacy code pages, but without supporting surrogate pairs only a fraction of Unicode is actually available. UTF-8 might not be supported at all unless you link against a redistributable DLL that overrides a system component.
      • They ship a C++ compiler with STL and Win32 headers, yet none of the Win32 string-oriented functions have wrappers that work with std::string or std::wstring. They've written three C++-specific string wrappers (CString, CComBSTR and _bstr_t) and none of them can be used in palce of std::string or std::wstring, follow the STL container conventions, or even support iostreams. (Likewise, why the hell isn't _com_error a std::exception?)
    16. Re:The catch-22 of code reuse by be-fan · · Score: 1

      It all has to do with the fact that:
      A) Microsoft can't write APIs worth shit. They're over engineered, overly complex, and each one seems to be tainted with the personal ideosynchrosies of whoever wrote it. Worst of all are all the stupid typedefs: why the fuck does LPSTR exist? What's wrong with const char*? What the fuck is a DWORD? Is it like an int? What's a WINAPI? It's like there is a Microsoft-specific superset of C++ that you're supposed to learn before tackling Win32. And don't even get me started about the FORTRAN-like use of capitalization.
      B) STL strings didn't exist at the time Microsoft wrote the APIs, so they have an excuse for not supporting them. Qt had the same problem, but they've taken more steps to ease compatibility issues.

      --
      A deep unwavering belief is a sure sign you're missing something...
    17. Re:The catch-22 of code reuse by kawika · · Score: 1

      Thanks for your polite observations. My point was in the context of code reuse. In a Windows program, there are many painfully different representations for strings of characters, especially when you're dealing with lots of system functions and interfaces. Classes won't protect you from the subtle differences. If something needs a BSTR and you pass it a WCHAR the compiler can't help you because they both look the same to it. That also makes it difficult to overload useful functions.

      You kind of got the point when you observed that only two (three with MFC's TString) are proper classes. But basic COM and Windows APIs don't use classes, that is the point of writing the wrappers. If I choose STL strings for my registry access class but you use CComBSTR strings and want to reuse my code, then you will have to copy and hack it.

    18. Re:The catch-22 of code reuse by Anonymous Coward · · Score: 0
      • WORD and DWORD are ignorantly defined to always be 16- and 32-bit unsigned values, even on 32- and 64-bit platforms (where "word" actually means 32 or 64 bits, respectively).
      • WINAPI is a good thing (now the compiler can use other calling conventions for most user-defined functions), though it should have been a #pragma in front of the API header prototype.
      • Defining a C API with distinct char[] and wchar_t[] function names was appropriate. But they should have defined overloaded inline wrappers that accept standard C++ strings as soon as those were added to their compiler. They aren't even doing this for new functions. (And what idiot decided you can't FormatMessage onto an ostream?)

      Reuse is crippled when each platform's API is incompatible with everything else.

    19. Re:The catch-22 of code reuse by pVoid · · Score: 1
      I personally use WinNT as a platform (as I develop server software), and I always compile UNICODE.

      As far as I'm concerned, the only type I use is TCHAR (bless Microsoft for making that type), and the underlying wchar_t that it maps to.

      This makes me be able to use all strings regardless of where they come (COM runtime, or Win32) using the same wrappers. The *only* issue that I *have* to deal with is memory managment, and quite frankly that is *not* an issue to me... I have chosen to stick with C++, I will accept the responsability of managing my own memory.

      Memory managment is easy too: normal heap for just about anything, SysAllocString/CoTaskMalloc - ie. memory via IMalloc for any COM business, and the *very* occasional shared memory allocations for Shell work.

      I personally don't find it to be too much to ask that memory being shared in the COM runtime be allocated via IMalloc. For your information, you can override your new/delete operators (as I've done in several projects) so that they use IMalloc internally... and there you go, new/delete does all your work ever.

      I think you guys are just bitchy, that's all.

    20. Re:The catch-22 of code reuse by be-fan · · Score: 1

      With reference to WINAPI, I was making a comment about all of Microsoft's nonstandard extensions to C/C++. While I can understand certain extensions being there for special cases (like GCC's alignment directives) you should expose them in the main API!

      --
      A deep unwavering belief is a sure sign you're missing something...
    21. Re:The catch-22 of code reuse by smithmc · · Score: 1

      The C++ string mess in Windows makes me cry every time I have to deal with it. I'm sick to death of converting between BSTR, TCHAR, WCHAR, char, CComBSTR, TString, STL string, and several others every time I want to pass a few characters around.

      Um, WTF? None of that has anything to do with C++. Most of that crap you just mentioned is Windows and/or COM/ATL specific, not C++ specific. C++ has exactly one string type - std::string (well, OK, that's a specialization of std::basic_string<>, but whatever.) There's char *, but it's deprecated. Anything else is non-standard, and can probably be blamed on Microsoft rather than AT&T or ISO.

      --
      Downmodding is the refuge of the weak. Don't downmod, make a better argument!
    22. Re:The catch-22 of code reuse by Anonymous Coward · · Score: 0

      Why use TCHAR instead of wchar_t, if you don't need a non-"Unicode" build? Code that needs wide characters should say so.

      Sucks to be you if anyone uses surrogate pairs to reach any character past U+FFFF. Or sends UTF-8 (the preferred encoding at IETF and W3C). Or you pass a wchar_t[] from IMalloc to some API that expected a BSTR and uses SysFreeString on it.

    23. Re:The catch-22 of code reuse by Anonymous Coward · · Score: 0

      Nobody's claiming this is anyone else's fault. It's Microsoft who ship an API using several string types along with a C++ compiler having no std::basic_string<> specializations compatible with them.

    24. Re:The catch-22 of code reuse by Anonymous Coward · · Score: 0

      whatever my dear friend. WHATEVER.
      -pVoid

  8. One word, half a wit. by nick_davison · · Score: 1

    It seems like I still see a lot of wheel reinvention going on, even with the wealth of code and information now available on the Net.

    SCO

  9. reinvent the wheel! by neuroneck · · Score: 1

    Because it is fun! One of my coworkers once asked me why I would reinvent the wheel, I was doing stuff in Lisp for autocad, and he said that he could proably find the same thing online. I told him that the challenge was fun, and along with that it allowed me to tailor the function to exactly what needed to be done.

    1. Re:reinvent the wheel! by (startx) · · Score: 1

      the problem with tailoring it to the exact task is that often the task changes. I've been working on a custom app for 3 weeks now, and the requirements have changed twice allready.......

  10. HAHA BECAUSE IT SAID DONE DIRT CHEAP HAHA by Anonymous Coward · · Score: 0

    ur teh funnay

  11. Sometimes doing it yourself is worth the time by LiberalApplication · · Score: 1
    Personally, I've felt that a lot of times, struggling through certain projects intentionally has been quite rewarding. There are, of course, times when I realize that for the sake of tight deadlines or my personal appraisal that "there isn't enough to be learned from the reinvention" that I will look up ready-to-eat solutions.

    Generally though, it's not even that I think my code is better, but that my code will get better by having learned the pitfalls the hard way, given that I have enough time to do so without sacrificing sleep, personal hygiene and sanity.

  12. Very Interesting... by delirium28 · · Score: 3, Funny
    ... but I could have wrote it better, using my own hybrid authoring algorithm.

    ---
    I read your email...

    --
    Who is John Galt?
  13. Three Words... by angst7 · · Score: 2, Insightful

    I still see a lot of wheel reinvention going on...

    Not Invented Here.

    --
    StrategyTalk.com, PC Game Forums
    1. Re:Three Words... by fgb · · Score: 1

      Sometimes it's even worse than that.

      Sometimes it's Not Invented by Me.

      The trick is knowing when to reuse and when to reinvent. Neither approach is the best one the majority of the time.

    2. Re:Three Words... by realdpk · · Score: 1

      The 3 R's:

      49% of the time, reuse
      49% of the time, reinvent
      2% of the time, PARTY DOWN!

  14. I don't know about others by Anonymous Coward · · Score: 3, Interesting
    but I always look to see if the problem has already been solved by some one else first. The only thing that I have encountered is when I share the facts I find, people usually respond "that's not the same thing." then 5 months later they come back and say, "you know, this is like that problem you mentioned a while back."

    some times it's not appreciated. but hopefully people eventually come around.

  15. Why wheels often reinvented by truth_revealed · · Score: 5, Interesting
    Here's some of the issues I've run into with a lot of the free software libraries out there:

    library uses wrong language

    library has the wrong license

    library pulls in too many external dependencies

    library not threadsafe

    But it's worth the search - occasionally you find a real gem.

    1. Re:Why wheels often reinvented by Lumpy · · Score: 2, Insightful

      # library pulls in too many external dependencies

      BINGO!

      i cant count how many times I tried to use a "library" that had 4-5 dependancies that made it 100% useless.

      and then you get some that are a Dep hell going 3 to 4 levels deep.

      no thanks.

      --
      Do not look at laser with remaining good eye.
    2. Re:Why wheels often reinvented by realdpk · · Score: 4, Informative

      Not to mention how much CPU time each of those takes. For example, check out the "tinyurl.pl" example in CPAN. It uses:

      use POE;
      use POE::Component::IRC;
      use LWP::UserAgent;
      use HTTP::Response;
      use HTTP::Request::Common;
      use URI::Find;

      Each of which probably use a good number of libraries themselves. Running perl -wc on the script takes .6 user CPU seconds alone - an approximation of how much CPU time it takes to start up (and by my measurement, a pretty accurate approximation).

      Hell, check this out:

      $ time perl -e "use POE"
      0.23s real 0.21s user 0.01s system

      Sick.

    3. Re:Why wheels often reinvented by axxackall · · Score: 1
      The Chaos in deps of Perl modules was one of reasons I've abandoned Perl in all project where I am architecting. (Perl's obfuscated syntax is the other one).

      Speaking about dependencies: I found Gentoo's Portage is the best way to handle them. All software developers should look for patterns studding Portage just for that - for learning how to control dependencies.

      --

      Less is more !
    4. Re:Why wheels often reinvented by dvdeug · · Score: 2, Insightful

      $ time perl -e "use POE"
      0.23s real 0.21s user 0.01s system


      If you can reimplement what you need, and never be more then a quarter of a second less effiecent, and never crash or abort where the original wouldn't have (because a crash or abort takes minutes and pisses off the user much more then waiting for the program to start up), and justify spending the time reinventing the wheel over .6 seconds of startup time, then go for it. But unless you writing MacOS or Mozilla or X, it's just not worth it.

    5. Re:Why wheels often reinvented by realdpk · · Score: 1

      What about the CPU cost per hit of a high traffic (1Mhit/day or more) CGI-based applicatoin? Reducing a quarter of a second to a hundredth of a second can save you real dollars (in terms of server purchasing), and in most cases, it can be done, if you're not afraid to reinvent a bit.

      Btw, mod_perl is not the answer here - it consumes memory and CPU like nothing else, has issues with caching or something (I don't know how to describe it exactly, but sometimes data that is changed between hits doesn't actually reflect as changed. It's inconsistent, at best.)

    6. Re:Why wheels often reinvented by Troll_Kamikaze · · Score: 1

      What about the CPU cost per hit of a high traffic (1Mhit/day or more) CGI-based applicatoin?

      Who the fuck bases a 1Mhit/day site on CGI?

    7. Re:Why wheels often reinvented by Anonymous Coward · · Score: 1, Interesting

      Then you are obviously using mod_perl wrong.

      You're talking about an environment where the application is compiled once and re-used for each request. If you have improperly scoped global variables then of course data from previous requests will affect future ones.

      The truth is the vast majority of people who think they know how to write perl don't have what it takes to write in mod_perl. Its a completely different level -- beyond what the casual user is capable of.

      Writing apache handlers *is* more difficult than writing a CGI application in perl or other languages at first. You can't just slap together a script, send the Content-type and print stuff to the browser. You actually have to know something about apache, the http protocol, and perl programming to write apache handlers to run under mod_perl.

      Those who stick with it and write handlers in C or mod_perl have an enormous advantage to those who continue to write applications using the Common Gateway Interface, or similar technologies that don't expose the full apache request phase.

    8. Re:Why wheels often reinvented by crucini · · Score: 1
      Actually, mod_perl might be the answer. I work with it, and the issues you bring up are valid but can be addressed.
      (I don't know how to describe it exactly, but sometimes data that is changed between hits doesn't actually reflect as changed. It's inconsistent, at best.)

      A tricky topic. It's hard to tell what data you mean - some kinds of data should be persistent and some shouldn't. A global variable could persist across HTTP requests, and yet be different in each Apache child. That's why you wouldn't use them in mod_perl, except for very specific tasks.

      You should store user/session data in some coherent way, such as Apache::Session, that ties it to a cookie. You should store global data, such as a product catalog, in a database. Aside from that, I'd recommend making the httpd processes stateless.

      If you want the Apache children to share a data structure, you can use various modules built atop SysV shared memory. We use IPC::MM for this. We take on the burden of serializing/deserializing data, because all the modules that do that for you end up slow or buggy. In our case, it's just split/join.

      I learned mod_perl via the Eagle book (Stein/MacEachern). It explains these traps. Mod_perl does eat RAM, but this is only a problem if you don't protect your server with a proxy. The proxy stops a slow client from hogging an Apache child. As for CPU, remember that forking new processes in CGI eats CPU as well. On our mod_perl servers, CPU usage stays pretty low. Most of the time the Apache children are either waiting for hits or waiting for the backend database.
    9. Re:Why wheels often reinvented by Anonymous Coward · · Score: 0

      Heh, tons and tons of people do. Check out some porn sites some day.

  16. Maintaining Existing Software by TheFlyingGoat · · Score: 4, Insightful

    It's far easier for me to spend time recreating code that exists already than to hunt down what's out there, read the documentation, figure out what drugs the developer was on, and customizing it. I make use of perl modules and bits of code on Usenet, just to save time, but that's the extent of it.

    --
    You have enemies? Good. That means you've stood up for something, sometime in your life. --Winston Churchill
    1. Re:Maintaining Existing Software by TrekkieGod · · Score: 1
      It's far easier for me to spend time recreating code that exists already than to hunt down what's out there, read the documentation, figure out what drugs the developer was on...

      Yeah...it's always a pain when you guess the drugs wrong too. If you don't take the exact same drugs, you still can't understand the dude's code.

      I was *really* unproductive in my job when I spent a long time taking the wrong drugs...darn, that was a crazy week.

      --

      Warning: Opinions known to be heavily biased.

    2. Re:Maintaining Existing Software by cquark · · Score: 1

      CPAN, the Comprehensive Perl Archive Network, is one of the best examples of a reusable code base out there. It is the one reason that I generally write a perl solution to a problem first.

    3. Re:Maintaining Existing Software by kenstcyr · · Score: 1

      Yes, but if you do figure out what drugs the developer was on, it can be quite a mind-enhancing experience.

      --
      "That machine has got to be destroyed...."
  17. Laziness wins out for me... by Gaxx · · Score: 5, Funny

    I always hit the net before emarking on coding. There's no way I'm gonna spend 6 hours throwing together code that someone else has spent 20 lovingly moulding for me :-) I just too damn lazy... What can I say, Wally is my hero :-)

    --
    -- Gaxx
    1. Re:Laziness wins out for me... by mog · · Score: 1

      thank god for cpan!

  18. Dirty Code by bplipschitz · · Score: 5, Funny

    Done Dirt Cheap.

    1. Re:Dirty Code by Space_Nerd · · Score: 1

      You're from India right?

      PS:Im from Argentina, doing freelance for the US, Europe, etc, so i can understand what the indians go through. Flame away.

      --
      Everybody has a purpose in life, maybe mine is to lurk in slashdot.
    2. Re:Dirty Code by bplipschitz · · Score: 1

      "You're from India right?

      PS:Im from Argentina, doing freelance for the US, Europe, etc, so I can understand what the indians go through. Flame away."

      Indiana? Heavens no! Kenosha!

  19. Because developers don't play well with others... by jordandeamattson · · Score: 5, Interesting


    It doesn't matter if the code is available from somewhere "out there", from inside your company, or even from inside your group. The reality is that developers in general don't play well with others. Why? For a number of reasons.



    First, it is no fun to use someone elses code. This is why at one time Apple computer (many years ago) had 13 different (yes, I counted them) memory managers being written. It was fun to write a memory manager, to solve the problems involved, etc.



    Second, people don't trust one another. How do I know that you have implemented this code correctly? How do I know that you will deliver the modifications that I need? That you will deliver them on time? I can't, so it is better to do it myself.



    Bottom line, we don't play well with one another, because we want all the fun for ourselves and because we don't trust the other folks (called flipping the bozo bit in some corners).

  20. ease by Anonymous Coward · · Score: 0

    Some of it is vanity like the above posts claim, but some of it is common sense. If you can build it faster than it will take for you to look it up, verify it is available and being supported, and determine license restrictions and costs before you even get it approved...well sometimes it's just easier to carve your own wheel. You'll find more reuse inside a company than between a company and the community at large. IP is still a real thing and holding it is important to corporate america regardless of the views of RMS.

  21. Are you projecting? by Ars-Fartsica · · Score: 4, Interesting
    My organization makes extensive use of CPAN, PEAR, etc to great benefit.

    Most developers probably don't even know how to search CPAN or install a module from it (or PEAR for PHP). So they roll their own inferior solution. Those who have spent the three minutes reading the docs are getting an incredible benefit.

    1. Re:Are you projecting? by aquarian · · Score: 1

      Most developers probably don't even know how to search CPAN or install a module from it (or PEAR for PHP). So they roll their own inferior solution. Those who have spent the three minutes reading the docs are getting an incredible benefit.

      I think this is true. Add Java to that list -- which is ironic because Java was supposed to make code reuse so much easier. Better, more descriptive, more searchable docs would help. Not that I'm any better. I wish I knew better how to find what I need.

    2. Re:Are you projecting? by Monkey-Man2000 · · Score: 3, Informative

      Apache Jakarta has some really great libraries for Java. I use them extensively. That allows me to worry about high-level issues as opposed to being bogged down with the details of XML-parsing and validation, translation, etc. Additionally, Jakarta Commons has a number of useful tools that I would find myself re-implementing if they weren't already available, like the HttpClient. I've been really impressed with the stuff they've produced. However, it certainly adds to the bloat. Also from what I've used of it, Struts is awesome.

      --
      This post was generated by a Cadre of Uber Monkeys for Monkey-Man2000 (603495).
  22. Reinventing the Wheel by turgid · · Score: 1

    Much of the time I like to reinvent the wheel. There are several reasons. First, it's a learning exercise, second Iown the code I write and third I do it my way. This may seem petty, but if there are bugs, I'm the only one to blame, and I learn by doing. If I was doing something in the course of my paid work, then I would use the conventional resources.

  23. This is ridiculous rationalization by Ars-Fartsica · · Score: 1

    By your argument, why even use standard APIs? I mean, isn't CPAN just a bunch of domain-specific APIs put on the web?

    1. Re:This is ridiculous rationalization by pVoid · · Score: 0
      APIs aren't code. They are entry points into an existing system. The system API is generally speaking orders of magnitude less complexe than the programs running on it. (take for example File IO... it's just bytes... no sorting hashing or btree algorithms in there)

      Very different thing.

    2. Re:This is ridiculous rationalization by Ars-Fartsica · · Score: 1
      APIs aren't code.

      No wonder you haven't found CPAN useful. Are you actually trying to modify the source for the downloaded modules???

      API == code == API

    3. Re:This is ridiculous rationalization by be-fan · · Score: 1

      The system API is generally speaking orders of magnitude less complexe than the programs running on it.
      >>>>>>>>>>>>
      Spoken like a man whose never tried to write his own OS :)

      no sorting hashing or btree algorithms in there)
      >>>>>>>>>
      Disk blocks get sorted by the block device driver, the page cached is hashed, and the filesystem often uses a B+Tree to maintain directory listings.

      --
      A deep unwavering belief is a sure sign you're missing something...
    4. Re:This is ridiculous rationalization by pVoid · · Score: 1
      Just to clear it up, in case my previous post wasn't clear: the API itself is orders of magnitude simpler than any program you wish to make using it.

      I never said anything about the implementation of the API. A whole different ballgame.

      An API has to be by design as simple and straightforward as possible.

      And for those of you who don't know what an API is, read the acronym out loud (Application Programming *Interface* ). I said it in another post, I'll say it again: Interfaces are not implementations. Interfaces are not code.

    5. Re:This is ridiculous rationalization by be-fan · · Score: 1

      Doesn't make much sense in the context of your original arguement. What's the difference between system provided APIs and something provided on CPAN? In my experience, the latter are an order of magnitude more comprehensible than a bad but widely used API like Win32.

      --
      A deep unwavering belief is a sure sign you're missing something...
    6. Re:This is ridiculous rationalization by pVoid · · Score: 1
      The sense is this: there is source code, and there is binary code. Binary Code reuse is nothing special. It's inevitable.

      Source code reuse, that's a whole different ball game, because the source code needs to be flexible enough to do whatever is asked from it. The original poster said it was difficult to reuse source code because it was either too generic, or too specific.

      Binary code, interfaces and the such, *have* to be reused (nobody in their sane mind would think it normal to write an OS each and every time you wrote a program). In fact, one of the goals of reuse of binary code is that it is rigid/enforcing (e.g. security). Binary code reuse to me, is not code reuse, it's just environment/platform.

      Source code reuse, back to the original thread of thought, *is* difficult. Very few libraries have pulled it off, STL is one of them, and that thanks to templates. (Again, let me point out that just calling a function in a Perl module called "makeHash" is not real source code reuse. Deriving your CMyCompanyMeetingRoom object from an stl::vector, sorting it using templated sort functions, and injecting it anywhere another vector would work is source code reuse - being able to take the source file of CMyCompanyMeetingRoom and putting it in a completely different 500k line piece of software and having it work *without modifications* is source code reuse).

      On a side note, you should just stop making rim shots at Win32. It just makes you sound ignorant and provokes people (me included) to respond inappropriately (by either flaming, or cheerleading for the OSS/Linux crowd). Win32 has it's merits, and it's issues... So does linux system APIs. You don't see me appending "oh, btw linux apis suck" at the end of each of my posts. Don't think just because nobody responds bad to your Microsoft bashing that it makes you right - you are after all on a pro-linux site.

  24. Re:Because developers don't play well with others. by malfunct · · Score: 1

    Yeah, thats a big thing on our team, how much do we test the modules we rely on vs how much do we trust the group that wrote them in the first place.

    --

    "You can now flame me, I am full of love,"

  25. Playing with metaphors by peterpi · · Score: 4, Funny
    When was the last time one car had exactly the same wheels as another? (Stop; I don't actually care for the answser).

    We reinvent the wheel because new wheels look sexy, not because they roll any better.

    I have absolutely no idea whether there's a point to be proved with that, but it's kinda interesting.

    1. Re:Playing with metaphors by geekoid · · Score: 1

      not true.
      The wheel was improved when it was covered in steel(wagons), then again when it was covered with rubber(car),then aagin when it was cover in steel belts radials. All those cases made it roll better and last longer.
      the wheel was also inproved when someone added nothes and created a gear.

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
    2. Re:Playing with metaphors by Cthefuture · · Score: 1

      Perfect... I love this answer.

      --
      The ratio of people to cake is too big
    3. Re:Playing with metaphors by Anonymous Coward · · Score: 0

      Yes, the problem with metaphors is that some characteristics of the objects being compared don't map well to each other.

  26. Re:Laziness (or lack thereof) by bert33 · · Score: 1

    I almost always do a quick search to see if I can find some code snippets that solve a problem I encounter. Spending 10 or 15 minutes to find a solid piece of functional code is a lot lazier IMO than writing everything from scratch.

    --
    These people look deep into my soul and assign me a number based on the order I joined.
  27. There is a very practical reason by cpparm · · Score: 5, Insightful

    If your problem is trivial, it's faster to write your own code. If your problem is not that trivial, it takes a lot of time to try to understand someone else's non-trivial solution. More than it would take to write your own code.

    1. Re:There is a very practical reason by porkchop_d_clown · · Score: 2, Insightful

      Because you're just as smart as that other guy, right? And your code will always be better than his is.

    2. Re:There is a very practical reason by Rary · · Score: 1
      Plus, if you wrote the solution, then when something goes wrong, you actually understand the solution, and can therefore attempt to sort it out. On the other hand, if you didn't write it, then you'll have to figure out somebody else's solution in order to find what went wrong.

      Sometimes, that's simple. I think a lot of developers just don't even want to have to try to understand somebody else's solution.

      Oh ya, and then there's that ego thing.

      --

      "You cannot simultaneously prevent and prepare for war." -- Albert Einstein

    3. Re:There is a very practical reason by Thud457 · · Score: 2, Interesting
      "Plus, if you wrote the solution, then when something goes wrong, you actually understand the solution, and can therefore attempt to sort it out. On the other hand, if you didn't write it, then you'll have to figure out somebody else's solution in order to find what went wrong."

      That doesn't do your company any good when you leave them. Then, they're worse off -- a custom solution, and no documentation! If you use standardized parts, (hopefully) they're well documented so that the second generation coder can figure out what's going on. Heck, he might already be familiar with them!

      --

      the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff

    4. Re:There is a very practical reason by FrzrBrn · · Score: 1

      I agree. It's almost always easier to understand code you've written than code someone else has written, which means it's a lot faster to track down bugs in your own code. Even with good documentation and plenty of comments (and how often do you really see both of those in one project?) understanding someone else's code is time consuming and you are more prone to missing something, which could create even more bugs.

      --
      I read it on the Internet, it must be true!
    5. Re:There is a very practical reason by pla · · Score: 1

      That doesn't do your company any good when you leave them.

      Sorry, explain the part where that matters to me?

      Sure, theoretically if everyone didn't leave an unmanageable mess when they left, we wouldn't always have to deal with a similar unmanageable mess when taking over a new project. However, that reasoning very rarely works... If everyone agreed not to fight, we'd have no wars; If everyone agreed to share all resources equally, we'd have no hunger or poverty; If everyone would stop driving poorly, we'd have far fewer highway accidents. However, we still have wars, hunger, poverty, and automobile accidents, because it only takes a few uncooperative folks to bring down any system predicated on cooperation.

      Sorry to get a bit "deep" on a seemingly shallow issue, but you need to consider "real" human behavior in adopting any new system that involves humans. Thus, while political systems have for the most part failed over time, religions have thrived. Not because religions do anything "better" (or anything at all, for that matter), but because they manipulate humans using real behavior rather than idealized situations.

    6. Re:There is a very practical reason by HeyLaughingBoy · · Score: 1

      The common thread I'm seeing here is that we probably need more "black boxing" of small bits of reusable code. That really means 1) being able to trust the originator at least as much as you trust your compiler writer and
      2) Well defined and documented interfaces.

      What's wrong with this picture? Well, you're not likely to find these two things together unless the coder was doing it for financial gain. There's tons of good code out there, but it's poorly documented. Likewise, there's code that's easy to use, but riddled with bugs. Commercial code is no guarantee of quality, but such code was probably designed from the beginning to be reusable (if it's being sold as a component), so it's much more likely to plug into your app easily than Joe Coder's complex matrix math package that he designed for his own use, no matter how good it might otherwise be.

      On any given day, there's probably code that I would happily pay a small sum for to not have to develop myself as long as I could be fairly sure it worked.
      Example: I had a bunch of data from a sensor I wanted to display in my app. I'd have happily paid $40 or so to get a simple 2D/3D charting object I could plug into C++ and keep going. Even if there was a small license fee attached, because the purchase cost is much less than the cost of my time coding and debugging this thing unless we're going to sell tens of thousands of copies of my application -- which we're not. Instead I had to spend half the day learning enough Microsoft Foundation Classes (MFC) to build the graph myself along with miscellaneous features. My expertise is not MFC and I don't want it to be! I have other much more interesting things to code than charting routines. I could probably find something for sale that cost $299 and had tons of bells and whistles, or I could have embedded an Excel charting object, but I just need a very simple task done.

      I'm sure many of the posters here would agree that pride has little to do with it. There are parts of our jobs where our individual skills are required, and some aspects so far removed, that learning that particular skillset is simply too expensive for the current project. This is when you need to be able to buy software components.

    7. Re:There is a very practical reason by HeyLaughingBoy · · Score: 1
      That doesn't do your company any good when you leave them.

      Sorry, explain the part where that matters to me?

      It's called taking pride in your work. I'm paid to develop software.That doesn't just mean it compiles and runs, but that it's readable and (hopefully) extensible by the people to come later.
      I try to code well enough that I could be hit by a truck tomorrow and the next guy could easily pick it up. Has the side effect of me being able to read code I wrote 2 years ago, which is great as I'm on a very long term project.
    8. Re:There is a very practical reason by pla · · Score: 1

      It's called taking pride in your work.

      Which I most certainly do. We apparently just take pride in different things...


      I try to code well enough that I could be hit by a truck tomorrow and the next guy could easily pick it up.

      See, While certainly an admirable goal, I code for speed and lack of bugs. Readability of something the end user will never see (no GPL used in most corporate coding environment) comes after functionality. Not to say I don't make my code as readible as possible, but if I need to use a hideous mishmash of inline assembly, compiler macros (who ever came up with the idea of C++ templates when we had macros all along?) broken loops, and even the dreaded "goto" (very rarely will I stoop that low) to get an extra 1% performance boost, start praying the code doesn't fall on your shoulders when I move on to my next project.


      Has the side effect of me being able to read code I wrote 2 years ago, which is great as I'm on a very long term project.

      A project over 2 years? Wow.

      Anyway, in my experience, two years later the project has either died or management has deemed it "done" (With the exception of the long term legacy maintenance "punishment" projects they give newbies, wherein it doesn't matter how well you code, because as the expression goes, "adding a teaspoon of wine to a barrel of raw sewage still leaves you with just a barrel of raw sewage").

      And for the idea of code reuse in other projects a few years later... Either someone will have found a better way to solve the same problem, your carefully thought out APIs no longer meet the "new" corporate standard, or the spiffy programming-language of the week that you just have to implement the new killer app in has changed, making your entire well-written, debugged, and optimized personal library useless.


      So yes, I most certainly do take pride in my work. I care about results, I care about efficiency. I do not care about my employer who, if I have stopped working for them, most likely decided to "restructure their core employment processes" or some such crap. Pride? I take pride in knowing that, after they stop paying me, they stop benefitting from my work. Companies like the idea of IP... Well, let them have to start paying "creative" employees in perpetuity for their ideas, and we'll see just how long they keep riding the IP gravy-train.

    9. Re:There is a very practical reason by Anonymous Coward · · Score: 0

      If your problem is not that trivial, it takes a lot of time to try to understand someone else's non-trivial solution.

      Not to mention debug someone else's non-trivial solution.

  28. Cause the way software development is taught by jj_johny · · Score: 3, Funny
    1. Lots of students don't even listen in class about the reuse stuff.

    2. They are taught the complete spectrum of software development from function to complete program. So they think that they can do it all reallllly well.

    3. They don't get in the habit when they start.

    4. They get paid by the hour not the thought. (sorry thats an old lawyer joke.)

    1. Re:Cause the way software development is taught by pla · · Score: 1

      They get paid by the hour not the thought.

      Whoah, you get paid by the hour???

      By which you don't actually mean "one unit of pay for each of those up-to-24-hour increments I come in to work"?

      Cool. Can I have your job?

    2. Re:Cause the way software development is taught by Wiwi+Jumbo · · Score: 1

      Though I don't code, I suspect that:

      5. It would be considered cheating on an assignment and they would fail.

      Just a thought....

      --
      Wiwi
      "I trust in my abilities,
      but I want more then they offer"
    3. Re:Cause the way software development is taught by Anonymous Coward · · Score: 0

      Depends on the assignment. You wouldn't allow this at the very early levels.

  29. o Coder is too stupid to know how by Ars-Fartsica · · Score: 1

    Quit blaming the excellent code out on CPAN. Blame the idiots who can't properly decompose their programs or even properly install what they find.

    1. Re:o Coder is too stupid to know how by Anonymous Coward · · Score: 0

      Speak for yourself, dumbass.

  30. Library bloat by Stiletto · · Score: 4, Interesting


    I write a program, and part of it needs to simply read a .PNG file from disk and draw it on the screen. That's all. This should require a short and simple executable.

    Do I _REALLY_ want to pull in libpng and libSDL just to do this? What kind of risks does pulling these libraries in add to my project? How much will this bloat my code? Will users be confused from the different versions of these libraries? What if I one day want to port to a platform that these libraries work on?

    Turns out it's usually simpler, easier, and less risky to just roll your own.

    1. Re:Library bloat by JeanBaptiste · · Score: 1

      while i dont care for your sig... you are completely correct in the reasons i dont want to use someone elses libraries...
      > How much will this bloat my code? yep
      >What if I one day want to port to a platform that these libraries work on?

      I want my program doing exactly what I want, no more, no less...

    2. Re:Library bloat by kma · · Score: 4, Insightful

      Do I _REALLY_ want to pull in libpng and libSDL just to do this?

      Yes.

      What kind of risks does pulling these libraries in add to my project?

      The risk that you will hit a bug in the library. Which is much smaller than the risk that there will be a bug in your one-off k-spiff png display engine (hence, OOKSPDE).

      How much will this bloat my code?

      It will bloat your code by the additive inverse of the code size of your OOKSPDE. The user already has the library on their disk. If it is dynamically linked to your executable, they pay nothing to use it.

      Will users be confused from the different versions of these libraries?

      Would you rather they lose data because your broken OOKSPDE doesn't handle transparency properly?

      Turns out it's usually simpler, easier, and less risky to just roll your own.

      It sounds like you either have a delusionally high estimation of your own abilities relative to those of your library-writing peers ("Of course the code I write will be faster, more correct, and less bloaty than the specialised code that those people who really understand the problem and spend time solving it well!") or you place very little value on your time. Oh well. Have fun writing png-frobbing code for the rest of your life.

    3. Re:Library bloat by ptr2void · · Score: 1

      Yeah. PNG reading is sooooo straight-forward that you can implement it in about 2 hours. Dream on, little boy.

    4. Re:Library bloat by jericho4.0 · · Score: 1

      Yes, but it's probably not the best idea to start from the png spec and write your own load function, as you could easily find a tried and true snippet that did this. Displaying an image on screen is a vastly more complicated endeavour, considering portability. You would almost certainly wind up using some kind of API if this was a real app.

      --
      "A language that doesn't affect the way you think about programming, is not worth knowing" - Alan Perlis
    5. Re:Library bloat by Xerithane · · Score: 1

      >>Do I _REALLY_ want to pull in libpng and libSDL just to do this?

      >Yes.


      Uhm, to display a PNG to the screen. I can understand pulling libpng, but not libSDL.

      It sounds like you either have a delusionally high estimation of your own abilities relative to those of your library-writing peers ("Of course the code I write will be faster, more correct, and less bloaty than the specialised code that those people who really understand the problem and spend time solving it well!") or you place very little value on your time. Oh well. Have fun writing png-frobbing code for the rest of your life.

      Most open source code is shit. It's not because there aren't great programmers, it's because there are a shitload of bad programmers. That whole 80/20 thing. Unless you are familiar with a library, I don't blame anybody for not using it for small projects.

      If I was writing a png viewer, I'd do it with libpng and X. X isn't that hard, it's a pain in the ass to work with for large programs, but it's not that hard.

      --
      Dacels Jewelers can't be trusted.
    6. Re:Library bloat by Balinares · · Score: 4, Informative

      #!/usr/bin/env python
      import sys
      from qt import *
      a=QApplication(sys.argv)
      img=QLabel(None)
      img .setPixmap(QPixmap("my_image.png"))
      a.setMainWidg et(img)
      img.show()
      a.exec_loop()

      9 lines.
      You're welcome.
      It would probably have been even shorter in Perl.

      'Bloat' is not knowing the right tools for the task.

      --

      -- B.
      This sig does in fact not have the property it claims not to have.
    7. Re:Library bloat by Anonymous Coward · · Score: 0

      Tonight, I killed a bird, tomorroy I will kill two, guess what? In a year I will have killed about 360 birds

      *BZZZZ!* What is the West Nile Virus?

    8. Re:Library bloat by dvdeug · · Score: 2, Informative

      Do I _REALLY_ want to pull in libpng and libSDL just to do this?

      You're going to write your own code to read PNG files?!? Just how much time do you have to write code and fix bugs?

      How much will this bloat my code?

      You think that rewriting the code will take less space then interfacing to an existing library?

      Will users be confused from the different versions of these libraries?

      Much less then the users will be confused when they run into a file that you can't read and all their other programs can. All code has bugs, but libpng has a lot of testing and is actively being improved, unlike your code. And standards change, and the libpng people have more time to chase any changes to the standard then you do.

      What if I one day want to port to a platform that these libraries [don't] work on?

      libpng should work on any platform with an ANSI C compiler, and has been tested on far more systems then you can. Your code to display it on the screen is going to be system dependent; at least third party code has a chance of working on multiple systems out of the box. And if you have to port it to a system that it doesn't support, it's just as easy to port it to that system or add your code to support that system as an alternative to the graphic library, as it is to write it from scratch. And you saved yourself the trouble of writing the code for Linux and Windows and anything else that worked out of the box, as well as working on systems you would never have got to.

      Turns out it's usually simpler, easier, and less risky to just roll your own.

      It's going to be more buggy (and have different bugs from the standard), and require you to write a lot of code, especially every time you port to a new system. I see minimal advantages to a user, especially with a library as ubiquitous as libpng.

    9. Re:Library bloat by Suidae · · Score: 1

      Unless you are familiar with a library, I don't blame anybody for not using it for small projects.

      The problem with that is that small projects are good places to learn how to apply those libraries, so that on the big projects you'll realize how much time and effort you can save because you already know where to get the functionality you need. If you don't know the libraries, they will probably seem too big and risky to include in your big important project.

    10. Re:Library bloat by BetaJim · · Score: 1
      Uhm, to display a PNG to the screen. I can understand pulling libpng, but not libSDL.

      Well, libSDL is what throws the decoded PNG onto the screen. You do need both; one decodes, the other displays the decoded result.

      --

      "Drug related crime" is a misnomer, "prohibition related crime" is the more accurate and correct phrase.

    11. Re:Library bloat by jamesp73 · · Score: 1

      Turns out it's usually simpler, easier, and less risky to just roll your own.

      I found the opposite to be true. I am coming off a project where some developers wrote their own MVC framework in Java. In the end they have something that does half of what Struts does for hundreds of man-hours of coding. Go figure.

      I think a lot of this comes from the "science" in computer science. The need to go out and discover something. To arrive at some "elegant" solution unlike anything the world has ever seen!

      --
      James Prickett
    12. Re:Library bloat by Amit+J.+Patel · · Score: 1

      I had a similar problem, but in the other direction: I wanted to generate a chart without drawing it on the screen. That's all. This should require a short and simple executable.

      Do I _REALLY_ want to install X on my web server so that I can use some charting library that was designed for interactive use, try to script it, then have it take a screenshot, save the file to disk, then serve the file to the web user? What kinds of risks does pulling these libraries and apps add to my project? How much will this bloat my server?

      Turns out it was simpler, easier, and less risky to just roll my own.

      - Amit

      ** Parts of the previous post were reused. **

    13. Re:Library bloat by Anonymous Coward · · Score: 0

      No, I just have a realistic estimate of the
      morons writing this free code and their
      abilities chump.

    14. Re:Library bloat by Anonymous Coward · · Score: 0

      Who writes in python or perl?
      Masochistic ,meat-flogging, braindead
      anal bandits, that's who.

    15. Re:Library bloat by LazyBoy · · Score: 1
      How much will this bloat my code?

      It will bloat your code by the additive inverse of the code size of your OOKSPDE. The user already has the library on their disk. If it is dynamically linked to your executable, they pay nothing to use it.

      How do you know what's on his disk? Or even if his target has a disk? Not every target is an x86 running Linux.

      Library developers: Please don't design your libraries for one app on x86 Linux. Consider OS and hardware portability and the fact that you can't know the scaling needs of future apps.

      A good library implementation doesn't assume the O.S. or the execution model.

      --

      If Chaos Theory has taught us anything, it's that we must kill all the butterflies.

    16. Re:Library bloat by maxgilead · · Score: 1

      Heh, solution in Java is single line longer:

      import javax.swing.JFrame;
      import xmage.raster.awt.ImagePanel;
      import xmage.raster.codec.PNGInputCodec;
      public class DispPNG {
      public static void main(String[] args) throws Exception {
      JFrame frame = new JFrame();
      frame.getContentPane().add(new ImagePanel(new PNGInputCodec().read("myimage.png")));
      frame.pack ();
      frame.setVisible(true);
      } }

      10 lines.
      And I agree it would probably be a single-liner in perl ;-)

      About 'bloat'... it's also not knowing how to make your modular.

    17. Re:Library bloat by johannesg · · Score: 1
      I think you need libpng and libz (instead of libsdl). One risk is that libpng _will_ abort if you feed it a malformed png. Doing the 8-byte header check seems to decrease the risk of this actually happening, but I'm not sure if it eliminates the possibility. The code is simply too cluttered for me to analyse, thanks to an absolute overload on #defines.

      As for documentation: like so much UNIX documentation it goes into great detail about weird, abnormal cases, but completely ignores the common case where you have a PNG and want a bitmap representation of it without any fuss.

      For what its worth, in my case I ended up reusing the library - I considered writing my own both too risky and too much work.

    18. Re:Library bloat by johannesg · · Score: 1
      Out of curiosity, have you ever seen the libpng code and API? They do not really inspire confidence - sure, the person who can juggle all those #defines must be really smart, but I'd rather he write code that people can actually understand.

      It sounds like you either have a delusionally high estimation of your own abilities relative to those of your library-writing peers

      I know what my own skills are worth, but I know nothing about the person who wrote the library. He may be an absolute code guru, or he may be a student who wrote this for a class-project about platform-independency. Unless I spend a significant amount of time analysing the code I won't know - and I do that I might as well write it myself...

    19. Re:Library bloat by Xerithane · · Score: 1

      Well, libSDL is what throws the decoded PNG onto the screen. You do need both; one decodes, the other displays the decoded result.


      Or you could just learn XLib and not deal with an entire external library... I think I addressed this in my post previously.

      --
      Dacels Jewelers can't be trusted.
    20. Re:Library bloat by dvdeug · · Score: 1

      Out of curiosity, have you ever seen the libpng code and API? They do not really inspire confidence

      I may be mistaken, but I believe that libpng is the only chunk of PNG-decoding code on my system. That should inspire enough confidence in and of itself.

      Unless I spend a significant amount of time analysing the code I won't know - and I do that I might as well write it myself...

      For one thing, you can look at who else uses it and how. The fact that netpbm, Gnome and Mozilla all use libpng for frequent operations says that it works well. Secondly, it's not hard to look at the webpage and tell if it's being maintained and if the person has a good programming "resume" or not. Thirdly, does it honestly take you so long to read through another library that you could write and debug your own version faster?

  31. Think of it this way by Iron+Monkey543 · · Score: 3, Informative

    Let me make an analogy between using someone else's code vs. writing your own and buying a (not custom) PC vs. building one yourself (a few years ago).

    First, the PC came with this video card I didn't like, so I went out and bought a different one. The OS that came with this OS don't use, so I have to reformat the hard drive. The case was also ALL plastic and it was hard for me to drill some clean holes into it for my modding. I had to go out and buy a different case. In fact, i spent my time reassembling the whole darn thing just to make it fit my needs. I should have just built it from scratch and save alot of time!

    That's why I don't like to use someone else's code. Now, I would LOOK at their code and see how it works, and then write my own to work the same way. If I am lucky, their code is already the exact way I want it, but it's very rare.

    Very modular codes however, are useful at times. THe only problem is that it comes with other crap u dont need and takes up coding space, but that's just nitpicking when you dont have any time.

    1. Re:Think of it this way by Iron+Monkey543 · · Score: 1

      Only as a newbie or when I am stuck. But those were the old days =)

    2. Re:Think of it this way by HeghmoH · · Score: 0

      Bad analogy.

      Using somebody else's library isn't like buying a computer from a computer company. It's more like buying a video card that's already made for you, rather than going out and making it yourself. How many people make their own video cards?

      --
      Mod down posts with a "Free Mac Mini/iPod" sig, they're spam!
  32. Re:legal issues by Anonymous Coward · · Score: 5, Insightful

    I develop in Delphi and I use a lot of stuff from the net (if you want to learn how to create reusable components, and use already made components, this is THE development environment, and there is even a free linnux version! and it is PAscal, not this joke of a language called C or C++).

    anyway, as I work that way (for my company), I then get nailed down by the legal team because most stuff on the net doe not have a licence attached to it, or has a wrong licence, or the company wants to kee 100% copyright on stuff, but we can not contact the authors or something like that.

    ie: if you develop for a company, you do not have the choice, you have to re-invent the weel (or hide it from your superior and legal teams). what a shame....

  33. if developers shearched litterature... by lfourrier · · Score: 1

    ... they could not pretend they invented something and patent it

  34. resoureful students by Anonymous Coward · · Score: 0

    hehe, i have become quite talented at finding those necessary little nuggets of code which help finish those homeworks due monday morning.. especially at 7am on monday after an eventful college weekend.

    thank you google.

    *no plagerism though, that's wrong, so is my spelling :p*

  35. Another problem by Lendrick · · Score: 2

    Ever tried to work a library that does something very similar to what you need it to do, but not exactly? You end up writing more code to get it to work with your program than you would have written just implementing it from scratch. That code tends to be bulky, difficult to maintain, and prone to bugs. Sometimes it's better just to start with a clean slate.

  36. Opportunity Costs by Celandro · · Score: 1

    Why not use publicly available code?
    Its a matter of opportunity costs. Basically, instead of looking and using the free code, you can be developing your own code. Which is better is really a comparison of the 2 costs, where the unknowns of free code can make it unviable. "Free" code is not really free. It has liscensing restrictions sure, but thats not what the big problem is. There are time costs associated with using "free" code. There is a cost to searching for code that may be of use. There is a cost to figuring out wether the code is appropriate or not. There is a cost to learning how to use the code. There is a potential cost to discovering after much work that the code was not appropriate or has bugs or has a liscensing problem you were unaware of. These costs are very hard to estimate up front. Doing the code yourself on the other hand is easy to estimate and in most cases is much lower than the potential costs of using even "free" code.

    The project im working on at work is customizing a non-free web reporting package. If we run into a bug we can not fix, or an issue we cant work around, there is a chance of wasting years worth of development hours. Its a huge risk and one that there was much debate about. It remains to be seen if using the web reporting package was a good idea or not. The cost of the package is not the deciding factor in these decisions. Its the potential time costs and time to market costs that dominate the decision.

    PS. I am not an economist. please forgive my 2 econ college course knowledge

    1. Re:Opportunity Costs by Anonymous Coward · · Score: 0

      This is interesting. Over the years, I've been told by others that I don't really understand or embrace the idea of "code reuse". Of course, that isn't really true (I haven't spent my life re-implementing the standard C library of the Java Swing GUI interfaces). However, it is true that I have often gotten an "uneasy" feeling about the method of development that goes immediately out to the internet searching for some kind of solution and a more "comfortable" feeling writing code.

      The problem is that I could not completely justify (in my own mind) my reservations. I've read many of the posts on this subject and identify with a lot of them: the desire to learn by struggling, feeling of accomplishment, control over quality, programmers like to create and express (not work on an assembly line) etc. But, your post has actually identified something I was thinking (but wasn't aware of): predictability.

      It is absolutely true that once you embark on an expedition into the vast uncharted Universe of free downloadable code you have no idea how many light years you will travel out there and/or whether or not you will actually return with anything of value. None of us can ever get a handle on all the available libraries for specific situations (we mostly reuse the general, well-known and common). So, even an estimate of 200 hours of in house code development may be more certain than 1000 hours of fruitless endeavour. I want to simply know that I will be done a few weeks, rather than have no idea (most employers want the certainty of knowing as well).

  37. Sometimes it IS easier to build a wheel... by dpbsmith · · Score: 3, Insightful

    ... then to find a wheel, see whether the documentation states how many spokes it has, give up and count the spokes, determine what the rights status of the wheel is and, if it's not open source, what the royalty agreement is, convince your boss to license the wheel, compile the wheel, fix the compile errors due to your compiler vendor not implementing the language standard properly, build an adapter to allow the metric wheel to fix on your U. S. Customary hub, test the wheel, discover that it vibrates dangerously at 16.5 mph, try to balance the wheel, and finally give up and build a wheel.

    1. Re:Sometimes it IS easier to build a wheel... by Anonymous Coward · · Score: 0
      But my question is, simply: Why does the computer industry tolerate this sort of thing?

      When it was hobbyists tinkering with Northstars and Cromemcos and Sols it might have been understandable, but we should have grown up a long time ago.

      When you put oil into your car, you know that the oil companies and the car companies have gotten together with the American Petroleum Institute to set standards so that as long as your owner's manual says "API SG" and the oil you buy says "API SG" or better, that oil will work in your car. And you can use Mobil Oil to top up an engine filled with Quaker State without losing any sleep over whether their chemistry is compatible.

      You don't rely on friends' stories of whether Quaker State is better than Shell Oil. You know that regardless of the price of the oil, if it says API SG it meets API SG specs and if your car says API SG specs are good enough, they're good enough.

      It doesn't benefit anyone if your engine seizes up, and it doesn't benefit anyone if your computer crashes.

      It's simple, it's easy, millions of consumers who aren't chemical engineers buy engine oil every day without wrecking their cars.

      Why is it expecting too much for computer vendors to do the same?

      And, while we're at it, why don't all computers use parity-checked memory? This was standard on 100% of all computers before the micro age, and for some reason people started putting in non-parity memory to save money and asserting that "it works."

      And our computers crash a lot, and nobody knows why and nobody does anything about it and everyone just accepts that that's the way computers are...

    2. Re:Sometimes it IS easier to build a wheel... by El+Neepo · · Score: 1

      Exactly. To continue the metaphor:

      I look at other wheels to see how they spin, but inventing my own wheel always makes it fit the car better.

    3. Re:Sometimes it IS easier to build a wheel... by el-spectre · · Score: 1

      Mr. Coward, you are under arrest for the abuse of a metaphor!

      --
      "Faith: Belief without evidence in what is told by one who speaks without knowledge, of things without parallel." - A.B.
    4. Re:Sometimes it IS easier to build a wheel... by Anonymous Coward · · Score: 0

      If we used parity memory, we'd couldn't bitch about Microsoft as much.

      (Also, if we knew our memory was bad, we'd have to do something about it. Namely spend money.)

    5. Re:Sometimes it IS easier to build a wheel... by crucini · · Score: 1

      My computers don't have parity memory, and they don't crash. I do remember lusting after Northstars though. I agree with your other points - I guess the bottom line is that the computer world is in its infancy.

  38. That's nice by The+Bungi · · Score: 3, Insightful
    But not all languages have the luxury of having a CPAN or PEAR available. Even then it doesn't always make sense. Most of the lower-level stuff (i.e., HTTP) can be pulled in, but higher level "solutions" are almost always not applicable to the problem you're trying to solve.

    That's why patterns are all the rage. It's much more efficient to code within a pattern than it is to hunt down, examine and adapt code written by someone else.

    And of course, as others have pointed out, the Not Invented Here syndrome is quite prevalent. It's always more fun to code your own stuff, and it's a learning experience.

    1. Re:That's nice by Suidae · · Score: 1

      That's why patterns are all the rage

      I particularly like tools that take my UML model, to which I've just added a standard pattern, and generate the code for me. Saves a lot of typing and I don't have to worry about the details of what someone elses code does.

    2. Re:That's nice by Gantoris · · Score: 1
      I particularly like tools that take my UML model, to which I've just added a standard pattern, and generate the code for me

      Do you have any links/examples of said tools?

    3. Re:That's nice by Suidae · · Score: 1

      I'm currently working with a tool that Borland just bought called BOLD. Currently it seems to be geared toward Delphi (which is what I use) but I believe they are setting it up to work with C Builder and their .Net product.

      Basicly you use a tool like Model Maker or Rational rose to model the classes you want, and then import the model and generate code from it and you get all your classes with (if you want it) built in persistance to the database of your choice (or XML).

      Its not perfect, but its pretty darn good, and there are a number of people using it successfuly on large projects (the one I'm on has around 200 classes, and links to an existing database).

      BOLD was developed by a company called BoldSoft, and it appears that borland is renaming it to Model Drive Architecture. It is included with the Architect version of Delphi 7.

  39. Simple by exspecto · · Score: 0

    Easy. Just because something is "already out there" doesn't mean you can't do it for your own purpose. This is where innovation comes from. People see what others have done, implement it themselves, and add something the original programmer hadn't thought of.

  40. You cannot do it better by Ars-Fartsica · · Score: 1
    For all of the idiotic posts claiming to be able to write superior code to what you would find in mature CPAN modules, I recommend a challenge.

    Try to rewrite LWP or DBI yourself with no peeking. If you have something even 50% as good as these modules in two months of full time coding I will be amazed.

    Its exactly the best coders who make heavy use of CPAN.

    1. Re:You cannot do it better by kin_korn_karn · · Score: 1
      The really big modules like DBI, LWP, and CGI are the product of many man-YEARS of effort. It'd be stupid to even think of reimplementing any of them, unless you need something extremely simple. The downside to them is that they have the swiss army kitchen sink approach to solving problems - if someone might need it, throw it in.

      Who uses CGI.pm's HTML tags-as-functions stuff, anyway? It's a lot faster to say
      print "<form action=foo.cgi method=POST>";
      than
      $query->start_form([hash of BS]);
    2. Re:You cannot do it better by Isofarro · · Score: 1
      Who uses CGI.pm's HTML tags-as-functions stuff, anyway? It's a lot faster to say:
      print "<form action=foo.cgi method=POST>";


      Which is an excellent example of the drawbacks of writing your own code when there's a properly written function available. There are three errors in the above (rather elementary) print statement:

      1.) attributes must be quoted in XHTML - there's two occurances of that error
      2.) the method attribute has a list of defined values. POST is not one of them. The correct one is post.

    3. Re:You cannot do it better by Anonymous Coward · · Score: 0

      None of those are errors under HTML/4.01. CGI.pm doesn't enforce the HTML content model, so if you're worried about errors you have to run your output through a validator anyway--and at that point you might as well generate HTML the most convenient way and let the validator backend worry about well-formed XML.

  41. It's the GPL by scosol · · Score: 1

    Tout it all you want, but look closely at all those perl modules and c libraries around.
    Most of them are under the GPL.

    GPL = Can't use in a commercial product.
    (err- a commercial product that you don't want someone else to steal)

    I *really* think the LGPL should be known as the "Library GPL"

    --
    I browse at +5 Flamebait- moderation for all or moderation for none.
    1. Re:It's the GPL by gnugnugnu · · Score: 1

      > I *really* think the LGPL should be known as the "Library GPL"

      It was originally
      (but maybe you already know that and want to change it back).

      The intention was that people would use LGPL for libraries and GPL for Applications but like any good piece of software people did not use it as the author intended.
      The name was innappropriate when people started using the LGPL for whole programs.

  42. Maintenance by OrangeGoo · · Score: 1

    I write my own code because, generally, I'm the one left maintaining it. If some minor requirement changes, it's much easier to open up the code and find the necessary changes in code I wrote (since, theoretically, I understand it better than anyone else) than to wade through someone else's code. In the case of libraries, I can make my one little change and be done rather than have to crack open the library, or worse find a replacement and rewrite whole blocks of code to use the new library.

    At least, that's what it's about to me. ;)

    1. Re:Maintenance by Anonymous Coward · · Score: 0

      The article was mostly about using algorithms invented by somebody else, not necessarily code.

      Inventing your own algorithms is usually a bad idea. Implementing known algorithms yourself is not necessarily.

      Having a third-party component as part of your build always makes the process slightly less manageable, but if it brings significant functionality, it may well be worth it. For example, if you want to use SSL, you probably don't want to implement all of the standards yourself, and OpenSSL might be worth the trouble.

      In my experience, the worst possible third-party components are closed-source ones. They make programs less portable and almost always cause problems because of ill-defined interfaces or bugs that are difficult to solve without the source.

      Given a choice between implementing something myself and using a closed-source library, I'll always implement it myself, unless the closed-source component implements something algorithmically non-trivial (e.g. speech recognition) unusually well, or is the only solution available (e.g. driver for undocumented hardware).

  43. Documentation by WatertonMan · · Score: 1
    Often the problem is that the libraries or code fragments have poor documentation. The amount of time you spend trying to integrate this algorythm to yours is sometimes about the same amount of time it takes to figure out what it does and recode it yourself. Further when debugging that makes it easier to track down.

    Obviously this will vary depending upon how complex the stuff is. But for a lot of simple stuff that's why. Those of you who haven't had the joy of debugging someone else's code might not realize what poorly commented code really is like. It can be a nightmare to support, let alone get integrated.

    Yeah if it is very modular and has a good API this isn't a big deal. And for people who can't look up general algorythms they are great. But for a lot of things a little research combined with a little invention is better.

    The other problem frankly is the GPL. But that really depends upon what your code is going to be used for. We resell libraries so touching the GPL is a no-no.

  44. I generally find creating faster than borrowing by EvilTwinSkippy · · Score: 1
    If and when I borrow a code, it's usually a library at a time. Anything smaller that 10 or 20 thousand lines of code will take longer to figure out how it works than it would to simply recode from scratch.

    A lot of my projects are AI and/or web based. Web based apps are too damn terse to be bothered. (Anything more sophisticated than a pretty database query ought to simply message pass to something beefier.) AI programmers think that every project require writing their own custom database engine. I generally sift out the schemas and try to re-engineer the idea to use something conventional like TCL and MySQL. (As opposed to Fred's programming language and an ANSI text flat database.)

    --
    "Learning is not compulsory... neither is survival."
    --Dr.W.Edwards Deming
    1. Re:I generally find creating faster than borrowing by meloneg · · Score: 3, Funny
      Back in my day I had to write games in BASIC, on a 4.7Mhz computer with no hard disk and 128K of RAM. And I was grateful

      This is the first time I have ever seen a tagline of this form that I could agree with and feel was a reasonable statement. Aren't these supposed to be ridiculously overstated?

    2. Re:I generally find creating faster than borrowing by EvilTwinSkippy · · Score: 1
      Since you expect the overstated, this tagline is rediculously understated. Since you reasonably expect it to be unreasonable, it us unreasonable by its sheer reasonability.

      Puzzles within puzzles, and plans within plans.

      --
      "Learning is not compulsory... neither is survival."
      --Dr.W.Edwards Deming
  45. Same reason I didn't reply to another post. by FroMan · · Score: 2, Informative

    Code reuse is a great idea. In theory. Where everyone wants to live, cause everything works in Theory.

    Quite often it is easy to pull in someone elses library to work with your code. Though note, libraries. Libraries are designed to have some reuse to them. But the library has to have a static API that isn't going to change, which isn't always a safe assumption.

    Another aspect is refactoring. Here at my current job I have spent the last month refactoring one of our applications. I used a lot of concepts from the original code, yet the implementation was not what we needed now. Originally the code was used for batch processing. However, the new code which does the same thing is built for a thread safe and high speed processing. The data structures it used originally had a different use.

    So, one of the reasons to write your own code is for your own specific purpose. I like to look at other code before I write something, but rarely does someone else's implementation fit the mold for what I need.

    --
    Norris/Palin 2012
    Fact: We deserve leaders who can kick your ass and field dress your carcass.
  46. hmmm... by Anonymous Coward · · Score: 1, Funny

    I would say that about 30% of the code in use in my organization is from freely available sources, and used with total disregard to any license it was available under.

  47. Re:Laziness (or lack thereof) by tomakaan · · Score: 1

    Congratulations then. It's something that should be done. I wasn't the one who said people fail to use the resources they have; it was the article.

    I was just stating what I felt was the general answer. Take your average support message board. You see the same question come up over and over again because people don't do a quick search to see if the question has been answered again. They think it is easier just to ask the question again, rather than to check other peoples, when in reality, it probably takes more work to type out the question.

  48. Time to Understand sometimes time to create by ron_ivi · · Score: 2, Informative

    The time it takes to fully understand other code is often as large as the time to create code in-house. For code created internally, there's someone who understands everything about the module being used. Because of this, if there's a bug in internally developed code, it can often be easier to find and fix than third party code.

  49. Half the fun... by aquarian · · Score: 1

    ...is Monday morning quarterbacking, then doing things your own, "better" way. The other half is having someone pay you to do this.

  50. Granularity by jfengel · · Score: 2, Interesting

    Well, I would RTFA if I could RTFA, but I'll try to give you an answer anyway.

    The problem is granularity. I interpret from the title (and nothing else, since I can't RTFA) that they want to reuse individual classes rather than entire projects.

    I _hate_ the fact that every UML diagram begins with a blank sheet of paper and that individual classes are almost never reused.

    Individual classes, however, are even harder to reuse than whole libraries. In theory you could take somebody's generic model of, say, a Person, and extend it with the extra things you need. As long as Person were well-written it might actually be reusable.

    But in practice, it won't extend the classes you need it to extend, and it'll probably be tied in to a vast array of other classes that you simply don't need, making your life very complicated. Since requirements gathering is far harder than code writing, people who have to gather their own requirements generally just end up writing the code to match, since it's a trivial effort.

    You lose a lot when that happens: you can't reuse a lot of other processing code that you want. However, how long will it take to find that code? Days, plus the time it takes to adapt? How long would it take you to write it yourself?

    The lower the granularity, the harder reuse is. I'd like to see better, but with present programming languages it's not going to happen.

  51. Solving a different problem by Lord+Grey · · Score: 2, Interesting
    Much of the time, the problem I'm trying to solve is either not exactly solved by others' libraries or those libraries do far more than what I need.

    I do, however, try to find those libraries before reinventing the wheel. Occassionally I do find one that will work, and then I'll be faced with integrating it into the project. At that point, I've always found it beneficial to go through and edit the source, for two reasons: 1) a consistent coding style throughout the project makes it easier to maintain, and 2) I tend to learn a hell of a lot by actually trying to understand what I'm editing. Then, maybe, next time I can reinvent the wheel all by myself.

    --
    // Beyond Here Lie Dragons
  52. Because it's a waste of time by Anonymous Coward · · Score: 2, Insightful

    Case in point: I spent a week searching for C++ source code for a math expression parser (put in x+5*y, get result). I found ZIPPO, except for 3rd party libraries, and ONE crappy C code from 1997 and ONE C++ code written in German that has a ton of subtile bugs.
    So unless the code is EASILY FINDABLE, WELL DOCUMENTED, and USEABLE, then it's MUCH faster to do it yourself.

    1. Re:Because it's a waste of time by Anonymous Coward · · Score: 0

      I needed exactly the same code. Found it in an old textbook, works like a charm.

    2. Re:Because it's a waste of time by swelling · · Score: 1

      Reuse is kind of like going to the library ... maybe you will find what you want by going to some shelf that you *think* should have a "the definitive guide to my problem", but you are more likely to find that such a book doesn't exist and you have to be more creative.

      A math parser?

      Come on. This is one of the most elementary examples in writing a grammar. Maybe you won't find ready to #include source on the internet, but you can get some reuse from recapituating the proven examples.

      Reuse != not using your brain

    3. Re:Because it's a waste of time by Anonymous Coward · · Score: 0

      I seem to recall that there is a worked out expression parser example in the bison manual. GNU bison is a yacc-compatible parsing tool, and like gcc, the code it produces is not GPL-encumbered.

    4. Re:Because it's a waste of time by Anonymous Coward · · Score: 0

      For most things where you might consider a math expression parser, a lot of programmers will use an embedded extension language, since math expressions are a subset of programming language syntax and the embedded language usually a lot of other functionality that you'll find useful.

  53. "components", not "objects" by Tablizer · · Score: 2, Insightful

    The intro implies that only OOP can make reusable components. I don't want to start yet another paradigm war, just point out that there are non-OOP component solutions to a lot of things. I used to use extensive math and graphics FORTRAN libraries as an intern long long ago. They were surprisingly useful and easy-to-use in most cases. I am not promoting FORTRAN here in any way, for there are a lot of nasty things about it; but it still allowed extensive component usage before OOP was the thing.

  54. Why developers don't reuse by LinuxParanoid · · Score: 4, Insightful

    I'm not sure I that the 3 reasons Mark Fisher gives for lack of code-reuse are the main issue. Usually I think programmers are just too lazy to search. I had one predecessor that I always suspected had this disease. I've noticed in myself at times too. Usually you think that if you (re)write it, it'll be easier than trying to understand someone else's code (often but not always, you are wrong. :).

    That said, let me pass on a little practical story. Having built solutions myself that were quick and dirty, for version 2.0 of a recent project I worked on, I decided to dump most of my code and try building on an existing, well-known open source project in my area. I've spent 4-6 weeks trying to take a well-known piece of open source code that performs a similar function better than my quick&dirty approach. I'm not finished, but with the deadline past and with significant obstacles remaining, I'm really questioning my well-intentioned attempt at re-use.

    So let me toss out some more reasons why developers may not "search the literature":

    1) the (time)-cost of doing the search,
    2) the cost of figuring out the implementation details of what you do find so that you can effectively use it (which can be anything from understanding perl module documentation to understanding the concepts behind lex/yac or some protocol),
    3) the time/development-cost of integrating the open source codebase into your codebase; this includes porting or handling dependency chains
    4) the risk that, because of some detail that you won't understand until you fully invest in #2 (above), it may end up that this tool you are reusing actually doesn't solve your problems for some unexpected underlying implementation reason (something you can avoid if you fully develop your own solution with methods you *know* will work)
    5) the risk of choosing the wrong alternative (e.g. picking one templating system out of the dozen alternatives that then gets orphaned)

    I'd like to reuse code more, but rationally there are a bunch of reasons why I don't do more. These need to be addressed more satisfactorily for more code sharing to flourish.

    --LP

    1. Re:Why developers don't reuse by Drakonian · · Score: 1

      This is an interesting thread. I'm honestly not trolling here, but if no one actually resues code doesn't it make it seem like all of Object Oriented program is a sham? If no one even takes full chunks and use them then they certainly don't inherit from classes that other people wrote. (I know there is value in OO stuff in that your project can be well structured, even if there is no reuse). But reuse is a huge motivator behind OO, encapsulation, all that sort of stuff. Why don't we all just write everything in C/assembly. (Well, I guess lots of open source/linux stuff does).

      --
      Random is the New Order.
    2. Re:Why developers don't reuse by Anonymous Coward · · Score: 0

      1) the (time)-cost of doing the search,

      Just like the old saying, "A week in the lab can often save you an hour in the library."

    3. Re:Why developers don't reuse by Anonymous Coward · · Score: 0

      The jury is still out on whether OO promotes reuse significantly imho.

    4. Re:Why developers don't reuse by Anonymous Coward · · Score: 0

      Basically, every OO class is tied to all the other classes it interacts with. In any nontrivial application, this means that taking a single class for reuse means taking 30% to 100% of the application for reuse... and then you realize that those other classes are completely inappropriate for your purposes and you end up rewriting the class from scratch. This is what happens in practice, and the only exception is when someone has spent lots of time to explicitly plan and create a reusable library. And then you probably need to import 10% to 100% of the library to get anything functional.

      But despite all the evidence to the contrary, OO evangelists keep preaching how objects are reusable. This should tell you something.

      BTW, I am not saying that classes are not a good way to organize code, they can really help to design an application. But they don't help for reuse one bit, you have to put up the work to make it reusable. In practice the OO revolution was really about getting the average coder to make their code somewhat modular, and modular design as such is an idea that predates computers.

  55. Wheels are constantly redesigned by cgenman · · Score: 1

    Firestone, Goodyear, Michelin, Continental etc all redesign the wheel every year. They try new designs with varied rubber thickness, sidewall materials, traction depth, doping materials. There are plastic wheels that prevent shopping carts from leaving the parking lot, airless rubber wheels in public bicycles in Prauge, castor wheels that come in pairs and run on carpet. There are wheel bearings in the axles of your car, wheels used to roll the drum in your drier, wheels that hampsters like to play in. Wheels are turning in the pully being used to haul furnature to the 4th floor, they turn in the CD player running in the 4th floor apartment, and they will be used to roll the refridgerator into its final position where the wheels in the compressor will turn to cool food.

    I'll wrap this up before this tirade degrades into "The Kentucky Fried Movie." The fact of the matter is when people say "re-invent the wheel," they almost always mean "redesign the wheel" or "re-implement the wheel," both of which happens every day in our wheel-obsessed society.

    Balance that perspective.

    1. Re:Wheels are constantly redesigned by Anonymous Coward · · Score: 0

      I am wheel literate. I am intimately familiar with the wheel paradygm. Hire me!

  56. The time is also better accounted for... by zipwow · · Score: 3, Insightful

    I think there's also the perception that looking for a library to do what you need isn't work, while writing a solution is.

    If you've solved it by finding a library that does it, but it took you a while to find the right library and figure it out, you may find yourself in the hole. Your dept manager may ask "Why aren't you finished? You didn't have to write that component..." and be unhappy with the (accurate) reply of "Well, no, but it took me a while to evaluate the libraries available..."

    I'm blessed to be avoiding these at my current position though, so I'm thankful.

    -Zipwow

    --
    I don't know which is more depressing, that 2/3 didn't care enough to vote, or that 1/2 of those that did are crazy.
  57. reinventing solutions w/ well known algorithms by nuttyprofessor · · Score: 5, Interesting

    Back in 1990 I worked for a small company that built
    graphics boards and my first task was to debug
    the "polygon fill" routine in their firmware.
    It turns out they use their own "home brewed"
    algorithm that was slow, memory hungry, and didn't
    handle degenerate cases correctly. If anyone in
    the company would have taken the time to pull
    any one of the graphics textbooks off their shelf
    (e.g., Foley, van Dam) they would find a much better
    solution.

    I ended up rewriting the module myself using
    the classic solution -- it was faster, used little memory,
    and handled degenerate cases reasonably.

    It was my experience that everything was a badly
    reinvented wheel when I worked there.

    1. Re:reinventing solutions w/ well known algorithms by tincho_uy · · Score: 1

      Did your solution handle the 3DMark tests correctly? ;)

    2. Re:reinventing solutions w/ well known algorithms by Anonymous Coward · · Score: 0

      Yeah. I work for nvidia and you wouldn't believe the shit
      we push into the firmware. I mean we had to add a
      second vlsm just to hold half of one of those pixel unregenerate algo's
      you're huffing about:dick in hand and ready to unload.

  58. Re:Because developers don't play well with others. by Anonymous Coward · · Score: 0

    FOR THE LOVE OF GOD, let's all take a deep breath and remember that ACCOUNTABILITY IS AN OPT-IN PROCESS.

    That's right: while it is interesting to see everyone getting so indignant about people that have identified someone they think is wrong in their lives (which you can rightfully argue about, but they have made a choice that this is something that they want to work to remove from their lives) and which they are trying to weed out. This is an opt-in choice. No one is forcing a person to sign-up for this service or to receive the reports. This is a free choice between consenting adults.

    I don't know about the rest of you, but I know that I have behaviors that I would like to see changed. For some of us these are addictions (sex, porn, alcohol, drugs), for others it is a desire to improve ourselves (spend time with significant people in our lives, exercise, control our tempers better). As various 12 Step programs have shown, and as others knew before them, one of the best ways to do this is to build accountability into our lives.

    All this is a high tech version of what happens at an AA meeting or in prayer groups in many churches. People are confessing their "sins" to one another and being encouraged to go out into the world and continue to pursue what they believe is right.

    I don't know about the rest of you, but I know that I am not perfect. I am far from it. It would like to see change in my life for the better. I would like to be more regular in working out, focus more attention on my children, give my wife my time, be more attentive to friends, to not procrastinate, etc. I have folks that are my accountability partners. Do I use a system like this? No. But can I see the benefit to some? Yes. If it isn't meaningful or helpful to you, then pass on it. But if it works for the folks in question, then respect them as consenting adults doing something in the privacy of their relationships.

  59. Risky by Anonymous Coward · · Score: 0

    If the source code is freely available (or if the code comes from a reputable company/source), then code re-use is great, otherwise it can be too much of a risk for a project:

    1) How buggy is the code? If there are problems in your software as a result of it, how can you fix things (can you even?). Debugging your own code due to your own mistakes is one thing, finding other people's mistakes is another. And if fixing it is out of your control, what do you tell *your* customer when things go wrong?

    2) How supported is the code? Will the author be supporting this thing 2 years from now? Or will he/she move onto something more "fun".

    3) How stable is the code? Will the interfaces change every release because the owner wants to do things differently and can't be bothered to support older methods (regardless of how many people that screws)?

    4) How appropriate is the code? Do you have to bend over backwards in your own code just to use it properly (hopefully you've at least put a wrapper around it)? Reusing code just for the sake of reuse ain't generally a good thing.

    Software sucks, and developers know it; of course, *their* code doesn't suck, it's everyone else's that does. Part of that problem is that anyone can pick up a book on programming and start to write software (it's too easy to do, although much harder to do right).

    But, *knowing* all of this, it's of course much better to write your own. Besides, developers complain less that way (rarely do people complain that their own code sucks -- even if it does -- so there's less negativity: usually if your own code sucks, it's the end-user's fault).

  60. Finding it is HARD by m11533 · · Score: 5, Interesting

    I have been involved in software reuse since the mid-1980s and possibly even earlier. There has been lots of energy expended on the problem of making existing implementations extensible, one of the strengths of OO technology, though not requiring OO. The big piece that has always been missing has been a major concerted effort focused on facilitation matching a developer's needs with existing software.

    There are many mechanisms that can assist such as:

    1 - technical reviews. When these happen, you get a number of co-workers together to review your work. Not only does this assist in ensuring that direct work (architecture, design, code) is correct, but it also provides an opportunity for all those involved in the review to search their knowledge of pre-existing "parts", be they architectural, design, or actual code, and to suggest you investigate them. Of course, if you're like me, then actual review meetings where a number of people sit down and examine your work just do not happen any more. Thus this form of identifying existing work that can be reused no longer functions.

    2 - CASE tools ... I have long felt that CASE tools, yup those tools that are totally out of vogue right now, would be of greatest value if they had a dual function. Their primary function would continue to be as a means of describing architecture, design, or code, but a secondary function would be to, in the background, perform a continuous search of existing work looking for matches. I have never seen a tool that does this, yet this seems a tremendously valuable function.

    3 - personal memory - only works for those items you already are familiar with, which frequently gets voided when changing jobs.

    4 - institutional memory - this is similar to the technical review mechanism, yet is less well defined. The real question here is HOW does an individual tap into an institutional memory? Documentation search? This is far less than perfect even if all work was well documented. Code search? Even worse at turning up matches to needs.

    So... the bottom line is that it truly is VERY difficult to match up needs of a software development effort with the existing software that is available.

    Once case in point... I worked on a very large project for an FAA (Federal Aviation Administration) contract. One mechanism I needed was a circular buffer/queue. These seem very straight forward to implement, and an obvious place to use an existing piece of design/code. Well, even after extensive search and review I could not find such a part and built my own. Later, I discovered there were at least six independent implementations of a circular buffer/queue in this single project team. All of them were general enough to meet the other implementation's needs, yet somehow none of us knew of the others' overlapping work. If we couldn't coordinate the reuse of these six independent efforts (and that means we all built the same basic algorithm, found the same set of bugs... and yes, using our code management tool I was able to see the same bugs being fixed in each implementation... and thus a total and unnecessary duplication of effort), how in the world will we ever solve the problem of reusing work outside the single project team, or outside a company?

    There are some examples of wild success with reuse... though they seem to me to be more success though definition. All of those shell scripts that are built from individual command line tools are examples of reuse, where each command line tool represents a unit of software available for reuse. But, I think we all think of reuse more at the code module level... a function, or class, or small library. And it is at this level that I think we fail miserably, and it is my contention that we fail because we can't easily find the candidates for reuse.

    1. Re:Finding it is HARD by UpLateDrinkingCoffee · · Score: 3, Interesting

      Flashline is a company built around this idea. It's not integrated with CASE so to speak, but they are thinking along similar lines.

    2. Re:Finding it is HARD by crucini · · Score: 1

      I think shell reuse works because we use those tools heavily by hand, so they are near to hand when writing scripts. Unfortunately, I don't know what lesson to draw from that.

    3. Re:Finding it is HARD by bshanks · · Score: 1

      I think we need some sort of collaborative website to keep track of the tools. Like canonicaltomes.org, for libraries. Like CPAN, but more flexible. I would suggest a wiki -- a wiki allows users to maintain a hyperlinked web/heterarchy of categorized entries, and makes it easy for anyone browsing the site to make a note of something related that they've heard of. You could call it canonicallibs.org or something.

  61. Blah by CommieBozo · · Score: 2, Interesting

    Some or all of these things happen:

    The library is under a license other than the MPL or LGPL.

    We try to make the library work for hours, only to find it doesn't do exactly what we need, or is horribly broken.

    We try to use the library, but it's broken, and the developer lives in France and only responds to emails while we're asleep.

    It would be faster for us to write our own then to decipher someone else's code.

    The only real third party library we use mostly does the job, but we had to wrap it and implement all of the features it didn't. In the end, we should have just created our own library. The way I see it, it's just one more thing we can sell.

  62. The tedium factor by jtheory · · Score: 4, Interesting

    Yes, I'm paid by the hour, but I also care about the quality of that hour. If the problem is interesting, I tend to research other solutions (to scope out the pitfalls and features I might not have thought of), then I'll often implement my own solution, because learning someone else's code tend to be pretty high on the tedium scale.

    If the problem is NOT interesting, I have a lot more motivation to find someone else's code that I can use; if I find a quality solution, I can plug it in, spend hopefully minimal time debugging and testing it, and move on.

    And there CAN be pride in using someone else's code, actually; I really get a kick out of using libraries and sending back elegant enhancements or bugfixes back to the authors ("Your library was excellent. I improved it.").

    Also, if the code you found is really good stuff, it might help you to finish up a complex feature in record time, which also feels nice ("Oh, I almost forgot to mention it, but that new report we scoped out yesterday is out on the test server").

    --
    There are only 10 types of people: those who understand decimal, those who don't, and, uh, 8 other types I forget.
    1. Re:The tedium factor by Anonymous Coward · · Score: 0

      Also, if the code you found is really good stuff, it might help you to finish up a complex feature in record time, which also feels nice ("Oh, I almost forgot to mention it, but that new report we scoped out yesterday is out on the test server").

      I agree 100%... Sometimes customers are really amazed at how quickly I can get things done because I was able to re-use existing code or libraries rather than start from scratch on everything. I'm paid by the hour too... But there is no shortage of work, so why try to pad hours.

  63. Because sometimes it makes sense by revbob · · Score: 2, Interesting
    I remember a task I had to convert a set of World Toolkit NFF files to Inventor, or to some file format where we already had a converter that would turn them into Inventor, like DXF.

    I spent a fun week exploring through the computer graphics repositories of the time (it was some years ago), but I finally decided I'd had enough fooling around, so I hacked out some quick C and converted the files.

    The converter I wrote and debugged in a couple of hours was virtually guaranteed to crash and burn on any WTK NFF files but those, but I didn't care. What I needed was those files in Inventor so I could get on with the job of lighting and animating them.

    That's the problem with the Booch Components and a good percentage of the things I see out there in the repositories today: they solve the general problem with such elegance that they're really optimally useful only for people who want to understand the general problem instead of knowing exactly enough to solve the specific problem they have.

    Well, here's a news flash: a good part of the time I'm to busy to learn how to solve the general problem. What's more, I know I'll never need this knowledge I acquire again, so a quick in-and-out of my brain is all I need.
    --
    The end

  64. Tool makers... by rusty0101 · · Score: 2, Informative

    My grandfather was a Tool and Die maker. If GM mechanics were having problems tightning down the distributer cap after adjusting the timing, GM would send him a car, explain the problem, he would take a look, make a couple of different wrenches along the idea of what he thought would do the job, then send back the wrench that did the job best.

    The knowledge required to get the wrench to work best required understanding several mechanical principles that he was particularly good at, and I am sure that there are others these days as well, mostly working directly for the automotive companies. (Either that or they have much better engine designers who have made it simple to get to all nuts and bolts without special tools. Looked under your hood lately? Which do you think is most likely.)

    In any case, the common idea is that if you are going to make something that fits a custom need, you are unlikely to be able to do it with off the shelf components and tools. Occasionally there may be a nice general tool that would suffice for the job, in software it might be a component of MSfts .NET tool set, that you have personal reasons for not using (can't stand msft, can't afford .NET, can't follow the msft licence requirements, don't like that Craftsman sold someone's pattented idea to Snap-On without paying royalties to the inventor) and so you make your own tool to do what ammounts to the same job.

    That's my thought, I could be wrong.

    -Rusty

    --
    You never know...
  65. Re:Because developers don't play well with others. by Anonymous Coward · · Score: 0

    I just don't buy it.

    Have you ever seen hundreds of mailing lists where lawyers congregate to offer whatever advice they can?

    Free modules everywhere? Documentation on hundreds of concepts and ideas published and given freely for the legal profession?

    Infact I can hardly think of another profession comperable to supporting it's peers than development.

  66. And this is why... by pVoid · · Score: 1
    Templates rule, and C++ will never die. (unless people stop understanding the usage of templates).

    I personally am firmly against object reuse. Unless it's really plain simple objects like smart pointers.

    Unfortunately, I am working right now, and can't go in depth about what I think of this... if you wanna flame me, go ahead, maybe it'll summon up the courage in me to explain better. If on the other hand you know what I'm talking about, please explain to the rest of the world on my behalf... =)

    1. Re:And this is why... by kbielefe · · Score: 1
      I bet you are less against complex object reuse than you think. When is the last time you implemented your own I/O library or windowing system? Or those annoying objects called device drivers? Don't confuse a class with an object -- they aren't the same thing.

      You couldn't write software as complex as you write now without reusing other people's code. The whole point of the article is that we've hit another threshold where we won't be able to make more complex software without more reuse of higher-level code.

      --
      This space intentionally left blank.
  67. An interesting mis-post! by jordandeamattson · · Score: 1


    Cute. Taking one of my replies from a totally different discussion) and posting it without attribution and as an anonymous post. Very fun. Of course, I am the only person that got the joke....



    Did I do something to upset you? Sorry if I did.

    1. Re:An interesting mis-post! by Anonymous Coward · · Score: 0

      Dunno about him, but the massive whitespace in your posts annoys the fuck out of me.

  68. 2 reasons by geekoid · · Score: 1

    1) Coders enjoy coding.
    2) Liability

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  69. Not quite, but you're onto something... by Kjella · · Score: 1

    Because you're just as smart as that other guy, right? And your code will always be better than his is.

    Not necessarily. But if I wrote it, I got a pretty good idea of how good/poor it is. If I have to go through his code to find out whether it is good or poor, that'll probably take me just as long.

    Kjella

    --
    Live today, because you never know what tomorrow brings
  70. obPearlSlam! by Anonymous Coward · · Score: 0
    "Its exactly the best [PERL] coders who make heavy use of CPAN."

    And that's not saying much!

  71. links for windows code by kirkb · · Score: 1

    Every time I need a nonstandard windows control (currency edit, picture buttons, resizable dialog box, etc), I hit sites like http://www.codeproject.com or
    http://www.codeguru.com

    I've used tons of code from these sites, and would encourage windows developers to check them out instead of re-inventing the wheel.

    --
    Slashdot: come for the pedantry, stay for the condescension.
  72. My reason: Piss-poor documentation & Obfuscat by Anonymous Coward · · Score: 1, Insightful

    Sure, it's frustrating to re-invent the wheel and create a custom library of classes when something perfectly useful already exists. However, if it's documented at all, most of the 'free' code I've come across out there looks like: /** * Fubar formatter. * * @param param1 param1 * @param param2 param2 * @return int */ public int fubarFormatter(int param1, String param2) { [highly obfuscated code to prove I'm a R0x0rz coder dude!!!!] } Sure, it LOOKS like it MAY provide what I need, but I couldn't be bothered to figure out if it covers all of the possible exceptions which may be thrown or even if it consistently does what I require of it. Much easier to just design the proper solution and implement it in a manner which is internally reusable.

  73. Inconsistent Terminology About Code by AdamMB · · Score: 2, Interesting

    One of the biggest problems I usually run into that no one has mentioned yet is this: when searching the literature, I don't know what terms/keywords I should be searching for to find the code to solve the problem.

    For example, one project I worked on was an interactive calendar application that would dynamically place multi-day events across the days on which they occurred. Well, I needed those event bars to be as compact as possible, so I searched for an algorithm to figure this out... After 3 days of searching and finding nothing, I asked a Computer Science professor at the local university and he couldn't come up with anything either. I know there is code to solve this type of problem, but I simply couldn't find the keywords to use to locate the code.

    And just to chime in about what everyone else has mentioned:

    My top reason for not using public code is the lack of quality documentation. If I didn't write it, it's really hard for me to understand it and make use of code without putting in considerable time studying the code, which is more time than I have.

    -Adam

  74. Integrating can be more effort than building by Spirald · · Score: 1

    IMHO, finding pre-built functionality out there that does what I want, the way I want it, with an appropriate license and tolerable side effects that does not require me to make me own code dependent on the third party implementation is very difficult. I don't think the state of the art of component abstraction methodologies (class libraries, VMs, languages) are mature, complete and interoperable enough at the present time to reduce the amount of integration effort required for third party code to the point where using many components from different vendors in a single system is cost effective.

    While functionality that you build can be an asset if you can effectively package it for re-use, integration code that you write to work third party components into your own application can become a liability, as it absorbs maintenance effort as the third party libraries evolve.

    Third party code that has well defined interfaces, and would be very hard to implement yourself tends to be better suited for integration as the cost of integration over time needs to be less than the cost of building it yourself.

    In my experience, it is easy to underestimate the amount of integration effort required for third party code due to vendors' incentive to promote their products. Some commercial vendors get you way past the point of no return before you find the 'issues'. Once you pass the event horizon, you may be doomed to have your time and money sucked into the black hole of repeated workaround and upgrade.

    Open source is better that way- at least you can -see- what you are getting into before you decide to commit the integration time.

    It is very hard to predict how much it will really cost to integrate with something you don't fully understand. If you do fully understand it, it may be less expensive to build it yourself.

  75. Re:HELLO!?! CAN NE1 HEAR ME?!!? by Anonymous Coward · · Score: 0

    Sorry, no one can hear you. You'll have to yell louder.

  76. wheel reinvented by Anonymous Coward · · Score: 0

    Now that you mentioned it, ever notice how many new wheel designs the car people put out every year? Maybe we'd better ask them why.

  77. A n00b's Experience by Anonymous Coward · · Score: 1, Funny

    Well, you see, it was because I was running late on one of my programming projects and so I decided to um...reuse code I found online. Found a site of someone calling himself the BOFH which seemed like a catchy acronym so I dug around for some of his code snippets.

    He went on about how it was great to put comments on code (which was something our instructor told us was a good thing(TM) so instant credibility!!!)

    So I proceeded to borrow his comments too -- even though I wasn't sure how rm -rf * was supposed to mean "remark."

    Aaaand this is why I don't borrow source code anymore.

  78. Algorithms and biz logic. by sporty · · Score: 1

    I totally agree to some degree. :)

    If every company wrote their own web server, that'd be stupid. But when a solution needs to be written due to a technical requirement or a business requirement, that will be more likely unique.

    Lets take, something like.. the Java API. CPAN is quite huge and has all the tools that perl has. But someone came along and said, "We need a business language, that we can make money off of [ 2) ???? ] and fulfill a bunhc of things, like OOP and such." Thus, java was born.

    Now you ahve two tools that can do the same thing, near line-by-line if you want them to. Yes, there are things you can do in one language, and not in others, but it can be done.

    Now I want to start a company that sells ERP software. It's been done before, but I think I can provide something that other people can't. THAT is what is unique and why the wheel is reinvented. My software does something better, or at all, fulfilling a requirement.

    Problem is, you can't strip out my "better stuff" and paste it on. That'd be like, using word for some things, wordperfect for others, and finally, use abiword for finishing touches. It'd either be economically stupid or impossible.

    --

    -
    ping -f 255.255.255.255 # if only

    1. Re:Algorithms and biz logic. by HeyLaughingBoy · · Score: 1
      If every company wrote their own web server, that'd be stupid. But when a solution needs to be written due to a technical requirement or a business requirement, that will be more likely unique.

      Exactly. Tbe problem is to make available those components that may be common from project to project. Say I need to read a MIcrosoft Word8.0 (or whatever version they're up to now)document so my app can manipulate the text. Or I just need to autogenerate a document in Word format. It would be nice to be able to find/purchase a Word converter that will provide output to a user-supplied buffer or something. The rest of my program is my custom business logic, but reading a Word doc is something that many applications could use if it were possible. Same thing with the guy who needed an expression parser (although I remember coming across one for sale a few years ago.).
  79. You should read up on Programming 101 by pVoid · · Score: 1, Informative
    API = Application Programming Interface...

    Now. Do you know what an interface is?

    I'll give you a hint: in C++, it's defined using pure virtual functions, that is:

    void myFunction() = 0;

    If you say C++ is for 'st00p1d' people... then try and instantiate an 'interface' (with no supporting class) in java. Tell me when it works.

    Interfaces are not implementations. Interfaces are not code.

  80. Reinventing the documentation by spun · · Score: 1

    In many cases, at least in my experience, the time it takes to find an existing solution and learn to use it is often greater than the time it takes to reinvent it.

    --
    - None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
  81. Hmm. by TaranRampersad · · Score: 1

    Let's look at that differently. Consider recipes, another functional work.

    Yes, the ingredients are the same, and maybe even the process for combining the ingredients is the same. But the way it is written affects the way it is read; the way it is read affects the way it is used - and therefore the way it is written affects the end product.

    Looked at differently, look at books. How many books seem to have the same mechanics? The plot, the characters, and so on. Yet each book is different. Each author writes differently. And different readers like different authors.

  82. Two Reuse Stories by weston · · Score: 5, Interesting

    I often don't reuse for reasons described very well by other posters, but I wanted to mention some cases where I either did reuse or wanted to.

    Two years ago I was developing online courseware for a company that trained/certified future medical transcriptionists. We needed to develop a typing test. Now, a typing test is all about doing two things -- (1) noting when someone types something the shouldn't be there and (2) noting when someone doesn't type something that should. So you're comparing for absensces or additions between a given text and a key. Sound like anything else? My first thought was 'diff'. My second thought was Perl (after all, this is text slinging). My third thought was CPAN. And sure enough, Mark Jason-Dominus' excellent Algorithm::Diff saved me at least days of time and quite possibly weeks.

    Now, this was possible in part because I was working as a contractor, and so was probably trusted a bit more, and also, in part because my supervisor/contact with the company was pretty savvy. I can contrast this with some other experiences. Like the company I worked for that wanted a webserver log file analysis package. Again, lots of text slinging, but perl or any other scripting language was out because we wanted the source as closed as possible. Nope, it had to be in C, and I was discouraged from trying to find a regex library to use. I essentially ended writing my own regex engine. It was buggy. It needed optimization. The syntax was less powerful . The stats package itself was good, especially for 1997 (it could do things I've only seen other log analyzers do in the last two years), but because it all ran on top of this flaky regex engine, it couldn't fly. I think it got canned after I left... nobody wanted to touch it. I seriously think I lost months of my life on this, and the company lost a good product. All from trying to reinvent the wheel...

  83. einvent the wheel!-Read the script. by Anonymous Coward · · Score: 0

    That's why scripting and other languages were invented. Easy to write, easy to debug, easy to change. Build up a global library and pull what you need, customize accordingly. And has anyone figured out how much NIH actually costs worldwide? "Fun" can be costly, both monetarily and other metrics (lives lost due to buggy code)

  84. Errily relevant quip by Arslan+ibn+Da'ud · · Score: 1

    Here at CMU's engineering department we have a relevant comic about this:

    MOM: Glad to see you back home from engineering school, son. By the way, can you fix our toaster?

    SON: Er...no. But I could design a new one!!!

    SON: (later) I wonder how useful this engineering degree really is.

    --

    Practice Kind Randomness and Beautiful Acts of Nonsense.

  85. Re:legal issues by ncc74656 · · Score: 2
    and it is PAscal, not this joke of a language called C or C++

    Pascal is a girly-man's language...strong typing is for people with weak minds. If I want to shoot myself in the foot, I don't want my language telling me I can't shoot myself in the foot, dammit! :-)

    --
    20 January 2017: the End of an Error.
  86. Simple reason ... by BillsPetMonkey · · Score: 1

    Unlike books, code is easier to write than to read. And that's even when it's commented properly.

    --
    "It's not your information. It's information about you" - John Ford, Vice President, Equifax
  87. heh by calethix · · Score: 1

    anyone else have the 'dirty deeds, done dirt cheap' song just pop into their head? :)

  88. Lots of reuse in academics by pcraven · · Score: 1

    I'm finding that there is a lot of reuse going on in academics. I talk to professors who see the same papers over and over...

  89. The Worst Case of Reinventing by RobTheJedi · · Score: 2, Insightful

    My company uses M$ SQL Server for our DB (yes we are a microsoft shop ) The server can be configured to send email using Outlook or any MAPI client, or can be configured to use SQL MAIL, which expose extended stored procedures such as xp_Sendmail. But no one looked into it so someone wrote their own sp_Sendmail, that connects to CDO using objects in the stored proc.

    I think the failure to understand the capabilities of your tools and configure them is the main reason that people reinvent the wheel. (Outside of general the general "that's good but this way is better" pride we all have.)

    --
    I am so creative, look at my cry for attention in my sig.
    1. Re:The Worst Case of Reinventing by Anonymous Coward · · Score: 0

      Consider that having a MAPI client (Outlook) on your SQL Server is a pain in the ass (think CM and security) and way too much functionality just to send an e-mail. CDO-NTS works fine with the minimal SMTP server included in W2K and is very easy to use. I Agree With This Choice.

  90. Leaky! by t'mbert · · Score: 3, Interesting

    Why don't we use more available code? Leaky abstractions for one. And look at the DLL and .so hell we're in now, where we have libraries that depend on libraries which depend on libraries...yik...all that to save a tiny bit of work, ain't worth it. Write your own.

  91. More likely... by Balinares · · Score: 1

    I may be wrong, but isn't it just a matter of your truck wheel simply not fitting on my sports car, and vice versa?

    --

    -- B.
    This sig does in fact not have the property it claims not to have.
  92. Re-using code isn't painless by fractalus · · Score: 1
    Reasons not to re-use code:

    • Takes time to find code.
    • Freely-available code is of unknown quality; auditing it takes time.
    • Freely-available code may not integrate into your application well; changing its API may be non-trivial.
    • Freely-available code may have security flaws.
    • Freely-available code may have licensing restrictions.

    Most of these boil down to time, time taken to work around the issue. If the amount of time saved is bigger than the amount of time to make free code work, it's worth it.

    Each programmer has to determine, on a case-by-case basis, whether re-using code will work. This depends on the skill of the programmer, too; for some, time spent programming is far more productive than time spent trawling sourceforge for usable code.
    --
    People are never as simple as their stereotypes. This applies equally to Christians, Muslims, and Emacs-lovers.
  93. Re:legal issues by Anonymous Coward · · Score: 1, Insightful

    The point of C is that sooner or later a programmer gets good enough to stop shooting himself in the foot. If he's not there yet, best to stay in the shallow end.

  94. It's all about the API by moocat2 · · Score: 1

    One of my biggest problem with "reusable" code is that it truly isn't reusable. A lot of libraries out there were obviously ripped straight out of a some other project and the interface reflects that. You end up spending as much time jumping through hoops to call the library as you would to rewrite it. And plus in that case, the places where the code meets is hard to maintain.

    If engineers really want their code to be reusable, they really need to spend some time thinking about the interface. What are the exact semantics of each call. When an error occurs, who is the caller or the library responsible for cleaning up any partially finished events. How will the caller provide data; if the caller has data in a different format, how hard is to convert.

    Until people start really thinking about interface/API design, reusability will never come to be.

  95. Comprehension often takes as long as writing it... by Bakaneko · · Score: 2, Insightful

    Quite often, the act of comprehending what a bit of "reusable" code is doing exactly takes nearly exactly as long as writing a working example oneself from specification...

    And usually, you DO have to comprehend what it does, even when it's supposed to be "opaque"... If only to understand the caveats of performance of the code in question. (Memory use most commonly.)

  96. Re:Because developers don't play well with others. by mysterious_mark · · Score: 1

    Hey F$%& U!!! - anonomous developer

  97. Tiny Tots terrorize OSS. by Anonymous Coward · · Score: 0

    " The reality is that developers in general don't play well with others."

    "First, it is no fun to use someone elses code. "

    "Second, people don't trust one another. "


    And yet people expect OSS to take off.
  98. Binary vs. Source by torokun · · Score: 1

    I think one of the most important reasons it doesn't happen is because of the issue of encapsulation.

    Most source code libraries are not sufficiently encapsulated to prevent other developers mucking with them. Many have seen that the binary component approach has achieved much better encapsulation, and therefore has been more successful when it comes to code reuse.

    I have to say here, that the *nix/oss community has underwhelmed me with their support for binary components. Yes, there are java beans, and yes there is CORBA, but I've never known CORBA to be successfully used much (usually just part of an overly-designed from-scratch system), and java has some limitations I can't stand, but I do think it is the right approach in general.

    This is really the area where COM has led the way (as much as I'm sure you hate to hear this). Think about the way that MS continues to provide more and more functionality through COM objects (and now through .NET), which is usually available to any application or object running on the OS. The fact that the OS supports these standard objects causes people to abandon their proprietary solutions and use the MS versions.

    I see this as a sort of mediation process. Everyone wants reusable objects, but noone wants to spend the extra time to implement generic interfaces that they don't need, or to even think about other people's problems. MS comes in here and provides objects that bridge the gap between these proprietary solutions, vastly reducing code bloat (since we're talking about binary components), and vastly increasing development ease and speed in some cases.

    I'm sure many of you have never gotten into the nitty gritty of Windows programming, but I can tell you, binary components get reused. ActiveX controls get reused. Think about how different this is from the situation of open source libraries -- you drag and drop a browser control into your program and start displaying web pages... Load up media player behind the scenes and start playing mp3s...

    I think that if the open source community really wants to promote reuse, they should begin to think like MS. Have the people putting together the distributions take the initiative to develop suites of binary components, and get a development environment that makes them easy to drop in. If this exists and I'm ignorant of it, let me know, but it seems to me that most open source development is not geared towards what I'm talking about...

  99. Because useable code != reusable code by Arslan+ibn+Da'ud · · Score: 1

    OK think a moment. How long would it take for you to code up a linked list data structure? An hour? For me, prob 1 hr + 3 hrs debugging. It'd be a pretty simple module, right? Right.

    Now take a look at the linked list implementation in the STL. Or the JFC. Much more complex, right? I bet those weren't built in 4 hours!

    That homebrewed linked list you built may work for you, because you know its limitations and instinctively avoid them, but I don't. So I'd rather build my own linked list.

    Oh, I suppose I can use the STL's linked list, but it makes the compiler sooooooo slooooooowwww.

    --

    Practice Kind Randomness and Beautiful Acts of Nonsense.

  100. Your gramps owes me money! by Anonymous Coward · · Score: 0

    Now I understand why you can't even fill the gas tank on a GM without a special tool -- it's all your grandfather's fault! GM vehicles are notorious for needing special tools for any repair or even ordinary maintenance functions.

    1. Re:Your gramps owes me money! by rusty0101 · · Score: 1

      Nah, He just made it possible to work on them. The designers made it necessary.

      --
      You never know...
    2. Re:Your gramps owes me money! by Anonymous Coward · · Score: 0

      You're probably right. You used to have to pull the engine to change plugs on a Jaguar and a friend of mine in the aeronautics industry tells me stories of oil filters that are not accessable without removing engine support struts. Why should GM be any different. I appologize for libeling your grandfather. ;)

  101. Multiple wheels for multiple cars by 1029 · · Score: 1

    Most people don't reinvent the wheel the way you think of somebody working hard to come up with the idea of a circular object that rolls.

    The correct way to think of coding items very similar to what is already out there is a tire company. You have different treads, sizes, applications, etc... but they are all "wheels". And nobody tries to tell a tire company it is constantly reinventing the wheel...

    --
    - I love animals. I try to eat at least one a day.
  102. Most software engineering processes are weak by Anonymous Coward · · Score: 0
    And therefore don't produce code that is thoroughly debugged and documented well enough to allow others to reuse it with any confidence.

    And where there's enough need for something to create a market big enough to generate enough revenue to pay for developing such code, it gets done. See "Rogue Wave", STL, MFC, libc, etc.

    That's the fallacy of code reuse - the "if we start reusing code we can spend less on development" theory doesn't work unless the code you develop for reuse is really sound, well documented, and well supported.

  103. reusability vs reliability and code repositories by Uzik2 · · Score: 1

    I search the web for reusable code regularly.
    There isn't a good single place to find code
    that I've seen, except perhaps sourceforge.

    Your link is slashdotted, but it's pointed to
    a perl web site. I personally have been very
    unimpressed with perl and with the quality of
    programming I've seen in it. The concept of
    maintainability and testing seems to have been
    missed. You could do good code in perl but
    I've seen little of it.

    I think this also misses the concept of reducing
    dependencies to increase software reliability.

    --
    -- Programming with boost is like building a house with lego. It's a cool but I wouldn't want to live in it
  104. Where is this good code I'm supposed to use? by metamatic · · Score: 2

    I use libraries (or modules). However, I don't think I've ever used available source code as a starting point for anything.

    Reason 1: Most free source code is crappy. When looking for C code, for instance, you'll hardly ever find any that bothers to check the return value of malloc() and other functions that might fail.

    Reason 2: Even when the code isn't crappy, it's usually not adequately commented.

    Reason 3: Even if you find that rare piece of code which is both well-written and adequately commented, chances are it's not documented.

    --
    GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    1. Re:Where is this good code I'm supposed to use? by Piquan · · Score: 1

      Reason 1: Most free source code is crappy. When looking for C code, for instance, you'll hardly ever find any that bothers to check the return value of malloc() and other functions that might fail.

      I see a lot of replies like this, and it makes me wonder. I mean, people saying this probably do check return codes. So are they I posting free code?

    2. Re:Where is this good code I'm supposed to use? by Rob+Riggs · · Score: 1
      Most free source code is crappy. When looking for C code, for instance, you'll hardly ever find any that bothers to check the return value of malloc() and other functions that might fail.


      Don't you find it easier to fix things like this than write your own? In the cases where I've used open source libraries that were, shall we say, a bit under-developed, I found it easier to contribute fixes to the library than to roll my own. With the framework already in place, contributing some corrections or documentation is still easier than writing ones own library -- especialy for complex problems where the solution is almost there.

      --
      the growth in cynicism and rebellion has not been without cause
    3. Re:Where is this good code I'm supposed to use? by metamatic · · Score: 1

      Well, there we have another issue. Yes, it may be easier to fix badly-written code than write new code--but it's also a lot more dull and unpleasant. If you're confident of your ability to write the code, writing well-written new code is a much more attractive proposition. You also don't then have to deal with licensing issues and other questions that might dog a commercial organization.

      So one message to open source developers might be that the original authors really need to spend a little extra time writing the code cleanly and commenting it, because otherwise other people are much less likely to want to contribute improvements.

      Case in point: My urge to contribute to Mozilla vanished rapidly when I saw the state of the code.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  105. whatever by Anonymous Coward · · Score: 0

    I'll be honest - I never read the top link. I wasn't slagging CPAN or refering to Perl in particular.

  106. Experience by TLouden · · Score: 1

    I find it best to try to solve a problem myself, if I can't then I find someone elseâ(TM)s solution. Then I take their solution, study it, test it, and rebuild the whole thing. Seems stupid but it pays off in experience. If I solve a problem once I KNOW how to do it again. For me understanding what I'm doing is very important, it also makes debugging a whole lot easier and in the future I can reuse my own code and understand it immediately.

    --
    -Tim Louden
  107. Hang on just one second... by Realistic_Dragon · · Score: 1

    I'm the worlds greatest programmer, what the hell does anyone else have to teach me? I can write code much faster than anyone else, and have it finished before google even returns a result. Just look at me go!

    for(i=0;i<4;i++) {
    switch(i) {
    case 0: ...
    case 1: ...
    case 2: ...
    case 3: ... } }

    --
    Beep beep.
  108. coders should not decide to reuse by axxackall · · Score: 2
    Coders should not decide to reuse or not. That's the decision a software architect should make. Some (few) good coders are good architects as well - and they often study someoneelse's code. But most of coders think they are the best (and they are not because they think they are the best) and they don't want to study anyoneelse's code ("It's easy to re-write than to understand!"). Remember, the smarter you are the less you think that you are smart!

    I think I made it clear: it's a job of system architects (or technology evangelists) to study the sources, to look for patterns, to evaluate patterns, using pattern knowledge to evaluate the source code, and, working very closely with software requirements, design and specs, to decide that some code is good to be reused or not.

    Decision to reuse the code requires another style of thinking than most of coders have. Don't assign such job to coders unless coder's and architect's skills are combined in the same brains.

    --

    Less is more !
  109. Finding it is HARD-Defintion of intent. by Anonymous Coward · · Score: 0

    "There are some examples of wild success with reuse... though they seem to me to be more success though definition. All of those shell scripts that are built from individual command line tools are examples of reuse, where each command line tool represents a unit of software available for reuse. But, I think we all think of reuse more at the code module level... a function, or class, or small library. And it is at this level that I think we fail miserably, and it is my contention that we fail because we can't easily find the candidates for reuse."

    And how does one describe software well enough that a machine can have the same level of understanding that people do?

    BTW would you say that interpreted languages lend themsleves more to code reuse than compiled?

    1. Re:Finding it is HARD-Defintion of intent. by m11533 · · Score: 1

      >> And how does one describe software well enough
      >> that a machine can have the same level of
      >> understanding that people do?

      This is of course a significant piece of what makes this so hard. And why reuse efforts have avoided it. I think there needs to be some serious research (University, NSF, etc) done into this area. I do have a few ideas, but there is no proof or foundation behind them and thus I'll keep them to myself right now.

      >> BTW would you say that interpreted languages lend
      >> themsleves more to code reuse than compiled?

      No difference between interpreted vs. compiled languages. More an issue is the level of abstraction... the higher level the "language" the more successful reuse appears to have been. Though, I suspect it has more to do with the limited number of parts and the ability to reuse them more frequently.

  110. Re:legal issues by Anonymous Coward · · Score: 0

    and it is PAscal, not this joke of a language called C or C++)

    Someone mod this down as flamebait... Seriously... Pascal? Yuck. And I'd only say Delphi is loosely based on Pascal anyway, it sure isn't ISO or ANSI Pascal.

  111. Re:legal issues by sperling · · Score: 1

    You don't know C++.

    This is probably offtopic, but oh well...

    I'm a programmer by profession, I've used Delphi since the betas of the first 16-bit version. I've also used C++ for years, and C for even more years, both of these on multiple platforms.

    C++ is by far superior to Delphi as a general purpose language, as soon as you get to know it well enough to really utilize it. If you claim Delphi bests C++, you have no idea what C++ can do for you. Do you have any idea what the STL is all about? Do you know anything about operator overloading, and how you can create true type independency? I don't intend to flame, but how can you make such a claim without the intimate knowledge of C++ which you obviously don't have as you make this claim ;)
    Delphi is by far superior to C++ when it's about creating a quick app with a nice GUI, combined from the insane amount of good ready-made components and samples, and some parts of proprietary code. Or when you work with e.g. anything combining SQL with a GUI, Delphi will be hard to beat. Or when you need to handle a ton of localized versions, which I have to for a current project.

    I could make lots of samples on why to chose X as a tool when doing project Y, but I guess my opinion comes through clearly enough. There is no best tool. There is no best language. There is no best OS.

    Again I can't resist preaching, I gotta learn not to jump onto baits this way ;)

    --
    The next great MMORPG.
  112. I am reinventing the wheel right now by inerte · · Score: 1

    Because I have to... I spent many hours looking for a free (as in beer) web project management software.

    If you search google for "project management" you get at least 4 advertisements. Just for you to know how much supply (and demand) exists.

    My requirements are very simple: Web-based, runs on Linux, contacts, projects, tasks, bugs and companies. Almost every project management has these features, but they don't have in MY way.

    For an example to show how most of them work: I can start a project. But I can't assign this project to multiple clients. Heck. A project can only 'belong' to ONE client.

    Also, user management. I didn't find one single software that would let me create an user, and let this user only browse ONE project, just for reading or writing entries. Most of them either concede full access or none at all.

    So I decided to write my own. Will I reinvent the project management software wheel? Nope. Because my wheel is different.

  113. Risk. by AnotherBlackHat · · Score: 2, Insightful

    Using "their" wheel is usually cheaper than inventing your own.

    But sometimes, it's a disaster.

    How can you tell if their wheel is any good?
    Including it with out evaluating it is a huge risk.
    It's not even easy to guess at the risk.
    Testing helps, but a good evaluation can be as hard if not harder than recreating it.

    How can I know if Net::::Hesiod is the best thing since sliced bread,
    or buggy garbage that should have been fixed long ago?
    Maybe if some fitness/correctness/bugginess evaluations were made by someone
    (even say, comp. sci. students as a homework assignment... )

    -- this is not a .sig

  114. Apache 2.0's memory pools by Anonymous Coward · · Score: 0

    I thought Apache 2.x's Protable Runtime (APR) with its commercial-friendly license was a perfect fit for my project until the complexity of its memory pools caused me to abandon it. I could not determine the rules under which it was threadsafe. Its documentation was also very vague on key issues including memory arena ownership and resource deallocation callbacks.
    I know what you're thinking: "Shut the fuck up - it's free" - and you're quite right.
    My only point is that a little documentation can go a long way to getting a critical mass of programmers behind a project.

  115. An analogy by Anonymous Coward · · Score: 3, Insightful

    When Ford Motor Co. is designing the body for a new model of car, why do they "roll their own" new front fender design instead of just using the front fenders off the '92 Taurus?

    I'm not trying to troll, but I thought this article was way too preachy. The author talks about people "reinventing the wheel," but the fact is (to carry the car analogy further) that you can't use the exact same wheel on every type of vehicle. That doesn't mean that you "reinvent" the wheel for each vehicle, but often you'll have to produce a variation on the basic design. Quit agonizing about it already!

    So he's been able to find third-party code on the web to reuse in his projects. Good for him. His attitude seems to be though, that if he does it, it must be the Right Way, and therefore everyone should do it.

  116. Balmer Says, "OpenOffice," Forgets Dot Org by Anonymous Coward · · Score: 0
    Who caught that news on MSFT with Balmer speaking at length about OpenOffice? Let the sequencing commence.

    Anyway, the difference between C and Pascal has always been about how easy it is to trap array out-of-bounds conditions, which has to do with what the MMU can do, which these days I think the important part is out of patent.

    Perhaps after the courts give them another go, the bug fix rate will go up.

  117. ummm by geekoid · · Score: 1

    How many 3rd party components are sold?

    right there is reuse

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  118. more often than not by Anonymous Coward · · Score: 0

    the people making the decisions barely understand the problem and more often than not are trying to solve the wrong problem. Great architects are few and far between and most programmer suck. I put myself in the "I suck a lot of time" category, and manage to not suck on a great day. What scares me most is when I start a consulting gig and 80% of the people there suck twice as much as me. That makes me think, maybe I'm getting decent at this. Then I slap myself upside the head and remember how much I don't know.

  119. Like the Paradox of the Active User by atabotix · · Score: 1
    This in part sounds like the "Paradox of the Active User" which sort of simplifies to 'noone wants to read the manual'... http://www.useit.com/alertbox/activeuserparadox.ht ml

    http://www.cs.vt.edu/~rosson/papers/paradox.pdf

    --
    Problems worthy of attack prove their worth by hitting back.
  120. So, you are now a Python lover or what ? :) by Anonymous Coward · · Score: 0

    hmmmmmmmm

  121. Processors==fast & Memory==free by hacksoncode · · Score: 1
    The complaints about bloat and slowness are perhaps relevant if you're writing a video driver or an embedded system.

    Anyone writing software for a living for PCs or equivilent should remember the subject line. Any software you write for this kind of platform will spend 90%+ of its useful lifetime running on machines that are at least twice as fast as the one you developed it on.

    Additionally, from a purely mercenary perspective, if we don't use up those cycles, no one will buy new computers, and Moore's law will succumb to apathy rather than technical limits (which I would consider to be a sad thing, both in the abstract and because a lot of us would be out of a job).

  122. only trivial programmers by Anonymous Coward · · Score: 0
    If your problem is trivial, it's faster to write your own code. If your problem is not that trivial, it takes a lot of time to try to understand someone else's non-trivial solution. More than it would take to write your own code.

    There are no trivial problems, only trivial programmers. ;-)

  123. Business-specific versus technology-specific by Anonymous Coward · · Score: 0

    Re-inventing the wheel often only occurs because no "wheel" presents itself pretty much immediately.

    Business-specific logic/code (get the objective done) can rarely be found already coded and available.

    Getting the objective done almost certainly requires interfacing with standard components. For instance, to make a graph you will author the code to populate the graph, but use perhaps the GD or imlib libraries and your chosen language's API to the library to draw it.

    There is a signficant difference that must be understood.

    I do however love it when a developer finds something available that fullfills his needs in a project.

  124. People DO re-use code, all the time... by NotQuiteReal · · Score: 1

    In my case, at this momement (don't trash me, I'm only making a living) I use LOTS of code - it comes in the form of the CLR (Microsoft .NET). In the past I have used lot of other code too, like the Java libraries, MFC, Win32 API, etc. etc.

    I mean, really, lots of the "trivial" stuff is handled by the libraries in your development environment of choice (or assigned to you).

    Stuff that isn't "trivial" is what developers are being paid to do!

    Any current software engineer has to admit that the tools available today are much better than they were 10 years ago.

    Hey, I may be using VS.NET, but I still use vi and various cygwin tools on a daily basis. Whatever works.

    --
    This issue is a bit more complicated than you think.
  125. Re:legal issues by Suidae · · Score: 1

    As a professional Delphi programmer (also since the 16 bit betas), and a hobbiest with programming of microcontrollers, I'd have to agree that as a general purpose language, Delphi falls way short. Obviously because its not intended to be one.

    Its damn hard to beat if you are writing a buisness application though, particularly with the addition of Boldsoft's model driven design and ModelMaker.

    I'd sure hate to have to use it for some of the things C/C++ is particularly good for.

  126. Re:Library bloat (XML) by pfafrich · · Score: 1
    I've found a big bloat problem with using the expat xml parser. Its basically doubling the size of my C programs. With a coresponding increase in size of downloads. I'm only doing a very simple parsing job, and I don't need most of the functionality.

    For a job like it might be better to write my own parser, only a couple of hundred lines, than use expat. It would also have been easier than using the expat code. Heck the code for the interface to with expat is more that just writing the parser from scratch.

    --
    There are four sorts of people in the world: fools, lunatics, idiots and morons. - Umberto Eco, Foucaut's pendulum.
  127. Fear. by nurb432 · · Score: 3, Interesting

    Simple, a lot of coders are afraid of being sued later on.

    Or get caught in some strange license restriction they didnt understand. Since few coders are lawyers its easy to quickly 'get into trouble'.

    Not many things worse then having your work ( or your job if you are a captive coder ) deemed useless due to an 'oversight'.

    While it sounds simple, with the current state of affairs in the world ( example SCO ), for some its just not worth the liability risk.

    --
    ---- Booth was a patriot ----
  128. Conceptual Misalignment. by ThreeToe · · Score: 2, Insightful
    As others have said, library quality is an issue: very few reusable libraries are as mature as (for example) Berkeley DB.

    But even after I've located a mature library, I still feel those jitters that make me want to do things myself. Why? Because my concept of how the problem should be solved, and how the solution should be exposed, rarely aligns well with how the library author exposed it. More importantly, I typically have a pre-conceived notion of how i'll use the exposed solution to build my software.

    When I reach this point, I step back and take a deep breath. If I'm looking at a mature library, chances are the conceptual misalignment stems from the fact that the library author understands the problem space far better than I do.

    Berkeley DB provides a good example of a difficult problem space exposed intelligently. Shortly after the jitters, I realized that my understanding of databases was sorely lacking; diving into the documentation helped me understand how to structure my thinking about my application's design.

    In summary: I think that developers turn back in disgust from new APIs because the API factoring doesn't match the developers' pre-conceived notions.

  129. Re:legal issues by Anonymous Coward · · Score: 2, Insightful

    gimmie a break. Delphi is a desert wasteland of resources compared to C/C++. Delphi isn't even a language, its a product. Borland itself has re-invented more wheels that I can shake a stick at, with their endless wrappers for the Win32 API, COM, ORBs, DB connectivity, etc. The *NIX world is a long standing example of code reuse in both C and C++. Check out the STL, Xlibs, etc.

  130. Different kinds of code reuse by vadim_t · · Score: 1

    There's code reuse of the small stuff. Say, if you're coding VB you'll soon have a big library of nice stuff that should have been there in the first place. I have functions like Limit, FirstWord, Capitalize, an object that can do logging to a file, database or anything else, etc. All that is small stuff on its own, but adds up after a while. Using another developer's stuff is also problematic. When you write a function you have some idea of what might go wrong in it. If using somebody else's code you'll often blame yourself first, and only after that look at the library. And there's integration. My library uses this logger object, so that I get messages about possible bugs in the program's log.

    Then there's the big stuff you've *got* to reuse, or you'd die of boredom or never finish it. Things like big Windows controls, spreadsheet control, fancy toolbar/statusbar control, installer, etc. In these cases reuse is a very good idea, especially if you're using a stable product that's been well tested. Then of course there's always the evil component that worked for 99% of what you needed, is used in a lot of places in your program and absolutely refuses to do the remaining 1% right. With enough time it can be much more satisfying to roll your own.

  131. Re:legal issues by Anonymous Coward · · Score: 2, Funny

    here here!

    and if you can't shoot your foot off (C) how are you going to blow your whole leg off (C++).

    And if you can't think of a good reason to do that... well, I think the phrase girly-man was invoked!!

    -C++ Troll

  132. It's because they're not wheels by Anonymous Coward · · Score: 0

    In my experience, it's because the software in question are not wheels. The wheels for most applications are the user interface library (GUI, server pages), DBMS, messaging system (queuing), naming service, document processing (such as XML), and remote procedure call infrastructure. How many people write those from scratch?

    There is also an issue with knowing how the thing works and the ability to fix it quickly. I'm the one that's going to get paged at 3am, so I want to either be able to find the problem quickly and fix it or get someone on the phone at any hour that can do it. It only takes one crap outside library to really make my life hell. I'll stick with solid technology from well established companies and then write the rest. The extra development time pays off many times over in aspirin.

  133. Someone should apply this to other fields by sien · · Score: 2, Insightful
    Sheesh, I mean the Wright Brothers invented flying fixed wing aircraft about 100 years ago and I hear Boeing and others keep reinventing this.


    Just don't get me started on Pirelli or Michelin.

  134. Microsoft: Great Code Reuse by MyHair · · Score: 2, Funny

    Some of the best code reuse I've seen is in Microsoft products. On my Win2k PC I have about 20 copies of 5 different versions of MSVCRT*.DLL. Previous versions of Windows had similar reuse of VBRUN*.DLL.

  135. Re:legal issues by Sentry21 · · Score: 1

    if you develop for a company, you do not have the choice, you have to re-invent the weel (or hide it from your superior and legal teams).

    Not to mention SCO.

    --Dan

  136. I dont' see that much of this... by JudasBlue · · Score: 1

    I don't know about everyone else, but in the last 20 years I personally feel that ignoring established libraries and "gotta code it myself" thinking has dropped dramatically.

    I was talking to a coder in my building who works in an all Java shop and his love of the language was specifically based around the large number included and pretested libraries in Sun's Java. Some of those libarary implementations I don't particularly like, but I see the guy's point.

    Perl and Python, in different ways, are both creatures of their libaries. There are good things about both languages themselves, but CPAN is obviously one of the strongest things Perl has going for it, and Python's "Batteries Included" slogan is famous to any Pythonistas out there.

    And using Visual Basic (*shudder*) is almost entirely a process of linking up premade objects.

    Today, I see much more use of predefined libraries than there was in the infancy of widespread computing. How many people here have coded their own window managment lately? And while I know people still do their own, I am seeing a lot more off the shelf work in graphics as well. I haven't had to code my own 2d low to midlevel stuff in a long, long time. The various Canvas objects of the world are well optimized at this point and work well. And even for 3d work, much, much less coding by hand is necessary than just 6 years ago. I know game coders who are working with DirectX straight up, and not even tweeking the low level stuff anymore.

    I think that some coders are lazy and they don't keep up with what is out there to help them with their projects as much as they could. I mean, I go through Fred Lund's python links every week, because I use Py more than anything else and want to know what is out there that will do me good. And I could spend a lot more time on this for other languages I know but use less frequently. Most of us probably could. But that doesn't change that my experience personally appears to be the general case, and coders as a class are relying on more prepackaged libraries as a group than ever before, and this trend doesn't look like it is going to stop anytime soon.

    Look at the last three major langauges to hit my personal radar (there have been tons, I know, but I am just talking about the ones I have started using the most in the last decade), Java, Perl and Python. What do all have in common? Relatively large and useful included libraries (CPAN might as well be thought of as included in Perl).

    Another poster pointed out that you can also look at patterns as filling this hole in some ways. Which I agree with. Who can't get by in production code today without at least understanding a few patterns?

    So I am not really seeing the issue as clearly as the article suggests. I am seeing just the opposite.

    --

    7. What we cannot speak about we must pass over in silence.

    1. Re:I dont' see that much of this... by Anonymous Coward · · Score: 0

      Fuck python.
      It uses more of other peoples crap code than
      it uses it's own OO imitation garbage.

      Indentation as a syntax ruler?

      GMAFB.

  137. MOD PARENT UP! by whatthef*ck · · Score: 1

    The guy nailed it.

  138. Skill Sets by fgb · · Score: 1

    For me, the decision of whether to reuse or reinvent depends on the level of expertise and/or interest I have in a particular area.

    e.g. If a problem involves text parsing or indexing I will usually code from scratch to get an optimal solution. If I need general-purpose compression, I grab the zlib library without giving it a second thought. My projects tend to be a mix of reuse and reinvent.

    Of course whether I'm doing a project for myself or for a client is also a factor.

  139. learning to read? by technoCon · · Score: 4, Insightful

    when programmers are taught to a computer language, we're taught to write. When everybody else is taught any other kinda language, they're taught to read. If I learn Russian, I'll read great literature.

    Trouble is twofold.
    1) we con't have a corpus of great computer code we can show folks howto read.

    2) reading code is most often associated with Maintenance and maintenance programmers aren't highly regarded.

    call it NIH.

  140. Use it, get sued. See SCO by BoomerSooner · · Score: 1

    If you don't agree to the license, etc...

  141. CPAN by Anonymous Coward · · Score: 0

    I don't have any problems at all with code re-use, I use CPAN extensively.

    In fact I use more modules than most people I work with -- WAY more. The longer I code, the more modules I tend to use and the more I add to my repetoire. The code I wrote a few years ago goes from 100's of lines to 50, then 10 on a regular basis. Its not uncommon for me to bring 2000 line 1 year-old applications down to 100 to 200 lines of code.

    Is my code slower than others I know who roll their own, or stay away from modules? No way. Not in the slightest. In fact my code is the fastest of anyone in my company by a long shot. I'm usually brought in to optimize another programmer's work, and almost always succeed in doing it with less effort and more modular code than they originally used.

    My secret? I use my time more wisely. The one thing I have on the other programmers is that I value my time intensely.
    I'm certainly not smarter or more talented. I'm just lazier.

    The difference is I have the time to look for the big speed increases; the over-all redesigns that will net 20, 30 or even a 50% increase in speed across the board. I don't spend my time trying to get that extra 2% quicker response time until the end, when it usually isn't even necessary.

  142. Generating charts by crucini · · Score: 1

    You probably know this already, and it's water under the bridge, but the Perl module GD::Graph does a nice job of this.

  143. Dangers of the GPL by duck_prime · · Score: 1
    Tout it all you want, but look closely at all those perl modules and c libraries around. Most of them are under the GPL.
    This is indeed a danger (read "consequence" if you will) of the GPL ... it is creating a separate "public domain" which never feeds back into the orginal public domain as we know it today.

    That is why the really successful GPL creations are relatively monolithic and generic: Linux, Apache & the like can be deployed as-is as a backdrop for what you're really trying to do. It's much harder to take someone else's utility class (*koffkoff* readline *koffkoff*) if it is GPL.

    Note: the lots-of-little-programs approach of Linux does dovetail nicely with GPL tools, hence: host> cat | grep | awk | myprogram | ... | mail | ...
  144. Re:legal issues by Anonymous Coward · · Score: 0

    I develop in Delphi and I use a lot of stuff from the net (if you want to learn how to create reusable components, and use already made components, this is THE development environment, and there is even a free linnux version! and it is PAscal, not this joke of a language called C or C++).

    I'm amazed this guy wasn't modded Flamebait 10 seconds after hitting Submit. WTF! Haha.

    Delphi's pretty good, but it's dying. Too bad. I'll stick with open languages, so my products don't get shitcanned when Borland doesn't feel like fixing or supporting something.

  145. Re:Joel on Leaky! by Leeji · · Score: 1

    You could apply many of the ideas in his article to the concept of code reuse. However, he is far from making the recommendation that we toss abstractions completely.

    Do you care to rewrite IE/Mozilla so you don't have to deal with its internals? Do you care to rewrite your TCL/C#/MFC application in native API calls so you don't have to deal with its internals? If you do, then you're doing yourself a disservice. Rewriting those abstractions to avoid the internals means you'll be neck-deep in them.

    --
    It all goes downhill from first post ...
  146. My opinions by Tomster · · Score: 2, Insightful

    Lots of good thoughts expressed already. Here's my list of reasons we don't reduce, reuse, recycle code well:

    1. It goes against the unwritten rule of "elegance". Using someone else's code often means it just doesn't fit quite right into your program. We'd rather write our own solution that fits "perfectly" into our program than find and use someone else's solution that isn't quite perfect.

    2. Trust. If I'm going to use someone else's code, can I trust that it is (relatively) bug-free? Can I trust that it does what it says it'll do? Without unseemly side effects?

    3. It's more fun to write code than to search for code.

    4. Hubris: I can do it better.

    5. I know I can write my own solution. I don't know that I can find another solution, and that if I do it will work well enough for me (or won't require extensive modifications) and there won't be some other issue with it that will keep me from being able to use it. In short, I know I can develop a solution in n time... but if I spend time looking for and integrating another solution it's a crapshoot -- I might spend n/10 time or 10*n time.

    Now let's look at some cases where reuse is working:

    - Standard libraries. Popular languages come with a fairly large library of standard code. Reuse works here because (1) there's usually little/no choice and (2) being a standard library, there is a degree of trust given to it that is not granted other code.

    - Popular add-on packages. Whether it's Log4J, a CPAN module, or a well-used bit of Javascript. Reuse works here because of trust: if lots of people are using it, it must be good.

    - Really complicated things. Regex. Who wants to write regex code? Reuse works here because of the belief that you /can't/ do it better than has already been done.

    - Really big things. Graphics libraries. Reuse works here because at some point a job becomes too large to tackle, compared to finding and using an existing solution -- even if the existing solution stinks.

    In short, in order for code to be reused, it must be findable, usable, trustable, and valuable. The last meaning the time/effort spent in finding and learning existing code will be less than the time/effort spent coding a new solution.

    That's 2c off the top of my head, I'm sure I can do better but it's late and I'm tired and I'm going to bed shortly.

    -Thomas

  147. Less Simple explanation by Not+The+Real+Me · · Score: 1

    Any one who's tried to re-use someone else's code will probably have to kludge their software to interface with someone else's. I've lost track of the number of times I tried to use CPAN modules only to throw them out because who ever wrote appeared to be a high school drop out with a serious logic deficiency.

    However, that's Perl. C++, on the other hand, tends to be much cleaner, and doesn't suffer from Perl's version of Windoze DLL hell.

  148. Your sig: by Anonymous Coward · · Score: 0

    Wank wank wank.

  149. Standard libraries == first source of reuse by felix9x · · Score: 1

    Lets not overlook the importance of standard libraries. Now i cant speak for other languages but for C/C++. Those have a very well documented set of standard libraries.

    In C yes not much there but still nobody would be crazy enough to rewrite something like fprintf

    In C++ the picture gets even better. The C++ standard library is great piece of very good reusable interfaces. Here I present a simple case:

    Lets take a somewhat simple algorithm like reverse, Essentialy the algorithm reverses all elements in a container using two iterators the begin and end. In terms of C we can thing of a pointer as being an iterator.

    Now if you were a C guy you probably roll your own and probably produce something resonable enough that uses some pointer arithmatic etc.. You version will work fine.

    Now lets consider what you get in C++

    A mindless C++ programer just writes and does not give much more thought.
    reverse(v.begin(), v.end());

    Nevermind who has demonstarted more virtuoso pointer arithmatic skills. Who has actualy produced the better code? Surprisingly enough it is the C++ programer. Here is the reason why.

    The C++ STL library has something called iterator traits which let the writers of the library write three different versions of the reverse algorithm depending on the type of the iterators used. The selection of which implementation is actualy used gets decided at compile time. Because say an array was used and random access was possible this opened up this algorithm for all kinds of possible optimizations.

    Depending on how good the writers of the library were they may have went to great length to optimize this algorithm which in reality they realy did. You can look at the implementation included with gcc yourself. Surprisingly enough the actualy implementation uses loop unrolling to achive the needed efficiency which the user of the code probably had no clue about.

    I think everybody wins here. The user of the library who had very simple interface and ease of use in addition to a very efficient code that required limited effort.

  150. Re:legal issues by senahj · · Score: 1

    > and it is PAscal, not this joke of a language called C or C++).

    Real Programmers Don't Use Pascal

    --
    Wait a minute. Didn't I say that on the other side of the record? I'd better check ...
  151. Reuse? Fine in theory, fails in practise by nathanh · · Score: 1

    I love reusable code. Thanks to CPAN I can mockup incredibly functional scripts without ever needing to know the details of a protocol. I love linking against libssl or libpng and not needing to know or care what TLS is or what RLE means. It's great.

    But when I write code for a living it's never that easy. The problem is that most libraries cost money (in the areas I work in) and, even worse, they cost a LOT of money. If you use libraries to do the bulk of your work then you can find a product costing upwards of $500 just in licensing fees; that's before you add your own costs and profits on top. It's no wonder that so many people reinvent the wheel; it's because you can't just buy the wheel, you have to pay licensing fees everytime you use it. It's just not economical to reuse code in the "real world".

    That is, unless you write open source. This is where reusable code really is working. I can ldd any binary on my system and find incredible levels of code reuse. Evolution (the mail client) links against 50+ libraries. That's great!

    I think attempts in the past to encourage code reuse fell flat because they focussed on the technical problems and not the legal or economic problems. Open source changes all of that. So there's hope yet for reusable code.

  152. A really good repository would help by icanoop · · Score: 1

    Of course there is no perfect solution, but a really good repository would help developers reuse free software.

    If I could go to a single place and search a large database of open software components easily, I would be more inclined to reuse fee software. Sourceforge or the Gnu free software directory do not do this well. I need much more than just a name and short description and I don't have time to spend weeks trying different halfway completed projects every time I want to reuse something.

    I would like to see something that is actually useful. For example, the repository should include design and implementation information for each component, as well as complete test results and profiling results. And I should be able to search based on all that and more. Basically, it should make the search as painless and accurate as possible. It should also be managed so that the only correct information is allowed.

    I am working on a project called Hoot that aims at centralizing and standardizing open software process and engineering. A repository like this is one of the goals. Not much has been accomplished yet, mostly due to poor leadership ;). If you want to help join the dev list.

  153. But sometimes there is stuff to read... by Teancum · · Score: 1
    Growing up "in the good 'ol days of computers", source code was more the normal way of distributing software. The thought that you couldn't tweak for local use any software was unheard of back then.

    The legacy of this was when the IBM-PC was first released, there was still a BASIC compiler that was distributed with MS-DOS 1.0 (or PC-DOS as it was also called). The thought that you would EVER sell a computer without a compiler or interpreter was completely unheard of. Source code was provides for at least some software (even if it wasn't the entire OS).

    Contrast that to now where if you go to WalMart (or your favorite discount general merchandise store) for a $500 PC, you can get all kinds of software, more games than you can shake a stick at (several isles). I dare you to find a compiler being sold in one of these stores (with the notable exception of GCC, being sold with Linux distros). Specialty computer stores are much more likely to have compilers for sale, but even these are dusty back shelf items. You'ld be lucky to find a current version. University bookstores are a little more likely to find one for sale, especially if the school has a strong CS program.

    I guess what I'm saying is that with commercial software distributions doing binary only releases, it is almost impossible to get source code to even read.

    Some of the best algorithms I found on my own reading other people's software and picked up some really good programming habits that I still have today. Some of the best gems I saw were in assembly (which is a dying art today unfortunately).

    Current experience with working with source code would be some intern that is given 100,000 lines of code to debug because some programmer left a really buggy bunch of software that still doesn't do what the customer wanted. The original developer left (died, was fired, found greener pastures) and now you (as this fresh intern) have to figure out what is wrong and try to fix the bugs.

    Unfortunately this is the worst possible experience for a young programmer to have to deal with because:

    1. The programmer was very sloppy in the first place (probabally) and this is a bunch of kludgy code anyway.
    2. There are few, if any comments saying what different parts of the software did
    3. The reason this is being dumped on the intern is because the full-time programmers really have much better things to do than try to fix the ugly mess that every knows this software really is anyway.


    If the software were clean and well-documented, it would be easy to fix and the intern would never see it.

    Unfortunately, this way the intern learns how to write ugly code (because that is all they have been exposed to) and they are striken with perpetuating this same problem.

    Fortunately, with the open source movement this is something that can be fixed for the industry in general. There is now a huge body of software that certainly can be used in educational settings, and it would be wise for a compiler class to dissect the internals of a GPL'd compiler, for example. This is the corpus of software needed to do this job right.

    I'd also say that 90% to 99% of all software development is maintaining an existing software base. You may be allowed a "fresh clean sheet" to reimplement existing software in a new platform on rare occasions, but mostly it is tweaking existing software, usually to add a new feature or finish a promised feature that was stubbed in earlier.
  154. Delphi Components by cruachan · · Score: 1

    Commonly overlooked in this kind of c/c++/perl focused discussion, but delphi's component model has been in operation ever since Delphi 1 back in the 90's, and has produced a most successful mix of freeware, shareware and commercial components easily and simply plugged into the development environment. Torry.net gives a good flavour (http://www.torry.net/). Also the Project Jedi code (http://www.delphi-jedi.org/) is now an effective extension to Delphi itself.

  155. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  156. Not for well designed objects by samael · · Score: 1

    I had a program that needed to zip and unzip files. I could have gone away and researched the ZIP format, or I could simply use a ZIP object that was available. 5 minutes after downloading it, I was happily setting two properties of the object and calling the "unzip" method, and it just worked.

    I hate to think how much work it would have taken to rewrite that from scratch.

    The same thing happened with an image display addition to a property program I worked on. I could have written code to display 30-odd file-types, but there happened to be an object that did it already, worked perfectly and took less than an hour to get working.

    Why would I spend all that time working on something I didn't have to?

  157. Reminds of someone I used to work with... by maddogdelta · · Score: 1

    Mark Fisher reminds me of someone I worked with. He is brilliant with computers, and before I saw him code, I believed that he was supernatural. Then he told me his theory on programming (which someone coined as 'Mayer's first law...'
    "Steal what you can, write what only you have to..."

    In case RIAA is spying on me, what he meant by 'steal' was to check all available PD/GNU/Published Code sources. If something was close enough, use it. He put together some amazing projects in a very short amount of time that way.

    --
    -- There are 10 kinds of people in the world, those who understand binary and those who don't.
  158. Most are Code-Monkeys by ClubStew · · Score: 1

    I find that a lot of the people I've interviewed, people I work with, and people that read my articles on codeproject are just too damn lazy to read the documentation. Researching is what being a developer is about. Anyone can write code! Problem solving requires a certain amount of research or knowing whats available so you don't have to reinvent the wheel.

    Granted, as some people have pointed out, canned solutions don't always fit or changing cryptic code - see, now that you know what the other end feels like, COMMENT YOUR SOURCE - isn't the best solution. That's understandable.

    But a lot of it are these get-lots-of-money-quick-by-getting-a-career-in-com puters tech-school grads, formerly McDonald's employees. They're taught a trade, not a skill. A few might have it in them and truly be interesed enough to research more, but not many. Even university students - who are generally taught to learn or a problem-solving mindset - sometimes don't realize that class will not teach you the practical stuff you need to know - you have to do that on your own time. Heck, a few of my old professors hardly knew what they were talking about because they haven't been out in the real world since they graduated with Ph.D.s!

  159. Code re-use by dwsauder · · Score: 1
    There are some examples of wild success with reuse... though they seem to me to be more success though definition. All of those shell scripts that are built from individual command line tools are examples of reuse, where each command line tool represents a unit of software available for reuse. But, I think we all think of reuse more at the code module level... a function, or class, or small library. And it is at this level that I think we fail miserably, and it is my contention that we fail because we can't easily find the candidates for reuse.

    Software applications today are more complex than ever. They can only continue to become more complex if there is significant code reuse. In fact, there is more code reuse today than ever before. The code that is reused is not necessary at the level of libraries, but at a much larger scale. The best examples of code reuse:

    • Relational database systems for data storage
    • Web servers as a hosting environment for server applications
    • Web browsers as a hosting environment for client applications
    • Operating systems (considered in the broad sense of a collection of APIs available to all developers)
  160. Belaboring An Old Saw by panda · · Score: 1

    I'm reminded of something I heard a few years ago on this subject: "Good programmers write good code, great programmers steal it."

    The point the person was trying to make was that good programmers will sit at their computer for a week reinventing wheel, while a great programmer will spend a couple hours finding where someone has already invented the wheel and then adapting that wheel to their project.

    In my experience as a professional programmer, it has always been faster to find someone else's code that does what I want and to adapt that code to my project. I've very rarely ever felt the urge to reinvent the wheel. It cuts into my productivity and is a waste of time if I can find something that already works for me.

    It usually takes much less time to write a couple wrapper functions or an adaptor object interface to integrate a 3rd party library into your code than it does to duplicate the functionality of that library.

    Too many programmers and too many shops suffer from "not invented here" syndrome, i.e. they refuse to use code that they didn't write.

    --
    Just be sure to wear the gold uniform when you beam down -- you know what happens when you wear the red one.
  161. Learning Curve by chaoticset · · Score: 1

    Perhaps because you cannot learn how to make new wheels until you've made a few old ones?

    --

    -----------------------
    You are what you think.
  162. Make progress, build on foundations by darango · · Score: 2, Informative

    I've been writing code professionally for years and now I lead others in system integration and software development.

    I see new folks coming in and wasting so much time rolling their own stuff, it just kills me. The cool thing is not to build what others have already built. The cool thing is to make progress, build on what others have built, and provide users with something they can use.

    Guess what guys, users don't care if your linked list code is better than anyone else's. Users want things to work. If you can spend more time concentrating on that, and less time finding and fixing the same bugs another guy dealt with two years ago, you will be doing more for users.

    Guess what else. Nothing we do is perfect. That spiffy library you get from the net to solve a problem will have bugs. If you write your own, you'll have a different set of bugs.

    I think too many new developers have not developed sufficient troubleshooting skills when they were learning their trade. They only know how to fix stuff they wrote because they can't get their heads around how someone else does things. I value the hardware and embedded systems work I've done because it taught me troubleshooting skills I use every day.

    I can truss or trace someone elses executable binary and give the vendors / developers clues on how to fix their code without ever seeing the source code. How? Because I've developed an intuitive approach to problem solving based on the simple notion that programmers are lazy and they tend to solve similar problems in the same way. Patters are useful whether they are formal or intuitive and they are useful when developing and debugging.

    When my engineers want to use a new technology in our development, I grill them very hard to determine whether they are choosing the technology just 'cause its cool and they want to learn something, or because it will actually bring some value to the product being developed. I'm all for my engineers learning new things, but I don't want them to write a lot of bad code while they figure it out. If they want to use a new technology, I prefer they re-use libs or code that an experience developer in that technology has already built. I think people should try to learn from others examples, and then innovate after achieving basic competency.

  163. Learn to share the sandbox, now.... by Anonymous Coward · · Score: 0
    Well now that just sounds like the perfect attitude to have if you want other, more cooperative levels of society to exploit you in isolation.

    Once upon a time, single cell life ruled. " How do I know that you do the function you say you do? How do I know that you will deliver the nutrients that I need? That you will deliver them on time? I don't, so it is better to do it all myself."

    Forunately for us, they figured it out....

  164. Delphi compile speed by Latent+Heat · · Score: 1
    There is one count on which Delphi can't be touched by any other compiled language/IDE, even Borland's own C++ builder. Delphi compiles and links faster than anything else on the planet that is not interpreted. It even compiles faster than C# .NET.

    I think that part of the reason for that is that Pascal is the RISC of languages -- it was developed as a "teaching language", but it seems that it was also developed to make writing compilers for it very easy -- the declarations have to be in front so the thing lends itself to a one-pass parser. There must be also some good engineering in the Borland implementation that makes it fast even for Pascals.

    Apart from operator overloading and the STL, C++ and Delphi are pretty much equivalent and mappable one into the other -- witness C++ Builder doing pretty much the same thing as Delphi, only compiling slower. I write to the Windows API using my own Delphi classes without using VCL or MFC (produces very lean programs), and I do pretty much the exact thing in C++.

    I do have to admit that Pascal syntax has lost out to C syntax (witness C#, Java and to a degree, Perl). Pascal syntax was obsolete even in its day (the clunky requirements on begin-end blocks with if statements that were reformed in Modula and Ada). But Delphi, which had modules, classes, a reference-counted long-length string type, function overloading, and reference-counted interfaces with support for UIID's grafted on to it, soldiers on while Modula and Ada (meant to be extensions to Pascal done "the right way") have become largely historical footnotes.

    1. Re:Delphi compile speed by Anonymous Coward · · Score: 0

      Making the code more difficult (slower!) to write so that the compiler will be faster is ridiculous. Unless your team does "programming" by making a one-line change every five minutes hoping to hit on the right one at random, nightly builds are plenty. And if they insist on using a debugger as a substitute for thinking, VC++ can incrementally recompile one function while the program is running....

  165. The oil interface by Latent+Heat · · Score: 1
    Because oil has a very simple interface. Sure, it may take lots of chemical engineering to make a conforming oil, but what it has to do is very simple -- it needs to stay liquid, to keep dirt and water and other contaminents in suspension, and to be slippery at the temperatures, pressures, and film thicknesses in the engine.

    It does not have remember the sequence of charging and discharging of your alternator and then turn off the trunk light when the battery is low. Oil can be mixed with other oil -- I can throw in a can of Shell oil with a crankcase full of Quaker state without doing serious engine damage.

  166. Reuse at different levels by Latent+Heat · · Score: 1
    I remember talking to an IBM dude who lectured at the university about how they built one of their mid-range systems as a byte-code interpreter layered on top of a Power PC chip and how OO figured prominently in the effort.

    I complained to him about OO, specifically about the clunkiness of massive GUI frameworks such as VCL and MFC. Since then I have been on a little friendlier terms with VCL, but it is still a massive wad that bloats programs, but hey, memory is cheap. He sympathized with my take on reuse issues of general-purpose massive application frameworks, but argued that for in-house projects at IBM, the reuse can be strong.

    A programmer can develop good reuse of their own stuff in their own projects, a small group can do some reuse depending on how well they document and communicate, and working the way up the chain the reuse may be more limited.

    Clement Szyperski has a good discussion in Component Software on the dream of widespread reuse and some of the obstacles to achieving it. Following his discussion, the best success of top-level (commercial, between organizations) reuse is at the operating system level (who anymore tries to roll their own window manager as in the days when we tried to write GUI programs in DOS). The next level is in terms of language features, libraries, and stuff like the STL. The level after that is third party components, of which he mentions that Visual Basic has developed a market but few other systems have succeeded at the level of widespread sale of software components.

    So we are making some progress towards software reuse, using OO and other techniques, but the progress is slow in coming because people are still figuring out what works, but we are getting there.

  167. Version problem with Delphi components by Latent+Heat · · Score: 1
    Delphi components points out one of the hangups of third party approaches.

    An ActiveX component is pretty much an ActiveX component (and yes, I have used Delphi to produce and consume them). Say what you will about Microsoft, but they try not to break their own stuff, and you can develop an ActiveX under Windows 95 and use it under Windows XP.

    A VCL component in many ways is better than an ActiveX -- it is a class, not a walled-off COM component, so you can extend it with inheritance. In addition, you can link it up to other components by setting property values to point to other VCL components in the Object Inspector (you can link up ActiveX components, but you have to do it programmatically at run time). This linking up of components is not perhaps as widely used as it could, in part because you have to override the virtual Notification method to handle the connection and disconnection of components without crashing your component in the Designer, but the capability is there and is very useful.

    Where VCL components become a PITA is that they are specific to Delphi version. You either tell people that your components only work with Delphi 7 and when Delphi 8 comes out they have to upgrade your component, or you have to have a collection of old Delphi's to come up with versions of your components for, say, Delphi's 3-7.

    Also, ActiveX components have a simple deployment process -- one or more .OCX files and invoke regsvr32 if you want to install them by hand. I write my Delphi stuff using a separate .pas file for each class when this is practical, so any VCL component I generate has a wad of .DCU files that need to be distributed. There is probably a way to wad the .DCU files together that you can tell me about, but you know what I am talking about.

    Anders Hejlsberg and Microsoft teamed up to try to get this right with .NET assemblies. An assembly is a .DLL file like and OCX, you can wad up an entire class framework in a single assembly, and you have the option of installing an assembly globaly or only using it privately one application at a time. Oh, and you can extend classes from inside an assembly by proper OO inheritance, and .NET components can be hooked up to other .NET components by setting properties to component references in the Designer just like with the VCL.

    Trouble is .NET is kind of slow in being pushed out to end users -- even if you buy a computer with XP installed, you have to install the .NET runtime separately. While the transition to Windows 95 API was a "big bang" in that Microsoft really pushed the upgrade to consumers and for developers to target the Win32 API, the transition to .NET is being pursued rather cautiously, and Microsoft doesn't seem to be pushing .NET as a platform for shrink-wrapped software at least quite yet.

    1. Re:Version problem with Delphi components by Anonymous Coward · · Score: 0
      regsvr32 is deprecated in favor of storing the same registry values via MSI.

      .NET inheritance is crippled, even though they'd seen MI work in both Eiffel and C++.

  168. Re:Because developers don't play well with others. by TeamSPAM · · Score: 1

    Some days I don't play well with others is because I don't want to get burned by the other developers. My example is we used WebObjects to develop a couple products. The developers were generally split into two groups and we generaly chunked things out into WebObject frameworks. My product had need to talk to a database that the other group had developed a framework for and I pluged it into my product. A couple months later my product won't compile any more and is complaining about a class I've never heard of. Tracked it down to the framework I got from the other group. They needed some new functionality and did a code refactor, which I would have been fine with, but the database model now made use of a class in another framework. I didn't have need of the new framework and did not want to incur another dependicy and whatever dependices it had. So I ended up copy what I needed and forking the code cuase there was no way I could convince a developer in the other group that classes needed to be moved. It also seemded like everytime we thought there was overlap, the code was useless because of the dependencies that added no benifit to my product.

    --
    Brought to you by Team SPAM! where we believe: "Information in the noise!"
  169. Re:legal issues by Hellkitten · · Score: 1

    sooner or later a programmer gets good enough to stop shooting himself in the foot.

    Either that or they eventually die from bloodloss or infection

    --
    - We are the slashdot. Resistance is futile. Prepare to be moderated -
  170. Myths vs. Reality? by ChilyWily · · Score: 1

    I think code reuse is great but just like anything, it should not be used everywhere without understanding the long term side-effects. Where I work, we maintain and enhance 12-15 year old code. Barring a few areas that had to be totally revamped (due to trillions of bugs per line) almost all of the existing code architecture/structure has been maintained since the first time the software became "stable" - approx. 11-12 years ago.

    This has led to many issues that one would not expect to see in today's software development environment:

    • Fancy gymnastics to "workaround" legacy code:

      Much of the legacy code incorporated functionality that came along later (eg mutexes and semaphore locking/unlocking) but the original design was so intrusive to the rest of the code that now its impossible to work without pacifying code that doesn't do much than burn CPU cycles.

    • Excessively hard to incorporate newer libraries:

      The original designers worked with one set of rigid OO concepts (e.g., "all multiple-inheritance is evil so it must be eliminated and code added to make it impossible forever") - this makes it inordinately hard to coax code into the legacy design - most often the "I'll take the OO idea" wins over "this code would work with some work" simply because by the time all the mods are factored in, it is better to just re-write the stuff to accomodate the legacy base.

    • Damper on Creativity?

      There are some problems that are just best suited to custom solutions. In my experience, for work that has strict performance constraints, the custom solution often works the best - IMHO, researching existing algorithms is fine, using them as "the" solution is not. That is not to say that research should be totally ignored - often a good extension can be developed from reading someone else's experience, eventually one can create something new by oneself. But that process does not happen if one simply accepts the existing models/code as the be all end all.

  171. reinventing the wrong wheel badly.... by mulp · · Score: 2, Interesting

    I've seen a lot of cases where someone reinvented the wheel, but instead of using an axle, they just put the wheel under the object so you have to move the wheel to the front to keep going, and then to top it off, they made the wheel square or triangular.

    I did that once. In 1969 I needed a sort, so I looked in the fortran programming book I had and implemented a bubble sort, to sort records on disks. When it became clear that the sort would take a couple of months to complete, I started working on optimizations. As I was working for a college, one of the profs suggested that I take a look at the collected algorithms of the ACM. There I learned about quick sort and heap sort. I was able to incorporate those, but I had to deal with the fact that I had a lot of data on disk that I couldn't bring into memory. Eventually I got a sort working that wasn't too bad for the times and the computer resources.

    Then Knuth published Vol 3 which I studied with my experience in mind. I was amazed to see Knuth develop and analyze my progession of improvements and cite the authors and dates, all of which preceded my efforts by at least 5 years. I also noted that Knuth's statement that the common use of the bubble sort in programming texts was a great crime.

    Roll forward a five years and I join a group where a new backup utility has been released which sorts the blocks to be backed up, but there was some sort of stack overflow problem. But I was the new guy who wanted nothing to do with tapes and besides, the two engineers working on it were comp sci graduates and I was a college drop out.

    Roll forward another five years and a coworker had been stuck with this code which was still running into some sort of strange stack overflow problem. He's the polite, persistent nagger type, so I reluctantly agree to take a look at the code. In 15 minutes I realize that the code is quick sort, which then means that there is a serious bug in the code because its overflowing a 200 element stack (and if you don't know wny I knew there was a serious bug instantaniously, you MUST NEVER CODE ANY SORT). In the next 15 minutes I found 3 coding errors in the code, 1 was from the original fortran code, and 2 were from editing the fortran assembly to inline it into the module.

    If I have a problem that calls for a sort, I can reuse Knuth's research into sort algorithms, which reuses the work of others to create significant advance in the subject, I can reuse the algorithm coding by transliterating the MIXAL, I can find code in various languages from all sorts of sources (which I evaluate by reusing Knuth's methodology), I can call a binary library routine that I may or may not be able to see source code for, but whose bahavior I can check with rules of thumb reused from Knuth, and I can research new algorithms and possibly reuse after reusing Knuth's analysis to verify the claimed advantages.

    In my view, reuse is the obvious method to apply to any development process.

    As a mechanical designer, I would be foolish to fail to use standard nuts and bolts, and where that's not reasonable, foolish for failing to use standard conventions and standards for screw threads. A mechanical engineer works with dozens of references and hundreds of catalogs.

    For a programmer to fail to access reference materials and catalogs looking for existing components and art (craft) to reuse is idiotic.

    The problem is that there are few good references to draw on.

    The only reasonably comprehensive compendium of computer software algorithms I know of is in the 6-10 books that Knuth has published.

    I've opened a number of books where the title suggests a comprehensive listing of software algorithms or C++ objects, and been greatly disappointed at the lack of depth. These books are like going into the drug store or Sears to find the right nuts and bolts for a project. I was hoping for something closer to Home Depot which only scratches the surface of reusuable fastener technology.

    Softwa

  172. Open Implementation is the answer by voodoo1man · · Score: 1

    I see a lot of posts pointing out the infexibility of software objects/components and the need for custom "wheels." I think the former can largely be blamed on the direction modern, statically-compiled programming languages took in their use of data hiding and mandatory encapsulation as "abstractions." Kiczales' Open Implementation group at PARC showed that this actually inhibits code reuse by preventing the customization of "the wheel." Open Implementation is supported by reflection and some aspects of the Meta-Object Protocol (although in most cases this is total overkill), and this is the central idea behind Kiczales' current work in Aspect-Oriented Programming. But in practice, I find relatively simple things, like function advising (and more recently Costanza's dynamically scoped functions), and CLOS's before, after, and around methods are enough to take care of almost all customization problems that arise. Sometimes, breaking data hiding rules can also be useful.

    --

    In the great CONS chain of life, you can either be the CAR or be in the CDR.

  173. Dana Carvey's "Angry Old Man" by Latent+Heat · · Score: 1
    Why when I was your age, weeee didn't have those fancy-shmancy C++ compilers, IDE's, and PC's, we wrote out COBOL longhand and then typed the programs in ourselves using keypunch machines until our fingers bled, and we liked it!

    It is all a matter of what a person was trained on: I can whip out Pascal code a lot faster than C++ (all that keypunch practice means I can type out begin and end faster than you can select Shift and hunt for curly braces). Delphi Object Pascal is so extended from ANSI Pascal (string handling, C-style pointer/array syntax) that it is for the most part line-by-line mappable between C++ and back. And if you complain that Delphi lacks your favorite C++ features (templates, stack-allocated object instances, STL), lets just say C# is pretty much Delphi-with-C-syntax when you really look at it carefully, and C# has never evoked the opinion that it was particularly difficult to program in by C/C++ programmers.

    This business about how nightly builds are the only proper coding model and that anyone cycling through compile-link-run is hacking -- while I guess all the advocates of interactive/interpreted languages ranging from Lisp to BASIC to Perl to Python are all hackers. The Delphi compiler is that fast that it has many of the advantages of the interactive/interpreted languages while having compiled-language execution speed. There were people who once thought that time-sharing was bunk because if someone was too sloppy to use keypunch and batch runs, they were probably writing hacked up code.

    As to putting the brakes on language features to trade off for speed being stupid, it is only slow for you because you are used to prefix instead of postfix type declarations and don't have begin and end under your fingers. The opposite extreme of giving language features free reign and compiler considerations be damned is called Ada . . .

  174. Re:legal issues by Twylite · · Score: 1
    Delphi is by far superior to C++ when it's about creating a quick app with a nice GUI, combined from the insane amount of good ready-made components and samples, and some parts of proprietary code. Or when you work with e.g. anything combining SQL with a GUI, Delphi will be hard to beat. Or when you need to handle a ton of localized versions, which I have to for a current project.

    So then, better than C/C++ for just about any general application apart from specific-purpose high-performance and non-interactive apps...?

    --
    i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net