Making the Computer Work for You
Programming for non-programmers
G. Wade Johnson
notes
Pre-requisites
- Familiar with a text editor
- Familiar with a command line
- Can run programs on the command line
notes
Core Concepts
Computers are dumb, but fast.
notes
Core Concepts
One-shot programs don't have to be efficient.
notes
Core Concepts
Let the computer do the boring, repetitive stuff.
notes
Core Concepts
A series of simple steps is better than a complicated solution.
notes
Core Concepts
It's more important to solve the problem than to perfect the program.
notes
Core Programming Concepts
- Sequence
- Variables
- Conditionals
- Iteration
- Subroutines
notes
Writing
- Not everyone can write a novel, screenplay, or technical manual.
- Not everyone can write a short story.
- Almost everyone can handle a todo list or thank you note.
- Most people can write a paragraph.
notes
Programming is Like Writing
- Not everyone can write a production program with 24/7 up-time.
- Not everyone can write a word processor.
- Almost everyone can handle putting a series of commands in a shell script or batch file.
- Most people can handle a simple script.
notes
Problem 1
Start a set of programs
prog1
prog2
prog3
notes
Problem 2
Find a string in a file
grep special_string junk.txt
notes
Problem 2a
Find a string in multiple files.
grep special_string *.txt
notes
Problem 3
Find a number of a certain type in a file.
- A negative number
- A number less than 1000
- A number greater than 1284000000
Example: findit.pl Perl script
notes
Core Incantation
The solution to the last three problems follows the same
form.
notes
Problem 7
Rename a set of files based on some criteria
DSCN####.JPG -> Vacation-yyyymmdd-hhmmss-####-wade.jpg
Example: renphoto.pl Perl script
notes
Problem 8
Perform the same action on a set of files obtained from another program.
We didn't get this far.
notes
Problem 9
Code generation
We didn't get this far.
notes