4 ms·
Interesting post. I have found myself doing a lot of the same things through my own experience. One thing I have been striving for lately is to build functional
by mberning 10y ago
Interesting post. I have found myself doing a lot of the same things through my own experience. One thing I have been striving for lately is to build functionality using relatively more small methods that accept paramters as opposed to using state which is stored in instance variables. I find that this makes my life easier when writing tests and also helps identify corner and edge cases that I may not have thought about. And when something does break it is usually very easy to add a failing test, fix the code, and see that everything is now working. Also makes me a lot more confident when I go to refactor. Sandi Metz gave a great talk on the gilded rose problem that explores these concepts.
- emodendroket 10y agoI find myself doing the same.
- lisivka 10y agoIt's called Inversion of Control (IoC)[1]. It's arises naturally when code is used in more than one place. [1]: https://en.wikipedia.org/wiki/Inversion_of_control https://en.wikipedia.org/wiki/Inversion_of_control
- Kiro 10y agoHow do you avoid the parameters from getting bloated? Like having to pass the same dependencies into every method.