| 1. | simon - 01 04, 2007 @ 09:07AM |
Actually I reckon that the compile-time spell checking is actually a pretty good reason to do it. That and refactoring support.
I'm no Java development apologist, though -- I hate the layers of crap that a lot of Java projects end up in (although I've been involved in ones that didn't). If there were some syntactic sugar to make that look less lame, I'd use it. But one of the things that annoys me most about Ruby and other dynamic languages is that there's no ability to do simple spell checking, and pretty bad chances for refactoring support.
That code you've outlined there is certainly the best way to do it in Java as it stands now. The other options are nowhere near as good: put string constants throughout your code (urgh) or use an int or something (also urgh). In C# you could use an enum, which might improve things a little, but would still be reasonably urgh.




Post a Comment