> Roy Smith <r...@panix.com> > As part of our initial interview screen, we give applicants some small > coding problems to do. One of the things we see a lot is what you could
> call "Java code smell". This is our clue that the person is really a > Java hacker at heart who just dabbles in Python but isn't really fluent. > ... > It's not just LongVerboseFunctionNamesInCamelCase(). Nor is it code > that looks like somebody bought the Gang of Four patterns book and is > trying to get their money's worth out of the investment. The real dead > giveaway is when they write classes which contain a single static method > and nothing else. I may have some lingering Java smell myself, although I've been working mostly in Python lately, but my reaction here is that's really I don't know "BASIC smell" or something; a class that contains a single static method and nothing else isn't wonderful Java design style either. > That being said, I've noticed in my own coding, it's far more often that > I start out writing some functions and later regret not having initially > made it a class, than the other way around. That's as true in my C++ > code as it is in my Python. Definitely. > Once you start having state (i.e. data) and behavior (i.e. functions) in > the same thought, then you need a class. If you find yourself passing > the same bunch of variables around to multiple functions, that's a hint > that maybe there's a class struggling to be written. And I think equally to the point, even if you have only data, or only functions, right now, if the thing in question has that thing-like feel to it :) you will probably find yourself with both before you're done, so you might as well make it a class now... DC
-- http://mail.python.org/mailman/listinfo/python-list