In TA'ing a beginning Java class last year, the most typical use of static I
saw in student assignments was actually a misuse.  Students tended to blur
the distinction between a class and an object, and they'd try to call a
method, when they had not instantiated an object yet, and of course get an
error message.  They'd try making the method static, which in turn caused
other errors, requiring them to make other methods and member variables
static as well.  They'd basically end up with a totally static class that
they used as a singleton.  In some cases that ended up being OK; but you can
see how it can lead to hard-to-diagnose bugs if you don't really understand
the issue.

So, throwing the word static in to make the compiler happy is not a
normative usage of static, but I'd have to call it typical, at least in one
population of fledgling programmers.

Chris Bogart
bog...@eecs.oregonstate.edu

Reply via email to