• (cs)

    So, please fill me in: In what regard are ENUMs in any other language more useful than Java's?

  • No one (unregistered)

    The WTF was how he used them, not the language construct. But let the Java bashing begin ...

  • htg (unregistered)

    Argh, it makes you want to get a gun and shoot people.

  • (cs) in reply to TheRider
    TheRider:
    So, please fill me in: In what regard are ENUMs in any other language more useful than Java's?

    Not actually the point...

  • John Doe (unregistered)

    What is "alma matter"? I think the WTF-U certainly does matter, and that it is the alma mater for the Paula's in this world.

  • AN (unregistered)

    Yeah we've never ended up in quite that bad a trainwreck, but we've definitely run into things that seemed like enums on initial design, but ended up in the database before our clients were done requesting features.

    BTW, as someone who's been away from Java since 1.3 or so, what's the point of the extra stuff in a Java enum? How are these better than enum Foo { bar=1, baz=2 ... } ? Are they like basically static structs?

  • (cs)

    This reminds me of my freshmen year in college, where any sorting I had to write was always bubble sort because it was the simplest to write and I couldn't be damned to remember the other types or look them up.

    I'm now a senior, and mainly use the built in sorts for languages I code in. However, it's my initial answer to just about anything CS-related, even if it's not sort related.

    "So, how do you think Google stores your preferences?" "BUBBLE SORT!"

  • (cs)

    Mmmm, I like the security at WTFU. Intro to CS class at Virginia Tech had online quizzes that were graded by javascript, then the final score on the assignment was posted to a perl script that recorded it. Shockingly I got 100% on all of them....

  • (cs) in reply to John Doe
    John Doe:
    What is "alma matter"? I think the WTF-U certainly does matter, and that it is the alma mater for the Paula's in this world.

    You're new here aren't you? Alex never proof-reads his post, especially since he's got a couple thousand of us to do it for him.

    Besides, I don't care what you say, I will refuse to admin that I'm wrong as well.

  • SomeCoder (unregistered)

    This is probably obvious but I want to say it. Tool Blame is such a WTF but we need to remember that sometimes, Tool Blame is valid. As someone who has delved into the inner workings of parts of the .NET framework, I can safely say... WTF???????

    But this definitely is an example of a WTF Tool Blame.

  • Goldscott (unregistered)

    You know you've been at a computer too long when you misspell "admit" with "admin," simply because that's what your fingers are used to typing.

    CAPTCHA: stinky. but i just got out of the shower.

  • (cs) in reply to Pap
    Pap:
    TheRider:
    So, please fill me in: In what regard are ENUMs in any other language more useful than Java's?
    Not actually the point...
    I figured :-)

    ENUMs are pretty much static in all languages I know of. Thus, if requirements are static, or the only people having to fumble with them are the server-side developers, ENUMs might be fine. Requirements change all the time, naturally, and if users are supposed to be able to change run-time properties, and that fact was known from the start, then, of course, some more dynamic approach of any kind would be a good start, right from the start.

  • (cs) in reply to AN
    AN:
    BTW, as someone who's been away from Java since 1.3 or so, what's the point of the extra stuff in a Java enum? How are these better than enum Foo { bar=1, baz=2 ... } ? Are they like basically static structs?
    In general, adding extra stuff to an enum is a backward approach. It's strong coupling. What Enric should have been doing was using enums the way all languages have used them for years, as simple closed value sets.

    Any other information one wishes to associate with enums can be, and should have been, associated with the enum values using a Map. Java even has a special high-performance class for that, EnumMap.

    I hope it's true that Enric eventually realized his mistake, and came to understand the drawbacks of tightly binding so much of his application to his data objects.

  • Pecos Bill (unregistered) in reply to vt_mruhlin
    vt_mruhlin:
    Shockingly I got 100% on all of them....

    PRICELESS! No doubt you earned them due to your knowledge.

    It would seem to me that enums would be handy for Error code mappings but I'm not a Java geek.

    So, can one actually be fired from a Work Study for incompetence? I'm guessing no.

  • (cs)

    Blaming the tool is only forgivable if it's PHP, but Java? I don't use it but it got one of the most consistent APIs out there (excluding 3rd party frameworks).

  • steve (unregistered) in reply to vt_mruhlin
    vt_mruhlin:
    Mmmm, I like the security at WTFU. Intro to CS class at Virginia Tech had online quizzes that were graded by javascript, then the final score on the assignment was posted to a perl script that recorded it. Shockingly I got 100% on all of them....

    Reminds me of a Graduate-level course in s/w engineering on testing, verification & validation that I took. Online class. A dozen reading assignments, with a quiz afterwards. The questions from the quizzes were taken word from the reading. To pass the quizzes, open another browser window, pull up reading assignment, Ctrl-F [unique set of words]. The questions were in the same order that content was presented.

    Oh, and the final was entirely questions from the quizzes.

    Surprisingly I did well. :)

  • (cs)

    I blame a lot of bad code on the tools I work with.

  • (cs) in reply to akatherder
    akatherder:
    I blame a lot of bad code on the tools I work with.
    Hmmmm.... I blame a lot of bad tools on the code I work with.

    I inherited a boatload of spaghetti that looks like it spent 2 years in a blender on puree. The tools I am stuck using are required because there are no other tools that work within the context of our architecture sighs

    I tend to copy the code into Eclipse (not that I like Eclipse, mind you, there's nothing wrong with it; personally I just don't care for it), work with it, then copy it back. It's a pain, but a lot less painful than the older tools.

    This place needs to upgrade to the 1980's toolsets...

    :bangs head on desk:

    [Edit] make that 1990's toolsets

  • (cs) in reply to snoofle
    snoofle:
    akatherder:
    I blame a lot of bad code on the tools I work with.
    Hmmmm.... I blame a lot of bad tools on the code I work with.

    I inherited a boatload of spaghetti that looks like it spent 2 years in a blender on puree. The tools I am stuck using are required because there are no other tools that work within the context of our architecture sighs

    I tend to copy the code into Eclipse (not that I like Eclipse, mind you, there's nothing wrong with it; personally I just don't care for it), work with it, then copy it back. It's a pain, but a lot less painful than the older tools.

    This place needs to upgrade to the 1980's toolsets...

    :bangs head on desk:

    [Edit] make that 1990's toolsets

    Ok, I was talking about the tool sitting over there.

  • (cs) in reply to No one

    It will be curious to read the comments on this one; very few people here seem to recognize that they are responsible for the code they write, not the tools they are using. I've never seen any "programming" community place so much blame on technology when defending bad code or claiming that it is not possible to write good code in a particular language.

    Will people understand this post or start bashing java? Will they start comparing enums in java with enums in other languages and debating which language could best implement the code this person was trying to write? Will they comment on how enums are handled in C versus VB6 and then complain how VB6 forces them to use enums incorrectly? Will they come up with new and inventive ways to dynamically alter enums at runtime??

    I can't wait to find out! One things is for sure: when it comes to "Tool Blame", we have many experts here ....

  • PS (unregistered) in reply to John Doe
    John Doe:
    What is "alma matter"? I think the WTF-U certainly does matter, and that it is the alma mater for the Paula's in this world.

    That's the college that all physicists went to obviously. It doesn't take an Einstein to know that. By the way, if you have never heard of Einstein then you can find his website at www.emc.com. Weird though, the slogan is "where information lives" but this Einstein dude is dead.

  • Kiasyn (unregistered) in reply to htg

    with this! http://tinyurl.com/33q94b

  • some guy (unregistered) in reply to CapitalT
    CapitalT:
    Blaming the tool is only forgivable if it's PHP, but Java? I don't use it but it got one of the most consistent APIs out there (excluding 3rd party frameworks).

    I am not a java hater, but consistent API?

    Some examples from http://mindprod.com/jgloss/gotchas.html

    // ways to set text in a component TextField.setText(); Label.setText(); Button.setLabel(); AbstractButton.setText(); Frame.setTitle();

    // ways to change an element setCharAt(int index, char c ); Vector.setElementAt( Object o, intindex ); List.set( int index, Object o );

    // ways to get length lenOfArray = myArray.length; lenOfString = myString.length(); myList.size();

  • Zomby (unregistered) in reply to CapitalT
    CapitalT:
    Blaming the tool is only forgivable if it's PHP, but Java? I don't use it but it got one of the most consistent APIs out there (excluding 3rd party frameworks).
    Consistent, but bloated beyond excess.
  • natron (unregistered)

    enums are stupid. magic numbers and #DEF is where its at.

  • Scooter Libby (unregistered) in reply to John Doe
    John Doe:
    What is "alma matter"? I think the WTF-U certainly does matter, and that it is the alma mater for the Paula's in this world.

    Brain's younger sister. She's engaged to Pinky.

  • Kinglink (unregistered)

    Tool Blame? more like Tool misunderstanding. These Java enums sound somewhat interesting (better than C++ in some ways but not enough to give up my non virtual machine based language).

    This is like the guy who writes his own obscure language program to work with a Database format he comes up with because he doesn't know SQL, and then complains when he has to convert the whole thing into SQL.

  • (cs)

    I think we have a new definition for "WTF": "Was Tool's Fault"

  • Paul (unregistered) in reply to AN
    AN:
    BTW, as someone who's been away from Java since 1.3 or so, what's the point of the extra stuff in a Java enum? How are these better than enum Foo { bar=1, baz=2 ... } ? Are they like basically static structs?
    Enums in Java are pretty much full fledged classes. Each enum constant can call any constructor you provide, and the enum class you create can have its own static and instance methods. Each enum constant can even be its own inner class; e.g., define an abstract method in the enum class and implement it in the constant. Off the top of my head (there may be typos):
    public enum TestEnum {
      VALUE1(1, "Value 1") {
        public int testMethod(int a, int b) {
          return a + b;
        }
      },
      VALUE2(2, "Value 2") {
        public int testMethod(int a, int b) {
          return a * b;
        }
      },
      VALUE3(3, "Value 3", true) {
        public int testMethod(int a, int b) {
          return a - b;
        }
      };
      public final int id;
      public final String displayName;
      public final boolean isSpecial;
    

    TestEnum(int _id, String _displayName) { this(_id, _displayName, false); } TestEnum(int _id, String _displayName, boolean _isSpecial) { this.id = _id; this.displayName = _displayName; this.isSpecial = _isSpecial; }

    public abstract int testMethod(int a, int b); }

  • Paul (unregistered)

    I forgot to add to my enum post above that what's nice about this is now you can keep everything about the enum constant in one place: internal ids, display names, descriptions, database representation, even how it is used, can all be stored in the enum. Enums can even implement interfaces, so multiple types of enums can have methods in common. Of course, it can be taken too far, but overall they're an excellent addition to Java, and can really help in maintainability

  • (cs) in reply to AN
    AN:

    BTW, as someone who's been away from Java since 1.3 or so, what's the point of the extra stuff in a Java enum? How are these better than enum Foo { bar=1, baz=2 ... } ? Are they like basically static structs?

    Java's enums allow an easy and standardized way of converting from Strings to enums. In C++, some framework must be invented for converting external data into enums.

    For example:

    enum Colors { RED, GREEN, YELLOW }; Colors c = Colors.valueOf("GREEN");

    if( c == null ) { System.out.println("Not a valid color"); else dye(c);

  • RON (unregistered)

    The REAL WTF is Java trying to redefine what an enum is.

  • (cs) in reply to vt_mruhlin
    vt_mruhlin:
    Mmmm, I like the security at WTFU. Intro to CS class at Virginia Tech had online quizzes that were graded by javascript, then the final score on the assignment was posted to a perl script that recorded it. Shockingly I got 100% on all of them....

    Only 100? I got 150

  • anony-moose (unregistered) in reply to SuperousOxide
    SuperousOxide:
    vt_mruhlin:
    Mmmm, I like the security at WTFU. Intro to CS class at Virginia Tech had online quizzes that were graded by javascript, then the final score on the assignment was posted to a perl script that recorded it. Shockingly I got 100% on all of them....

    Only 100? I got 150

    I got FILE_NOT_FOUND :(

  • Anonymous (unregistered)

    I got MAYBE.

  • trianglman (unregistered) in reply to CapitalT
    CapitalT:
    Blaming the tool is only forgivable if it's PHP, but Java? I don't use it but it got one of the most consistent APIs out there (excluding 3rd party frameworks).

    Blaming the tool is rarely forgivable. It is much more often a case of using the wrong tool. I wouldn't use C to write a quick text parsing script no more than I would use PHP to write a desktop app. But there are very few languages that don't have their place (personally, PICK BASIC is one of those few, although I am sure it might have been useful 15+ years ago.)

  • Scottford (unregistered)

    How about a new WTF policy: auto-delete of any post containing the text "CAPTCHA:".

    CAPTCHA: paint. We should paint this policy in big red letters.

  • diaphanein (unregistered) in reply to Scottford

    So the saying does, when you hold in your hand a hammer, everything looks like a nail.

  • moe (unregistered)

    The REAL WTF is that some people use VB!

    captcha: stinky, the one he smelt it - dealt it

  • (cs) in reply to trianglman
    CapitalT:
    But there are very few languages that don't have their place (personally, PICK BASIC is one of those few, although I am sure it might have been useful 15+ years ago.)

    I don't know about today, but I believe 15 years ago, the New York City Public Library computers used Pick BASIC. :-)

    <NITPICK> Pick is not an acronym and should not be all caps. Dick Pick would be insulted.</NITPICK>

  • AN (unregistered)

    Paul,

    Thanks for the response. I'm not sure if I like this type of enum or not, but it's definitely an interesting idea.

    One thing that leaps to mind is that if there weren't too much code associated with it, you could adapt things like a strategy pattern to run everything directly inside an enum.

  • Harrow. (unregistered) in reply to John Doe
    John Doe:
    What is "alma matter"?
    It's where the soul meets the road.

    -Harrow.

  • Kyle (unregistered) in reply to Rick

    A dick pick nit pick?

  • (cs) in reply to vt_mruhlin
    vt_mruhlin:
    Mmmm, I like the security at WTFU. Intro to CS class at Virginia Tech had online quizzes that were graded by javascript, then the final score on the assignment was posted to a perl script that recorded it. Shockingly I got 100% on all of them....

    Given it's just an intro class, I'd say anyone with the wherewithal to hack the grading system deserves 100%.

  • (cs) in reply to Kyle
    Kyle:
    A dick pick nit pick?
    I was afraid I was too subtle. Thanks.
  • (cs)

    I fully sympathize with Enric. I don't know how many times I've run up against the limits of a tool. For example, I've yet to find a language that allows you to programmatically change the value of a constant. What's up with that?

    Compilers --that's another thing. Why can't they make one that actually works? Every time I use one it does nothing but spit out errors.

    That reminds me: when is this new forum software going to be updated to let users see a registered commenter's bio?

    --Rank

  • mysterious.e (unregistered) in reply to Rank Amateur

    Just think, this poor guy used enums when he could have used agile soa.

    Who needs to use a database, or research technology best practices, when you can use agile soa.

    Go figure.

    ;)

  • stratos (unregistered) in reply to trianglman
    trianglman:
    [..SNIP...] BASIC is one of those few, although I am sure it might have been useful 15+ years ago.)

    I know a now still working system based on GW basic and remote PC, that does the counting of all produce of a farmers cooperation.

    For as far as i know, it's still in operation.

  • (cs) in reply to No one
    No one:
    The WTF was how he used them, not the language construct. But let the Java bashing begin ...
    CapitalT:
    Blaming the tool is only forgivable if it's PHP, but Java? I don't use it but it got one of the most consistent APIs out there (excluding 3rd party frameworks).
    Holy reading comprehension, Batman. Did we read the same article?
  • iToad (unregistered) in reply to Rank Amateur

    Old school Fortran. You could pass a constant as a parameter to a subroutine, and then change it within the subroutine. This feature, combined with punched card input, made debugging a character-building experience.

    Brings back fond memories...

Leave a comment on “Tool Blame”

Log In or post as a guest

Replying to comment #:

« Return to Article