- Avoid imperative conditional logic
- If you can do it with an enumerator, then just do it
- Keep 90% of the overall methods idempotent
- Wrap small sections of imperative shell around composite idempotent methods
- Think in terms of behaviors and values, not objects and messages
- Identify and classify data clumps (primitives that do not work as sub data)
- Use modules to wrap related behavior
- Keep SOLID
- Stay the hell away from nils, coerce and reject, use nullobjects
- Prefer lambdas over blocks and procs for their closure model
- Prefer Polymorphism/composition to inheritance
- Real Duck Typing is not done by checking class or method, just call it
- Coerce values to avoid nils - to_s, to_str, to_a, to_ary, to_i
- Idempotent if at all possible
- Responsible for 1 and only 1 behavior
- Composites of other methods, callable via lambdas
- Absent of larger conditional logic than a single ternary or short circuit
- Recursive in nature over loopy
- Stick to MiniTest - it has what you need, you just don't know it yet
- Test double only what you own, wrap external dependencies in methods to isolate them
- Write REAL unit tests, don't test outside your method
- In unit tests, do not hit any external dependencies (databases, rails, disks, code outside your scope)
- Be mindful of functional tests, test the paths that matter to integrate