

How to correctly use code you didnt write - ranit8
http://www.patrick-wied.at/blog/how-to-correctly-use-code-you-didnt-write

======
ars
Pretty misleading title. I thought this was about a large project and helping
people use code from other people.

It should be titled: "How to correctly _attribute_ code you didn't write"

~~~
karamazov
Same here - I was looking forward to some advice on efficiently parsing alien
coding habits.

------
cgs1019
I feel like this argument could be made more strongly than "You shouldn't copy
code without the license because...don't copy code without the license!"

I under-appreciated licenses for a very long time and only recently realized
the very real risk of writing some code, posting it to github without any
licensing, it being picked up by some commercial organization, and then them
licensing it and (possibly, later) taking action against _you_ for using
_their_ code without a license (ha!).

Anyway, I appreciate the spirit of the post, but it didn't make much of an
argument...

Edit: I guess he also argues that it might upset the code's author to copy
their code without attribution (totally possible), which would lead to their
writing less open source code (seemingly less likely). I think the risk of
commercialization of your code is more salient, though.

~~~
raphman
_I under-appreciated licenses for a very long time and only recently realized
the very real risk of writing some code, posting it to github without any
licensing, it being picked up by some commercial organization, and then them
licensing it and (possibly, later) taking action against you for using their
code without a license (ha!)._

I am not completely sure about US copyright law. However, at least in the
European Union, you are the sole owner of your code as soon as you write it.
Therefore, anyone putting their license on your code would be violating your
author rights.

~~~
Cushman
You do, under the law, implicitly own the copyright to everything you create.
This will not inherently protect you from costly lawsuits requiring you to
prove that you do, however.

~~~
true_religion
Nothing protects you from lawsuits. I could right now sue you for slander for
some comment you never made, and I fabricated evidence for.

That would just make me unethical, and you can't protect against that.

~~~
Cushman
That may be true in the abstract, but having a registered copyright does give
you additional protections that could make it easier to dismiss a suit.

------
richbradshaw
I've found that once I've converted all the tabs to spaces, moved the { and }
into the correct places, removed trailing white space, added spaces before and
after operators, changed all strings to be surrounded by ' or " depending on
their use case, changed comments so that // comments are on their own line,
and /* */ comments are formatted neatly, I'm ready to go.

~~~
mkramlich
You don't happen to work for Microsoft "R&D" do you?

------
almondsays
Excuse me if this is a naive question but I'm kind of confused on using just a
few lines of code. I know you must attribute the original creator when the
license calls for it but where? For instance lets say I have 500 lines of code
and 10 lines of borrowed code at lines 245-255. Whats best practice in that
situation?

~~~
tptacek
There's practically no difference between using 10 lines of GPL code and using
a whole package. In either case: you must comply with the terms of the GPL
license; your own code is now GPL'd. The exceptions to this rule aren't worth
litigating.

If you're not interesting in (say) GPL'ing your code to match the 10 lines you
lifted, you would be better of just reimplementing those 10 lines yourself.

------
citricsquid
If I'm using an entire file (example from 10 mins ago:
<http://michelf.com/projects/php-markdown/>) I'll leave the license in the way
I find it, I have no incentive to change it.

If I'm using parts of someone else's code I'll have a comment preceding it
explaining where the code is from (eg: // code taken from: url). It's a
massive annoyance to have to try and copy in licenses in the middle of code,
it's ugly and makes reading through my code a pain. I guess I'll go to hell
for it, but eh.

------
pan69
How does a licence impacts the distribution of plugins?

E.g. if I write a plugin for a system (e.g. Wordpress) and I sell this plugin?

Does the plugin code needs to be distributed under the same licence as the
original system even though it wouldn't distribute any of the code provided by
the original system? It would only call functions or inherit from classes
described in the original system.

~~~
handzhiev
There's a lot of debate on this topic. Most people agree that plugins should
also be GPL, so most are (even the commercial ones)

~~~
raphman
Nice overview of the 2010 Thesis theme debate:
<http://www.metafilter.com/93802/WordPress-Thesis-and-the-GPL>

------
pimentel
At last, a simple and direct explanation of what you need to do with each
license. I'm tired of answers like "just read the license and comply with it"

------
boskonovitch
great article.somebody once said "programming is filled with plagiarism" and i
think that is absolutely true,noobs especially like to do it this way.

