Beruflich Dokumente
Kultur Dokumente
Programming
“How to win friends
and influence computers”
A Brief History of Computers
General purpose minions
Orders
Human calculators
Mechanical calculators
Electronic calculators
BUT
Computers know very little and have no common
sense what-so-ever, so your instructions have to
be broken down to small, simple parts,
AND
Computers will do exactly what you tell them.
Basic Programming
Programming at it’s core is about two things:
defining problems, and solving problems.
5. Go to step 2
HOWEVER…
Real-world programming often doesn’t explicitly
involve these techniques except at high levels in the
design document. You should definitely use them
there, and for actual coding keep them in mind as
fallback strategies if your stuck on a problem.
What Computers Can Do Well
What Computers Can Do Well
Doing the same things over and over
Remembering things
Mathematics, ‘regular’ and true / false
Changing actions based on conditions
Taking in information
Sending out information
What Computers Can Do Well
Doing the same things over and and
Loops overSubroutines
Remembering things Variables and Assignment
Mathematics, ‘regular’ and true / falseOperators
Statements
Changing actions based on conditions
Conditionals
and Blocks
Taking in information
Sending out information
Input
Output
Statements, and Blocks
A statement is a basic instruction for the computer
SHOULD:
Be meaningful (often 10+ characters)
Be readable (use _ or mixCase to mark words)
Follow convention (start lower case, i, x, y)
Basic Values
Literal values:
Numbers
0, -3, 8.223419783
Strings (a series of characters)
“zero”, ”0”, “cheddar cheese”
Expressions:
One or more values, expressions, or variables combined by operators
8.3 * 4.291
2
“smoked” . “ “ . “cheddar”
A variable used in a expression is replaced by its value
ingredient_count + 3
Operators
There are all the standard math operators
+ - * / % ()