Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming IT Technology

How Mainstream Can Code Scavenging Go? 139

The time-honored tradition of code scavanging has long been a way for new programmers to "break in" to a new language or task that they may not want to build from the ground up. The re-use of old code, cleaned up and tweaked to a new purpose can help developers learn many useful skills and accomplish tasks quickly, especially for small tasks that aren't of vital importance. One blogger wondered if this process could be formalized and tools could be built to help foster and enable code scavanging on a mass level. Is this a viable option, or are there just too many things to consider?
This discussion has been archived. No new comments can be posted.

How Mainstream Can Code Scavenging Go?

Comments Filter:
  • IP Laws? (Score:4, Interesting)

    by gambit3 ( 463693 ) on Saturday December 01, 2007 @01:18AM (#21541585) Homepage Journal
    So, how quickly would you run afoul of Intellectual Property laws doing this?
  • Vernor Vinge (Score:5, Interesting)

    by boster ( 124383 ) on Saturday December 01, 2007 @01:25AM (#21541615)
    In A Deepness in the Sky, Vernor Vinge posited Programmer Archaeologists would replace all new development. http://everything2.com/index.pl?node_id=760521 [everything2.com]
  • Unlikely? (Score:4, Interesting)

    by SnoopJeDi ( 859765 ) <{snoopjedi} {at} {gmail.com}> on Saturday December 01, 2007 @01:47AM (#21541747)
    From TFA:

    You are unlikely to find what you want with a simple Web search


    Since..when? Recently I've picked up perl again, and I've found more than what I need to scavenge to make my own personal extensions to blosxom [blosxom.com] through google searches.

    I mean, granted, it depends on your definition of a bite-size task, but it's a blanket statement no matter which way you spin it.
  • Re:IP Laws? (Score:5, Interesting)

    by sootman ( 158191 ) on Saturday December 01, 2007 @01:56AM (#21541785) Homepage Journal
    They talk about a "formal approach to code scavenging" without even coming close to explaining what exactly that MEANS.

    Agreed. Reading TFS, I thought it was going to be yet another "we can make programming like Lego!" thing. (Which it ain't, and probably never will be. [joelonsoftware.com] Bonus reference: "Lego" is mentioned in the second paragraph of this article [wired.com] about Steve Jobs/NeXT/WebObjects from Wired. God bless Wired and their eternally fucked-up CMS that can't serve images for any story in the archive and, this week, shows the actual HTML code that should be formatting the Question-and-Answer portion of the article.)

    Reading TFA, I really don't know much more than I did before. This is the best I could come up with:

    Code scavenging is seen as the most frequent and least complex way of re-using code and has been common practice at an informal level since programming first began. Programming is difficult to teach and most programmers learn their chops by looking at working code and using it as the basis for building their own programs. In other words, they "scavenge" the good bits and tweak them to a new purpose.

    The term scavenging appears to have first surfaced as a formal concept in a 1992 paper by Charles Krueger of Carnegie Mellon University. It was tested by academics in the 1990s but rejected because it yielded few gains for a lot of effort.

    According to Hackett, code scavenging is worth re-visiting because the Web makes it easier to find code and re-use it. He points to sites where massive amounts of existing code are available for potential scavenging such as Google code search, Sourceforge, Code Project, Microsoft's Codeplex, and O'Reilly's Code Search. Others include the Free Software Foundation (FSF), FreeVBcode.com, Freecountry and Freshmeat.

    So, code scavenging is... um, re-use? Can anyone make better sense of that than I can?

    "In other words, they 'scavenge' the good bits and tweak them to a new purpose."

    Um, no. You scavenge the pieces you need, not necessarily the good bits. Have you ever been looking for some code to do parse phone numbers, and while looking at source, said "Hey! This looks like a great way to compare two lists!" Probably not. You're only looking for formatting code, so that's all you see, so that's all you get. Looking at source is not like looking at produce at the food store, where you can walk by the tomatoes and they catch your eye because they're perfectly ripe and really, really nice-looking.

    Rather than searching Google, I think every good programmer should take the time to create a really good library. I don't mean take the time writing great code, I mean take the time to organize it into a proper library: make one, clean, well-commented version; put things into variables, ($tableName in queries instead of the actual table name, etc.) and pull code from that when you need it, rather than just copying-and-pasting from the last place you remember using it and then changing all the variable names, table names, etc.

    I plan to make mine Real Soon Now. :-)

    >> So, how quickly would you run afoul of Intellectual Property laws doing this?

    > That's a great knee-jerk reaction.


    No, that's just the first thing that popped into his head. (Pardon me if I'm putting words in your mouth, Mr. Gambit.) With that one sentence, he did not say (or imply) "The only people who would use this are thieves." He just put out that question for people to discuss. That topic came up here just a couple days ago. [slashdot.org] I highly recommend reading that discussion. There are some very good points; among them, that if you publish something with no licensing info, it is copyrighted to you by default. (In the US at least,

  • by Anonymous Coward on Saturday December 01, 2007 @03:34AM (#21542161)
    well it's not that bad an idea. In my job I often have to come up with one-off shell scripts and whatnot. I have thought many times "this must have been done before, why am I doing it again"? The problem I have is, where does one look?

    I google and look through various scripts and stuff on linux boxes and can piece stuff together but by the time I do that I might as well have just written it. Often times I do after giving up. To have a place to pick through, even just for ideas, is not a bad thing at all. For the record I am an admin but not a programmer.
  • by James Youngman ( 3732 ) <jay&gnu,org> on Saturday December 01, 2007 @08:04AM (#21543061) Homepage
    ... of an SF book I read a few years ago, where all programs were written by a process of digging into 10,000 years' worth of computer programs in a sort of archaeological way, pulling out something that did more or less what you want and amalgamating it with what you had so far. I thought at first that it was a Vernor Vinge [wikipedia.org] book, but checking the plot summaries on wikipedia, it looks like it was somebody else. Can anybody remember the book I'm thinking of?

"Gravitation cannot be held responsible for people falling in love." -- Albert Einstein

Working...