© 2017 Morgan C. Benton code4your.life
Modern software is NOT built from scratch. The unique functionality of most apps relies upon a rich ecosystem of packages and libraries that are written by other people. These packages, in turn, rely upon yet other packages. The hierarchy and collection of required packages can be extensive and complex, which gives rise to the need for package or dependency management systems.
© 2017 Morgan C. Benton code4your.life
You're writing a program that has to make an HTTP request to get data from a remote location on the web. Instead of writing your own code from scratch to make HTTP requests, you would import an HTTP library written by someone else and use that.
© 2017 Morgan C. Benton code4your.life
// JavaScript example
// import request library
var request = require('request');
// use it
request.get('http://example.com/data.json')
.on('response', res => {
// do something with data.json...
var data = JSON.parse(res);
});
# Python example
# import request library
import requests
# use it
r = requests.get('http://example.com/data.json')
data = r.json()
© 2017 Morgan C. Benton code4your.life
© 2017 Morgan C. Benton code4your.life
© 2017 Morgan C. Benton code4your.life
Language | Package Manager(s) | Package Repo |
---|---|---|
JavaScript | npm, yarn | npmjs.com |
Python | pip, easy_install | pypi.org |
R | built in, packrat | cran.r-project.org |
Ruby | gem | rubygems.org |
PHP | composer | packagist.org |
Java | maven | search.maven.org |
Go | dep | golang.org/pkg |
© 2017 Morgan C. Benton code4your.life
© 2017 Morgan C. Benton code4your.life
In general, packages get downloaded from the internet and stored on the developer's computer in one of two places:
© 2017 Morgan C. Benton code4your.life
Learning to use a package manager is basically a required skill for doing any sort of modern development. There is a learning curve involved, but the productivity gain is well worth the investment of time and energy necessary to learn it.