explain puns to kleptomaniacs because they always take things literally. (Reddit’s NascentEcho) The rumors have finally stopped flying around here. They can't make it through airport security. (Twitter’s @funnyoneliners)
involves at least a couple serious nerds… • John Horton Conway came across a very complicated hypothetical machine – originally developed by John von Neumann in the 1940s - that could build copies of itself. • The original mathematical model relied on very complicated rules playing out on a rectangular grid. Conway set out to simplify the model, and succeeded.
talk about Fight Club. 2. You do not talk about Fight Club. 3. Any live cell with fewer than two live neighbors dies, as if caused by under-population. • cell.neighbors < 2 ? cell.die! : cell.live! 4. Any live cell with two or three live neighbors lives on to the next generation. 5. Any live cell with more than three live neighbors dies, as if by overcrowding. 6. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
known gun, and indeed the first known finite pattern with unbounded growth, found by Bill Gosper in November 1970. It consists of two queen bee shuttles stabilized by two blocks. • This girl makes me happy & sad at the same time…
the Game of Life felt… off. ü I was regularly losing track of which methods needed which arguments, especially when nesting methods inside other methods. ü I had to be extremely diligent about keeping track, mentally, of each line’s return value so I could pass the right thing to the next part of my program. ü In short, I was passing stuff around like Joe Montana in his prime. • What if we just let the various Game components – Cell objects, a World object, even the CLI as an object – exist independently & “talk” to one another via their own attributes? • I hoped this would simplify my code (not to mention eliminating those, “How do you not have enough arguments?!” moments)
data items in lots of places: fields in a couple of classes, parameters in many method signatures. Bunches of data that hang around together really ought to be made into their own object.” @martinfowler
wreak havoc because objects know too much about one another. Changing one object forces change upon its collaborators, which in turn, forces change upon its collaborators, ad infinitum.” • “During design you wander through a maze of requirements where every juncture represents a decision point that has consequences for the future.” • Totally wish I’d spoken to Sandi Metz about this… though she’d probably be like, “Who are you?”
equivalent of friction and gravity.” @sandimetz • Imagine that we had invented COGL, and lo and behold the world falls in love! We decide we want to add a feature to our Game of Life… • Since our Game has become so popular, our throngs of users want to start using their own customized alive/dead icons – talk about 1st world problems! • Specifically, instead of 0’s and 1’s, one user (call him Greg Eng) wants to go into the source code and use white & black squares so it looks super real
of lines of code changed: 10+. (#lame) • Increase in systolic/diastolic blood pressure: +9.8/+21.5 • OO version: • Total # of lines of code changed: 2. (#notlame) • Increase in systolic/diastolic blood pressure: -4.0/-5.3 • Wow! This stuff really works!
us a sense for how complex our code is. • OO version has more code than than procedural, but we are more interested in complexity per method – a lower score per method would tell us which strategy will be easier to maintain as time goes on and things change…
• It was much, much easier to change a single line of code within my CLIPretty class than to write another method (which is called in the body of my procedural Game method). • By splitting the Game’s components into classes according to the natural, intuitive dividing lines, we’ve got a design that can handle our 1x109 users’ icon preferences • Imagine how easy it’d be to now change the rules of the game – we just change the a few lines of code in our Cell class and voilà!