List of exercises
Full list
This is a list of all exercises and solutions in this lesson, mainly as a reference for helpers and instructors. This list is automatically generated from all of the other pages in the lesson. Any single teaching event will probably cover only a subset of these, depending on their interests.
Software licensing
Licensing-1: What constitutes derivative work?
This question 5 below can be used as a starting point and copied to the collaborative document or form input for an online poll:
## Question 5: Which of these are derivative works?
**Choose many**. Vote by adding an `o` character:
- A. Download some code from a website and add on to it
- votes:
- B. Download some code and use one of the functions in your code
- votes:
- C. Changing code you got from somewhere
- votes:
- D. Extending code you got from somewhere
- votes:
- E. Completely rewriting code you got from somewhere
- votes:
- F. Rewriting code to a different programming language
- votes:
- G. Linking to libraries (static or dynamic), plug-ins, and drivers
- votes:
- H. Clean room design (somebody explains you the code but you have never seen it)
- votes:
- I. You read a paper, understand algorithm, write own code
- votes:
Solution
Derivative work: A-F
Not derivative work: G-I
E and F: This depends on how you do it, see clean room design.
Licensing-2: Consider some common licensing situations
What is the StackOverflow license for code you copy and paste?
A journal requests that you release your software during publication. You have copied a portion of the code from another package, which you have forgotten. Can you satisfy the journal’s request?
You want to fix a bug in a project someone else has released, but there is no license. What risks are there?
How would you ask someone to add a license?
You incorporate MIT, GPL, and BSD3 licensed code into your project. What possible licenses can you pick for your project?
You do the same as above but add in another license that looks strong copyleft. What possible licenses can you use now?
Do licenses apply if you don’t distribute your code? Why or why not?
Which licenses are most/least attractive for companies with proprietary software?
Solution
As indicated here, all publicly accessible user contributions are licensed under Creative Commons Attribution-ShareAlike license. See Stackoverflow Terms of service for more detailed information.
“Standard” licensing rules apply. So in this case, you would need to remove the portion of code you have copied from another package before being able to release your software.
By default you are no authorized to use the content of a repository when there is no license. And derivative work is also not possible by default. Other risks: it may not be clear whether you can use and distribute (publish) the bugfixed code. For the repo owners it may not be clear whether they can use and distributed the bugfixed code. However, the authors may have forgotten to add a license so we suggest you to contact the authors (e.g. make an issue) and ask whether they are willing to add a license.
As mentionned in 3., the easiest is to fill an issue and explain the reasons why you would like to use this software (or update it).
Combining software with different licenses can be tricky and it is important to understand compatibilities (or lack of compatibilities) of the various licenses. GPL license is the most protective (BSD and MIT are quite permissive) so for the resulting combined software you could use a GPL license. However, re-licensing may not be necessary.
Derivative work would need to be shared under this strong copyleft license (e.g. AGPL or GPL), unless the components are only plugins or libraries.
If you keep your code for yourself, you may think you do not need a license. However, remember that in most companies/universities, your employer is “owning” your work and when you leave you may not be allowed to “distribute your code to your future self”. So the best is always to add a license!
The least attractive licenses for companies with proprietary software are licenses where you would need to keep an open license when creating derivative work. For instance GPL and and AGPL. The most attractive licenses are permissive licenses where they can reuse, modify and relicense with no conditions. For instance MIT, BSD and Apache License.
Software citation
Discussion (Citation-1): Explain how you currently cite software
Do you cite software that you use? How?
If I wanted to cite your code/scripts, what would I need to do?
Social coding
In social-coding.md:
Social-1: Think about if and how you share
Did you ever share your code? If yes, what motivated you? Come up with reasons for sharing your scripts/code/data.
Also think about reasons for not sharing.
In social-coding.md:
Social-2: Discussion about “You aren’t required to support anyone”
Have you experienced an implicit expectation of support?
Supporting all requests can lead to overworking and mental health issues.
Not supporting requests can also induce guilt.
Most projects are maintained by 1 or 2 persons.
Most projects cannot retain contributors for a longer time. Interests change. “Casual contributors are like tourists visiting NYC for a weekend” (Nadia Asparouhova, book below).
If you maintain all projects that you start forever, at some point it may be difficult to start new projects.
What are your experiences? Do you agree with the above thoughts?
Book recommendation: Nadia Asparouhova (formerly Nadia Eghbal): “Working in Public: The Making and Maintenance of Open Source Software (Stripe Press)”