The Structure of a Program

Ven Popov

Previously on…

Recap

Week 1:

Why Programming? Course philosophy and the essence of computation

Week 2:

Computational Thinking & Basic R Operations


Short exercise: discuss core concepts for 5 minutes


How did the pi assignment go?

Today


The Big Picture What is a program and how do we structure it?
The Building Blocks Data versus Functions
The Environment Where do names live and who can access them?
The Blueprint Code organization & the terminal1
The Process How do we put all this together?
Logistics Discuss feedback and overview of the rest of the course

Today (in a nutshell)

Anything worth doing is worth doing well

What is your first memory of interacting with a computer?

What is a program and how do we structure it?

What is our goal?

  • Programming is about solving-problems
    • analyze data
    • create a simulation
    • create a tablet app for an experiment
    • build predictive models
  • We solve problems by breaking them up into pieces
  • Solve the pieces
  • Put them together

What we want != what the computer “wants”

  • it’s all about abstraction
  • we package low-level instructions into meaningful functions
  • functions can be named, reused, tested and documented
  • ok, but what is a function?

Outlook: Rough list of topics to cover

  • basic programming concepts
    • data structures
    • control statements - if, while, loops
    • functions
    • objects
    • scope
    • algorithms
    • randomness, seeds, distributions
    • tips & tricks
    • problem-solving
  • filesystem, project organization & command line tools
  • version control & collaboration
  • dependency/environment management & cluster/cloud computing
  • profiling, optimization and debugging
  • testing, documentation & reporting
  • (maybe: useful math refresher)