3 ms·
I'm not much of a python programmer, but in Java I use classes all the time. The main reason is that small classes make writing unit tests easy. I can use a moc
by kjlef 15y ago
I'm not much of a python programmer, but in Java I use classes all the time. The main reason is that small classes make writing unit tests easy. I can use a mocking library like http://www.easymock.org/ http://www.easymock.org/ to mock out whatever dependencies the code I'm trying to test depends on.
I agree on some of the presenters philosophical ideas, mainly that adding complexities into the codebase before they're needed is almost always a terrible idea, but saying that classes lead to complex code is simply not true, at least in my experience.
- aroberge 15y agoOf course you use classes all the time in Java: it forces you to do so by design. I have significantly more experience with Python than with Java and I find that writing unit tests on functions is as easy if not easier than writing tests for (small) classes. And Diederich's point about small classes being a code smell (my words - not his) is hard to refute.