Mar-15-2021, 06:33 AM
Yeah, functions should be doing one thing. I find test-driven development a great way to design - by starting with a test, you're focussing on the "what" before the "how" (that is, what the component does and its interface before how that is implemented). Obviously if you have existing code to refactor, then getting tests in place first (if you don't have them) will allow you to refactor safely.