Lesson 15: Dev Processes & Tools

Homepage Content Slides Video

Warning

This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.

Overview

Code Analysis

Debugging Tools

CLI Debugging Tools

C/C++ Tools

Python Tools

NodeJS Tools

Web Consoles

Firefox Console

Linters

Examples:
  • flake8 (Python)
  • splint (C)
  • jshint (NodeJS)
src/times.js: line 407, col 20, Expected '{' and instead saw 'return'.
src/times.js: line 415, col 49, Missing semicolon.
src/times.js: line 407, col 58, 'error' is not defined.

Code Coverage

Name                      Stmts   Miss  Cover   Missing
-------------------------------------------------------
my_program.py                20      4    80%   33-35, 39
my_other_module.py           56      6    89%   17-23
-------------------------------------------------------
TOTAL                        76     10    87%

Integrated Development Environments (IDE)

Debugging in Minecraft

Integrated Development Environments (IDE)

Examples:
  • Netbeans (Java)
  • Visual Studio (.NET)
  • PyCharm (Python)
  • Eclipse (Many)

Style Guides

XKCD Code Quality comic

Example: Real-World Style Guides

The Linux kernel style guidelines are actually fun to read:

"First off, I’d suggest printing out a copy of the GNU coding standards, and NOT read it. Burn them, it’s a great symbolic gesture."

Linux Kernel Coding Style

NASA’s Jet Propulsion Laboratory style guidelines are very short and are concerned with automated tooling to do code analysis:

"All loops shall have a statically determinable upper-bound on the maximum number of loop iterations."

JPL Coding Standard

Dependency Isolation

The process of -- wait for it -- isolating project dependencies.

TODO: Python Virtualenvs

Setup and enter the virtual environment.

$ virtualenv <virtualenv name>
New python executable in /path/to/<venv name>/bin/python
Installing setuptools, pip, wheel...
done.
$ source <venv name>/bin/activate

Install a package. This installs it in the current working directory and so does not ask for root permissions.

(<venv name>) $ pip install flask
[...]

TODO: Python Virtualenvs

To list all packages in the venv:

(<venv name>) $ pip freeze
click==6.6
Flask==0.11.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
Werkzeug==0.11.11

Deactivate (leave) the venv.

(<venv name>) $ deactivate
$

Other Examples

Node.js:
Creates a node_modules directory and tracks dependencies in package.json.
Go:
Dependencies are tracked via git repositories and using the go get command.
Rust:
Dependencies and versions are specified in Cargo.toml. All compiled code (and dependencies) are stored in a target directory.

Development Servers

A Carbon Copy of the Production Environment(s)

Further Reading