Tools for CS Students

Background

Tools for CS Students

  1. Your Brain
  2. Debugging
  3. Big design, small code
  4. Plan to throw one away
  5. Version control
  6. Keyboard not mouse

1. Your brain

You have a brain.

It is complicated.

Two parts of your brain strongly impact your learning.

1a. Working memory

1b. Schema

1c. Learning

2. Debugging

  1. Identify that there is a bug.

  2. Understand what should have happened and what happened instead.

  3. Locate the bug within the code.

    There’s only one way to do this too:

    1. Pick a location in the code.

    2. Predict the expected value of all variables there.

    3. Check to see it they have those values (with debugger or prints).

    4. Pick a new location: earlier if wrong there, later if right there.

  4. Change the code to remove the bug. This might involve

3. Big design, small code

To code without needing much debugging:

  1. Start with correct but featureless code.

  2. Add the smallest additional feature you can.

  3. Test that small addition (and retest everything before it).

    Some recommend swapping steps 2 and 3: writing the test before starting to code.

  4. Return to step 2.

Works best given a list of features to add before you begin (a design).

If it seems like the next feature is big, refactor.

4. Plan to throw one away

If your code feels messy and complicated…
…throw it away and start over.
If your code is finished by not beautiful…
…throw it away and start over.
If doing the assignment felt uncomfortable and tricky…
…throw it away and start over.
If you plan to deploy your code with real clients and need it to work reliably…
…throw away the first version and start over.

This was one of the first software design principles to be identified and published (by Fred Brooks in 1975) and remains widely recommended today.

5. Version control

Disk space is cheap.

Experimentation is easy.

Recovering from a bad experiment is only cheap if you have old versions on hand.

Options:

Pick one. Learn it. Use it.

6. Keyboard not mouse

Mice are slow and hard to automate with schema, but easily learned.

Keyboards are fast and easily automated with schema, but harder to learn.

Become a Power User. Use the keyboard.

  1. Almost every command has a keyboard shortcut. Learn 1 or 2 each week.

  2. The terminal/command line/console/shell is designed to be keyboard-only.

    It has orders of magnitude more capabilities than any other application I know of.

    Learn it on your own, for example by using the following: