This site is a preview of the curriculum for our Summer 2018 bootcamp in Burlington, Vermont. As we continue our preparation, courses and lessons will appear and disappear; we will rename, rearrange, clarify, and obfuscate as needed... Please consider this a work in progress and keep checking in.
Learn to Code with Ruby:
nil is a magic object
There Is No Spoon
nil is the object that means "there is no object"
fruit = "apple" fruit = nil fruit.reverse
Read the error!
Errors are good
They tell you
- you made a mistake
- what that mistake was
- (sometimes) how to fix it
Interpret this error:
fruit.reverse NoMethodError: undefined method `reverse' for nil:NilClass
null pointer errors
- null pointer errors are very common
- the trick is reading the error and figuring out
- where it happened (*which line*)
- which variable was null
- often once you know which, knowing why is obvious
- or at least tracing back the logic is possible
If You're Going To Fail...
- fail hard, fail fast
- keep calm and carry on
Which idea is better?
Why or why not?
Fail Fast, Fail Often
- Ruby has a "fail fast" philosophy
- Is this a good idea?
- Why or why not?