3 ms·
Why not make lots of simple single-purpose modules? My policy is that if I find myself doing something over three times and it's easily isolated and contained,
by TheAceOfHearts 12y ago
Why not make lots of simple single-purpose modules?
My policy is that if I find myself doing something over three times and it's easily isolated and contained, I'll make it into a module. Then I can write a few tests for that code, I know it'll always work, and I won't have to think about it again. Even if it's something that's not hard, you don't want to stop focusing on your main task to implement some helper that you've already done before.
There's also a really strong argument when it comes to browser support: supporting and testing lots of things on old browsers is hard. But if you break stuff out into small modules you can test it easily in isolation and know it works in all your test browsers.