Skip to content

Instantly share code, notes, and snippets.

@maryrosecook
Created October 3, 2016 12:28
Show Gist options
  • Save maryrosecook/8e912a99b4c6cccf5455d935cb970fc7 to your computer and use it in GitHub Desktop.
Save maryrosecook/8e912a99b4c6cccf5455d935cb970fc7 to your computer and use it in GitHub Desktop.
OVERVIEW OF THE WEEK
- Encapsulating Single Responsibilities (rather than just common behaviour) into classes
- makes code easy to reuse
- makes code easy to change
- makes code easy to understand
- Refactoring code for SRP
- Adopt this code writing process
- decide on smallest unit of functionality
- diagram a solution
- write test for it
- get test to pass
- refactor
- repeat
DIAGRAMMING DOMAIN MODELS
- A really fast way to iterate on the architecture of your program to make it better.
DESIGN PATTERNS
- Design patterns in Ruby
- Design patterns are tools for solving problems in your code.
- Patterns for patterns
- Separate out the things that change from the things that stay the same
- move_thing(thing)
- Car and Plane
- Use conditional to call `drive` or `fly`
- Change method names to `move`
- Remove conditional
- Program to an interface, not an implementation.
- Example above
- Prefer composition to inheritance
- Car and Plane inherit `start_engine` and `add_wheel` functionality from Vehicle
- Create Skateboard class. Wants to use `add_wheel` but not `start_engine`
- Remove inheritance and make Engine its own class.
- Delegate, delegate, delegate
- Example above.
- Ya' Ain't Gonna Need it
- Minimum viable product all the way down to the method level.
- Example of the Adapter pattern
- StripText example
MARY AWAY TIMES
- Tuesday morning hospital
- Dan will be around for questions.
- Workshop will be at 3pm
- Friday for funeral
- Will pop in until 10.30
- Dan will be around for questions.
- Dan will run the confidence survey and retro.
- I'll release the weekend challenge.
- I'll be around for questions on Slack in the evening.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment