“MIT OpenCourseWare (OCW) is a web-based publication of virtually all MIT course content. OCW is open and available to the world and is a permanent MIT activity.”
The following are my notes for this program:
Introduction to Computer Science & Programming
Guttag, John. 6.00SC Introduction to Computer Science and Programming,Spring 2011. (Massachusetts Institute of Technology: MIT OpenCourseWare), http://ocw.mit.edu (Accessed 23 Feb, 2013). License: Creative Commons BY-NC-SA
MIT 600 Lecture 3:
Operators and operands; statements; branching, conditionals, and iteration
Lecturers: Eric Grimson & John Guttag
Course Web site
Lecture 03
3 different items required to write code:
1.Data
* Numbers
* strings
* booleans
2. Operations
* addition & multiplication
* and / or
* etc
3. Commands
* assignment
* input / output
* conditionals aka branches
* loop mechanisms
In talks to date, conversation around good programming style
* using comments
* type discipline (operands)
* descriptive use of good variable names
* testing all branches
Focus on this session:
COMMON PATTERNS OF CODE
Iterative approach, structure;
* choose a variable that is going to “count”
* initialize it outside of the loop
* setup the right end test (includes variable)
* construct the block of code (incs changing the variable)
* decide on what to do upon completion
TOOLS TO USE
* create a flow chart
* classes of computation (simple to complex)
* simulatation of the code
* exhaustive enumeration (trying all reasonable values until complete)
Tuple: An order sequence of elements
* foo = (1,2,3,4)
* selection foo[0]
* slicing foo [1,5]
Strings are an ordered sequence of characters as well
Touring complete language are captured with:
* Data
* Operations
* Commands