This preview shows pages 1–3. Sign up to view the full content.
Agenda:
* Who am I?
* What is this course about?
* What will we be doing in this course?
* Describing functions with contracts
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Big ideas:
thinking before hacking is important
dealing with complexity is the #1 problem in programming.
this class is all about that.
Course Manifesto:
Mathematicsespecially as used by physicsis the formalism
we use to describe "what is"
> we model the physical world with equations
> solutions to those equations give us insight into
the physical reality around us
But, classical mathematics does not say anything about how these
processes unfold.
For that, we need something else.
Computer science is the formalism we use to describe "how to".
Algorithm: An abstract sequence of actions composed to solve a
problem.
example: walking
put left foot in front of right foot.
put right foot in front of left foot.
repeat. :)
Program: concrete set of *program statements*, expressed in some
*formal language*, which *implements* some algorithm.
The task of programming:
1) Given a (possibly incomplete/imprecise) specification
2) Design an *effective* algorithm
3) Implement that algorithm *correctly* and *efficiently*
An algorithm is *effective* if:
 it correctly satisfies the specification
 it is efficient in its (asymptotic) usage of *space* and *time*
Note: "asymptotic" performance does not prescirbe a particular running
time or size.
Rather, it tells us how running time/space requirements
grow every time we e.g. double the size of the problem to which the
algorithm is applied.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentAn implementation of an algorithm is *correct* if it behaves as the
alogorithm is intended for all inputs/in all situations.
Correctness
is never negotiable.
There are three notions of *efficient* implementations
 the implementation has (concrete) space/time requirements
"similar to" the abstract requirements of the corresponding
algorithm.
 of all of the "asymptotically good" possible implementations,
this one is among the better ones in absolute, concrete terms.
 it does not take an undue amount of programmer effort to (a)
write the implementation in the first place (simplicity) or
(b) improve/adapt the implementation to more general/closely
related algorithms. (elegance)
So, efficient can mean fast, simple and/or elegant
This doesn't seem that difficult.
What's the big deal?
Several big problems:
 Engineering: faster, better, cheaper: pick two
Unfortunately, our goals are often in conflict.
The easiest
programs to understand/modify are often not the easiest to
write.
Programs that are simple to write/understand are often
not the absolute fastest possible solution to a problem.
The
most efficient algorithms for a given problem are often subtle
and difficult to implement correctly.
 the *languages* in which we program have only a small number of
This is the end of the preview. Sign up
to
access the rest of the document.
 Winter '08
 NOBLE

Click to edit the document details