3 ms·
Classes are overrated. If you work from a more functional over oo mindset, you'll find that you really don't need them. Not to mention doing unit testing in J
by tracker1 12y ago
Classes are overrated. If you work from a more functional over oo mindset, you'll find that you really don't need them. Not to mention doing unit testing in JS doesn't require the mental spaghetti of interfaces or IoC/DI that it does in strongly typed languages.
If you use a module/builder system in JS, you can do composition and testing that most other languages simply don't hold a candle to. Including Java/C# and plenty of others. If you include Browserify+BabelJS it gets better still.
Just because you have trouble wrapping your head around the concept of modules or object composition without classes doesn't mean everyone lacks that skillset.
/rant
- lmm 12y ago> Classes are overrated. If you work from a more functional over oo mindset, you'll find that you really don't need them. I do work in a functional mindset. I still find that I need them often, for cases where one case needs to be handled differently from others, which is a very common business requirement. Something like typeclass deriving can help, but javascript doesn't have that. > doing unit testing in JS doesn't require the mental spaghetti of interfaces or IoC/DI that it does in strongly typed languages. You don't have to do it that way if you don't want to - even in humble java it's trivial to mock any object or none if that's what you want. I like having explicit interfaces - they're what make it possible to maintain big codebases.