Skip to content

Latest commit

 

History

History
366 lines (279 loc) · 7.85 KB

cse-07-19.md

File metadata and controls

366 lines (279 loc) · 7.85 KB
presentation
width height theme
800
600
moon.css

Open-source

Who, what, why, where, how


or how I learned to stop hiding; and expose the bomb

This slide-deck: https://offscale.io/cse-07-19.html

Who am I

What

Open-source means freedom.

Freedom to share code, usually commercially and privately.

Licenses

digraph G {
  bgcolor=transparent;
  rank=same

  node[style=filled, shape=rect, color=dodgerblue2, fontcolor=white, fontsize=18, fontname=Helvetica];
  edge[arrowhead=vee, color=white, fontsize=18, fontcolor=navy];

  public[label="Public domain", color=black]
  mit[label="MIT"]
  BSD[label="BSD-New"]
  apache[label="Apache-2.0", shape=rect]

  node[color=darkolivegreen2, fontcolor=black];
  lgpl2[label="LGPL 2.1"]
  lgpl2p[label="LGPL ≥ 2.1"]
  lgpl3[label="LGPL ≥ 3"]
  mpl[label="MPL 1.1"]

  node[color=darkgoldenrod1];
  gpl2[label="GPL 2"]
  gpl2p[label="GPL 2+"]
  gpl3[label="GPL ≥ 3"]

  node[color=coral1];
  agpl[label="AGPL 3"]

  subgraph permissive {
    public mit -> BSD -> apache
  }

  subgraph weak {
    lgpl2 lgpl2p lgpl3 mpl
  }

  subgraph strong {
    label=strong
    color=lightblue
    style=filled
    gpl2 gpl2p gpl3
  }

  subgraph network {
    agpl
  }

  BSD -> lgpl2
  BSD -> lgpl2p
  apache -> lgpl3
  lgpl2 -> gpl2
  lgpl2 -> gpl2p
  lgpl2p -> gpl2
  lgpl2p -> lgpl2 [dir=both]
  lgpl3 -> gpl3
  BSD -> mpl
  gpl3 -> agpl
}

Why

  • Development speed
  • Quality (tests; security; documentation)
  • Interoperability
  • Community
  • Learning

Where: Charity

Where: Gov't

  • Auditability & accountability

Where: Business

2018

  • Mesosphere raised $125M ($247M to date)
  • Hashicorp raised $100M ($174.2M to date)
  • CoreOS bought for $250M by Red Hat
  • Red Hat bought for $34B by IBM

How: new project

  1. Pick a license;
  2. Pick a name;
  3. Create a repository;
  4. Upload repository (e.g.: to GitHub)

How: existing projects

  1. Pick a project;
  2. Pull it to local computer [usually];
  3. Make modifications;
  4. Send back modifications

How: for n00bs

New to programming, or a nonprogrammer?

No matter. Plenty of low-hanging fruit; even for you!

(see appendix for details)

github.com/SamuelMarks github.com/offscale [email protected] /in/samuelmarks

Appendix

Low-hanging

  • README.md cleanup (the first document the public views);
  • Spell checking;
  • Linting (semicolons, tabs vs. spaces, &etc.);
  • Badges/shields, like: License Build Status Coverage Status David dependency status for latest release

Low-hanging

  • Code quality metrics (automated, e.g.: with CI/CD integration)
    • Code coverage
    • Test coverage
  • Dotfiles: adding these to the root of the repository increases quality:
    • .gitignore; .editorconfig

Low-hanging

  • Compliance (e.g.: PEP8 in Python; strict-mode in ECMAScript)
  • Writing simple tests

Medium-hanging

  • Writing tests
  • Static code analysis with tooling, e.g.: what opening a project with a JetBrains IDE, selecting "Code"->"Inspect Code..." from the menu bar will expose

Medium-hanging

  • CI/CD integration (Azure Pipelines; Travis CI; Appveyor and/or CircleCI)
    • See next slide
# Filename: .travis.yml
language: node_js
node_js:
    - "lts/*"
cache:
    npm: true
before_install:
    - npm install -g npm
install:
    - npm ci
script:
    - tsc
    - npm test
after_success:
    - npm run coverage

Medium-hang

  • Interoperability, e.g.:
    • OS support for: Windows, Linux, macOS, FreeBSD
    • Language support for: Python 2 & 3 [not as relevant anymore!]; newer/older JS
    • Package support for application-level dependency managers, e.g.:
      • Python: setup.py; Node.js: package.json; Rust: Cargo.toml

Medium-hanging fruit

  • Docker integration
    • See next slide
# Filename: Dockerfile

# Use Node.js' long-term support release
FROM node:lts-alpine

# Copy source code
COPY . /app

# Change working directory
WORKDIR /app

# Install dependencies
RUN npm ci

# Expose API port to the outside
EXPOSE 80

ENTRYPOINT ["npm", "start"]

High-hanging

  • Bots to automate changes, from small things like updating dependencies, to large things like modifying a codebase through AST traversals
  • Major contributions to large codebases, e.g.: adding strict resource limits to FreeBSD jails by modifying the kernel

Workshop

0) Workshop: contribute

  1. Create an account on https://github.com
  2. Pick a project, e.g.: from https://github.com/explore

#explore.png

1) Make your own copy of the project

This is generally dubbed a fork.

Most commonly, forks are used to either propose changes to someone else's project or to use someone else's project as a starting point for your own idea.

#fork-link.png

#fork-clicked.png

2) Contribute

  1. Install git: https://git-scm.com/downloads
  2. Open your terminal / command prompt
  3. Run git clone followed by the URL of the repository, e.g.:
git clone https://github.com/SamuelMarks/restify-orm-scaffold

3) Contribute

  1. Modify (e.g.: using the CLI, an IDE, manually modifying using a GUI file manager)
  2. On the command-line, cd into the directory you cloned
  3. Run:
git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "[email protected]"

4) Contribute

  1. Create a feature branch with:
git checkout -b feature_name_goes_here
  1. See your modifications with:
git status

5) Contribute

  1. Add your modifications by specifying the relative filename for each modification you want:
git add <filepath/filename> <filepath/filename>
  1. Commit your modifications with:
git commit --message "Commit message goes here"

6) Contribute

  1. Put your changes online, with:
git push origin feature_name_goes_here
  1. Send PR—using hub CLI—or online (see next slides)

#fork.png

#PR-open.png

#PR.png

#PR-success.png

#PR-branch.png

See first slide

Your turn

  1. Explore github for the open-source project you want to contribute to
  2. Add a new issue to https://github.com/offscale/offscale-presentations specifying which project you're working on
  3. Contribute ;)

Next steps

This slide-deck: https://offscale.io/cse-07-19.html

github.com/SamuelMarks github.com/offscale [email protected] /in/samuelmarks