Contents
6.005: Software Construction
MIT的EECS学院的CS foundation包括6.004,6.005,6.006
资料
Goal
Safe from bugs
Easy to understand
Ready for change
Key
Immutability
Immutability (immunity from change) is a major design principle in this course. Immutable types are types whose values can never change once they have been created. (At least not in a way that’s visible to the outside world – there are some subtleties there that we’ll talk more about in a future class about immutability.)
Test-first Programming
- Write a specification for the function.
-
Write tests that exercise the specification.
-
Write the actual code. Once your code passes the tests you wrote, you’re done.
Writing tests first is a good way to understand the specification. The specification can be buggy, too — incorrect, incomplete, ambiguous, missing corner cases. Trying to write tests can uncover these problems early, before you’ve wasted time writing an implementation of a buggy spec.
未完待续ORZ…