Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
GNU is Not Unix

Is It Okay To Learn From GPL'd Code? 25

scenic asks: "I was wondering if it's okay to learn from GPL'd code if I plan on creating a closed source product. I'm developing a product for work which has an undetermined license (open or closed) at this point. I don't plan on using code from another project directly, but I'd like to see how other projects deal with problems I will likely face in development. I've been reluctant to even look at GPL'd products because I don't want to violate the letter or the spirit of the GPL. I'm wondering if I'm just being too worried, though. Specifically, I'd like to know what other people think? Is there a definitive answer? " Learning from GPL'd code is one thing, then there's plagiarizing whole blocks of code into your own closed apps, which is a no-no. How do you all feel about this. If you know you are planning on coding another project, is it OK to look through GPL code for ideas or should a programmer be safe and avoid GPL'd code until his obligations to the current project are satisfied?
This discussion has been archived. No new comments can be posted.

Is it Okay to Learn from GPL'd Code?

Comments Filter:
  • by PatJensen ( 170806 ) on Sunday June 11, 2000 @01:43PM (#1010057) Homepage
    What scenic asks is a very important question with ramifications that echo throughout the software development community. GPL is more then just words in license, but is also a soul and attitude inside developers that encourages sharing and open-use to help other programmers make their projects grow.

    The GPL is largely used a learning tool to help new developers develop strategies and ideas to build their own solutions. And as such, learning from GPL'd code is encouraged. In the process of the creation of your product, GPL'd or not .. out of respect for the community, you would be encouraged to share your comments and suggestions in using other GPL'd products.

    Just make sure that during your development, your commercial code stays free of GPL'd material and that you do your best to encourage GPL development to keep the "soul" of open-source programmers moving. This will ensure that you, and future programmers and future companies will have the open-source community as a place to observe and learn from.

  • by Elvii ( 428 ) <david1975&comcast,net> on Sunday June 11, 2000 @02:46PM (#1010058) Homepage
    Thou I try to avoid liscense talk as much as possible, you can also use BSD liscensed code. If the purpose is learning base solutions to specific types of problems, either type of code should do, as long as you're not copying blocks of code as prevouly noted. :)

    BTW, to tell the truth, I'm not really picky or religilous about liscenses, I just use what's right for the job.

    bash: ispell: command not found
  • by StenD ( 34260 ) on Sunday June 11, 2000 @04:06PM (#1010059)
    ...upon whether you are asking ethically, legally, or practically.

    Ethically, you shouldn't, because the GPL isn't there to educate, but to ensure that the code remains free. If you are "learning" from GPLed code and implement something the same way that the GPL code did, you've broken the intent that the code remain free.

    Legally, if you are VERY careful, you could do it. Chances are, though, that if you are looking to "learn" from GPLed code then you will implement something the same way, which raises the question of whether you copied it.

    On a practical level, however, you can probably get away with it. The danger there is if you are very sloppy in "learning" how to do things, and someone who knows the code that you are "learning" from has reason to look at your binaries, you might become the next NVIDIA [slashdot.org].

    So, do you want to do the right thing, the safe thing, or go for broke?
  • A major point behind sharing your code with others is to they can learn from what you did, and vice-versa. That way, we don't have to learn everything from scratch. If you end up not sharing this code, well, you probably will on the next project.
  • by trims ( 10010 ) on Sunday June 11, 2000 @08:23PM (#1010061) Homepage

    Indeed, that was my point. I am very much aware of RMS standpoints on this - I've discussed it with him. I'm also very aware of the GNU literature. Please don't assume otherwise.

    As I stated, and you quoted, RMS very much is against the control of ideas. That's what I was talking about. IDEAS, not code. He's all for the free exchange and non-ownership of ideas.

    The GPL is a piece of legalism used to protect the concrete expression of ideas (that is, source code). It has nothing to do with the ideas itself. The only reason it exists is that currently, the concrete expression of ideas is controllable. The GPL is an attempt to end-run around this, for a reasonable social cause. And, as such, it's solely focused on code, not ideas. Nothing in the GPL, the GNU Manifesto, or otherwise indicates that RMS believes in any control or restriction of ideas (even the so-called "good" restrictions of the GPL w/r/t enabling free code). By attempting to control the use of his ideas, RMS would be hypocritical in the extreme, which I can definately say he's not. By controlling the use of the expression of his ideas (the code), he's actually attempting to move people in a direction where ideas currently sit: complete non-control.

    The GPL (and GNU) are all about protecting the freedom of implementation, don't deal at all with design.

    Anyhow, this is all rhetorical. You can't own an idea ( funky business-method patents aside ). So there's nothing preventing you from sharing them with others, and gleening what knowledge you can from elsewhere.

    And, if you read my post, I say explicity point out that stealing code is verboten.

    Please, take a couple minutes to think before hitting the Reply button. I find that usually helps me stop from putting my foot in my mouth.

    -Erik

  • by BoLean ( 41374 ) on Monday June 12, 2000 @02:15AM (#1010062) Homepage
    I'm not sure what you mean by ethically. Do you quote references from every instructor you ever had or programming book you read when to write your code? Its not unethical to learn from another's methodology. In fact I'm positive its true that 90% of all source code comes from the programmer rehashing the same routines. It would be unethical to cut-and-paste someone else's work. But learning and reimplementing their methodolgy isn't. Source code usually falls under the copyright laws so just because you follow the same plot doesn't constitute copyright infringement. In the book worlk, there hasn't been an origional ploy in the last 200 years. Programming still offers some chance at origionality, but not much.
  • by trims ( 10010 ) on Sunday June 11, 2000 @05:25PM (#1010063) Homepage

    .. Go for It!

    All the legalism aside, and contrary to other poster's opinions, I belive that the spirit of the GPL is to insure that ideas are free. I don't think that even in a grouchy mood RSM would insist that you must "free" your own ideas because you like his. And, anyhow, just because you write proprietary code, there isn't any reason why you can't share your idea with someone else (unenforcable NDAs and ill-advised patents notwithstanding...), so I think the proper way to "honor" the GPL in this case is to talk about how you solved the problem with others. Share the ideas.

    In essence, that's what you're looking for: ideas. You want to see how other people have solved a problem that is important to you. GPL'd software is intended to be a great bank of knowledge - use it.

    Now, of course, is the tricky part - writing your own project. My suggestion to avoid lots of problems is this:

    1. Designate a "learning" period. Go read lots of GPL code. Find OpenSource code - read it. Do a web search. Whatever. Consider this your information gathering phase.
    2. Putz around with alot of the code you've found. Tweak it. Do little test runs to see how it works, and how you can modify it to do stuff. In general, learn the ideas and concepts and then practice.
    3. Next, throw out your test programs. That's right - get rid of them. Also, I suggest you get rid of the initial code (GPL or otherwise) that you used to learn from. By doing this, it eliminates the temptations to "cheat" and use code from places you're not allowed to. Also, it makes it alot easier to insure that you really understand stuff.
    4. Now, sit down and design your approach. Write it all down, and preferably, print it out (or otherwise make a hard-copy of it). If you're paranoid, go get it timestamped/notorized. This is an excellent way to insure that you're "Clean-Rooming" the implimentation, and, incidentally, also insures that you think through what you're doing.
    5. Last step: code the implementation from your Specs.

    Best of Luck.

    -Erik

  • If you want to be careful, try this:

    Ask someone else (preferably not a coder for your project) to browse the code, and take some notes on the algorithm for the thing you want to do.

    Then, do your work using only that second hand information.

    That way, you can't accidentally duplicate sections of code from memory.
  • The GPL gets it's power from the legal principle of copyright. Copyright covers expressions of ideas, not the underlying ideas themselves. Copyright exists for the purpose of promoting learning.

    As long as you don't use the same expression, you are just as able to read, mark, learn and inwardly digest GPLed code as you would any programming text. You may utilize those ideas into expressions that are original to you.

    Anomalous: inconsistent with or deviating from what is usual, normal, or expected
  • You underestimate me, sir!

    Seriously, I am aware of that, but the point of this discussion is that the user wants to know about a library which already exists. I strongly agree that new libraries should be GPLd unless there is a reason to do otherwise, but this library is pre-existing and may be under the LGPL. I used the term as a generic since a large number of libraries fall into this catagory.

    And, if you really want to go further into the issure, there is a point you didn't bring up. LGPL no longer stands for Library General Public License, it now stands for Lesser General Public License. The change was made to clarify the situation you mention.

    Thanks for pointing that out, though. It's an important thing to mention in most any discussion of the LGPL.

  • Several FreeBSD drivers have been written from their Linux counterparts...

    --
    Eric is chisled like a Greek Godess

  • All the legalism aside, and contrary to other poster's opinions, I belive that the spirit of the GPL is to insure that ideas are free.

    And stay free.

    I don't think that even in a grouchy mood RSM would insist that you must "free" your own ideas because you like his.

    Then you apparently haven't read Why Software Should Not Have Owners [fsf.org] or Why Software Should Be Free [fsf.org], both by RMS (not RSM). He explicitly states that "[m]y conclusion is that programmers have the duty to encourage others to share, redistribute, study and improve the software we write: in other words, to write ``free'' software.". He's not the least bit unclear about this. As he asked (and answered) in The GNU Manifesto [fsf.org]:

    "Don't people have a right to control how their creativity is used?"

    "Control over the use of one's ideas" really constitutes control over other people's lives; and it is usually used to make their lives more difficult.


    You don't have to agree with RMS, but don't try to downplay his positions, or distort what the GPL does. One freedom the GPL is intended to ensure is "[t]he freedom to study how the program works, and adapt it to your needs.", but it does that by containing a restriction that "you cannot add restrictions to deny other people the central freedoms". Taking ideas from GPLed code and putting them into proprietary code would violate that restriction.
  • by Anonymous Coward
    I guess that it largely depends on what you're doing. If you're trying to learn how the Quicksort algorithm works, I can see very little reason not to look at GPL'd code to learn-- the algorithm is public domain, and you're only looking for general ideas. But if you're trying to make something more specific (say, a C compiler), you may want to consider whether or not your program can legally be considered a "derivative work", as per the GPL.

    But if you want to be REALLY careful and paranoid, look at the GPL, section 10:

    "10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally."

    So even assuming that it ISN'T kosher to learn from GPL'd code, you can possibly get the author of such GPL'd code to give you permission to learn from it or even use it in proprietary code. Or to grant you an "educational" license. As the original copyright holder, the author of the code *does* have the right to license it to other parties for other purposes.

    That said, I'd like to point you to http://www.gnu.org/prep/standards.html#SEC2 . The FSF is a bit finicky about people with access to the original UNIX source code. This is so that they avoid using proprietary algorithms or code in their software, which would probably lead to lawsuits. So both sides of the argument are present.

    Bottom line: if you're paranoid, contact the author. If the code is highly specific, and you're probably going to wind up re-creating the GPL'd code anyway, contact the author. If the code is general enough, I doubt there's a problem.
  • Disclaimer: IANAL

    You have probably gotten a lot of information from a large number of copyrighted works. I would think that you need to respect the copyright of GPLed code the same way as any copyrighted work. You can look at GPLed code all you want, but if you don't copy any of the code, you haven't violated the copyright.

  • by evil_deceiver ( 121296 ) on Sunday June 11, 2000 @08:08PM (#1010071) Homepage
    The reason I GPL my source code is because I want others to learn from it. My intent in releasing source is not to let people copy and paste code from my programs into their own; that's not helping them become better programmers, rather, it's allowing them to solve a problem without understanding the solution. Giving people band-aid solutions to their programming problems is something I would view as a disservice to the programming community at large, and to those people in particular.

    My real intent in releasing source is to allow others to learn from it. If those "others" turn out to be developers of closed-source programs, well, that's unfortunate, but I knew that I was taking that risk when I GPLed the code. I consider it inauthentic and somewhat elitist to say "my source code is open as long as you share my conviction that source code should be open." If I wanted to share my code, and the ideas it contains, with people whose philosophical or political leanings match mine, I'd start a mailing list. But I want to share it with any member of society interested in seeing it, so I GPLed it and posted it on the web.

    Do I wish that everyone who looked at my code also believed in GPLing theirs? Sure. Am I going to try to use legal maneuvering and the terms of the GPL to force them to? No. I'm going to talk rationally with them about tghe benefits of open source, maybe I'll write an essay about it, and I'll hope to convince them of the value of my perspective. If I don't succeed, oh well. It takes all types of people, you know.

    It's interesting to note that, as the "from-dept." line suggested, this question is really one of where lies the line between learning and plagiarism. This is signigficantly more difficult to discern when dealing with computer code than when dealing with most other forms of expression. If I read 1984, get ideas from it, and write a book using those ideas, I've learned, not plagiarised. If I write a book using Orwell's exact wording (and don't attribute the quote), then I've plagiarised. Now, if I read the source to, say, WordPerfect 8, and write the capability to do that shadow-cursor thing into my own word processor, have I learned or plagiarised? I mean, there are probably only a very few different algorithms I could use to achieve the same result. All would necessarily have some structural similarity, refer to similar variables and parameters, etc. If I change the variable names, is it still plagiarism? If I change the indentation style, is it still plagiarism? If I use a while-loop instead of a for-loop, is it still plagiarism? How different does my algorithm have to be from its prototype to be merely a derivative work and not a copy? How different can it be? I mean, Perl excluded, most languages don't leave you much room to play around with your diction. The variety of ways to achieve a similar effect with different wording in your typical C program is pretty slim.

    Disclaimer: I haven't written that much code that's been worth plagiarising. I'm just speaking on principle here.

  • by Error 404 ( 50896 ) on Monday June 12, 2000 @12:35PM (#1010072)
    It is OK to use what you learn. Absolutely.

    Same situation as with learning on the job. You will probably end up walking out the door of your current job with lots of valuable experience. Nothing you can do about it even if you wanted to.

    There are details, though. You can walk out a better {whatever} than you walked in. You can't walk out with the customer list or the specs to the next big project. And you can't "learn" GPL code by copy and paste.

    Use it to improve yourself, use it to see how things work. But write your own non-GPL code.

    Our secret is gamma-irradiated cow manure
    Mitsubishi ad
  • OK, maybe I'm more politically naïve than other /.ers out there, but I don't see the problem. There isn't any NDA or something strange like that going on; the license just says you can't use the code without releasing it. It's information, and comprises a source of research. As the court recently said, code is how we geeks tell each other about things. I'm not sure the GPL can apply to the idea, only the code. Hell, in class in college, I was told (and told my students when I was a teacher) that it's okay to talk to each other and get ideas, but you had to write your code yourself. That's all that's happening here.

    I suppose there could be some interesting questions, if there's truly a new algorithm in use, something that could be patented (I mean, even if the patent office made sense), maybe in that sense you're "stealing" the innovation, but I just have trouble with the concept of not being allowed to learn from something. How much is okay to learn? What if I suddenly understand how to do QuickSort when reading a GPL'd program? Does that make QuickSort forbidden to me without GPLing my code? Or a nifty commenting style, that anyone else could use because they saw it somewhere else, but I happened to learn it from a GPL program? An NDA, which is the closest thing I can think of to forbidding learning, only says you can't reveal the secret. Nobody can stop you from carrying your experiences and expertise with you, not even the GPL.

  • The reason that GPL code is avalible is so that other coders can look at it and use it for whatever they need to. If you want to use a GPLed library to save yourself the trouble of rewriting it, then do so. If you would rather create a compatible libray, then you have the abilities to do so (which is one of the freedoms that free software is about) although this is less effecient, since there is no real reason to do so. You can just modify the library to suit your needs.

    If you would like to learn how to write good code, then go right ahead! Code is avalible so that people can learn how it works and how they can use it, and you are making a contribution of sorts by adding one more bright person (I assume you are bright, at least) to the ranks of those who will make the right choice about code.

    The problem comes in when someone wants to learn from code so they can turn around and make their own version of that code that is restricted or something. While it is impolite and inefficient to duplicate effort (note that adding features != duplication; collaboration is another freedom that makes free software free), this is an insult. It says that you are taking someone's work, put a minimal amount of effort into changing it around so that they no longer control it, and binding it in irons so that you get a reward. We people work hard, and it's kind of like stealing, only legal (sort of, anyway).

    GPL stands for General Public License (not GNU Public License, as some think, look it up) because it was created so the General Public would have the freedom to use code to improve their work and to put work into improving that code. Sharing code is the fundemental principle of the GPL, and if you can learn from this code, go on ahead.

    Just don't abuse what you've learned. Keep your code free, because it's only fair. A system based on sharing depends on the people who are doing the sharing.

  • You underestimate me, sir!

    It was never my intention to imply that you were unfamilar with the difference between the LGPL [gnu.org] and the GPL [gnu.org]. I posted more for general information sake. At the same time, I felt a finer brush was needed on the issue of acceptabillity of using either license for GNU libraries in combination with commercial software. This distinction seems to confuse many people.

    This has to be the most reasonable exchange I have seen on Slashdot in a long time.

    Cheers,

    Broody

  • No, no, that was meant as a joke! The reason it's so pleasant was because I thought you had a very good point and I wanted to tell you so. I actually worried that you would take me seriously.

    I always try to answer people who reply to my comments, and talk about their point if I agree with it or debate it if I don't. I try to be nice to flamers, too, but it is much eaisier not to rave at people who I agree with.

  • You must only learn to code by purchasing and using visual C++.

    Anything else will stunt your development.
  • Ethically, you shouldn't, because the GPL isn't there to educate, but to ensure that the code remains free. If you are "learning" from GPLed code and implement something the same way that the GPL code did, you've broken the intent that the code remain free.

    While I don't totally disagree, I do think if you make that statement, you step into a pretty sticky place. What time limit would you put on the learning? I'm working on a (open) project right now, and am using and learning from GPL code for that project. Since it's open that shouldn't be a problem.

    Are you saying that since I'm learning techniques from GPL code that, ethically, I should refrain from ever, for the rest of my life, working on a closed project that tackles the same sorts of problems?
  • I'm not an Open Source developer or copyright guru but I find I have to reply to this. There were too many "yes, please do..."s here.

    • 1) Realize that just because you're not copying code doesn't imply you're not breaking copyrights. Think of it from the standpoint of, can you write a story using Mickey Mouse or Spiderman, or Mickey Mouse-like or Spiderman-like characters. Just because you like the ideas represented in the copyrighted works, does not give you the ability to use the idea again. I realize that this doesn't jive with many of the opinions, but I'm trying to be cautious here. I'm also taking an example from a completely different spectrum of copyright law, but I think it still applies.
    • 2) Read the description of the Clean Room implementations that were included in the Ask Slashdot article (today?). If you've read the code, you are definitely NOT doing a Clean Room implementation. You've already been tainted.
    • 3) I doubt (I'm probably wrong) that the Open Source folks would go after you for doing so, but every single non-Open Source company would. It's a matter of attitude, not legalism. Legally, I don't think you have any right to do so. Even under the GPL, I'd say you're probably obliged to Open Source anything you create after reviewing the code for ideas.
    • 4) But all of this is kind of kludgy anyways, you're talking about implementation of ideas, not flat out copying of code, which really breaks into Patent law more than copyright law. IMO.

    Later.

  • LOL. Damn, I have been rolling in laughter for a couple minutes now. : Humor, interesting concept.

"Sometimes insanity is the only alternative" -- button at a Science Fiction convention.

Working...