3 ms·
> Less code, loose coupling. Do one thing and do it well. Keep the external API simple. > It's always easier to change a small thing instead of a large thing.
by nikofeyn 7y ago
> Less code, loose coupling. Do one thing and do it well. Keep the external API simple.
> It's always easier to change a small thing instead of a large thing. So make a small thing, and only make it a big thing if you absolutely have to.
this is along the lines of what i was going to suggest. i prefer to code everything such that it does just one thing that is appropriately at the level or context it sits at.
a function should just do one thing and have reliable outputs based upon inputs. a class should represent one thing. class methods should do one action. modules should collect functionality that does a thing. processes and servers should do a thing. and so one. if you build your system out of things only doing the thing they say they do, then it becomes clear when they're being changed in incorrect ways.