Making the Computer Work for You

Programming for non-programmers

G. Wade Johnson

Houston.pm

notes

Pre-requisites

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

  1. Sequence
  2. Variables
  3. Conditionals
  4. Iteration
  5. Subroutines
notes

Writing

notes

Programming is Like Writing

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.

Example: findit.pl Perl script

notes

Problem 4

Append a line to a set of files.

Example: append_copyright bash script

notes

Problem 5

Insert a line in multiple files.

Example: insert_copyright.pl Perl script

notes

Problem 6

Delete a particular line from a file.

Example: delete_copyright.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