This discussion is archived
1 2 Previous Next 22 Replies Latest reply: Mar 18, 2008 9:31 AM by 807601 Go to original post RSS
  • 15. Re: diff b/w String str="somestring" and String str=new String("somestring"
    807601 Newbie
    Currently Being Moderated
    yawmark wrote:
    I think a lot of beginner problems with Java would be solved...
    ...if it were a compiler error to import javax.swing with less than six months' experience.
    Oh! I like this! Can we extend that to some other packages as well? Basically everything starting with "javax.".
    ...if Java did what was expected of it rather than what it was told.
    Oh my god! No! The only thing worse than a computer that does exactly what you tell him to do, is a computer trying to do what it thinks you might want him to do ... or something like that.
  • 16. Re: diff b/w String str="somestring" and String str=new String("somestring"
    807601 Newbie
    Currently Being Moderated
    ...if Vector didn't exist.
    ...if generics weren't added to the language.
    ...if enums weren't added to the language.
    ...if there was no post-increment operator.
    but beginners don't go looking for those on their first day
    ...if there were no such thing as a classpath and Java automagically found everything it needed.
    I think it should do that anyways. You should never, ever, ever, have to mess with classpath to find a class in your current working directory. Did i mention ever?
  • 17. Re: diff b/w String str="somestring" and String str=new String("somestring"
    3004 Newbie
    Currently Being Moderated
    newark wrote:
    ...if Vector didn't exist.
    ...if generics weren't added to the language.
    ...if enums weren't added to the language.
    ...if there was no post-increment operator.
    but beginners don't go looking for those on their first day
    Maybe, maybe not, but they still find them and use them with little or not understanding of the underlying concepts.

    >
    ...if there were no such thing as a classpath and Java automagically found everything it needed.
    I think it should do that anyways. You should never, ever, ever, have to mess with classpath to find a class in your current working directory. Did i mention ever?
    I disagree. I want it to look exactly where I tell it and nowhere else. Just like PATH. (At least on unix. I don't know if cmd.exe assumes "dot" even when it's not in PATH.)

    (And on unix, I never put "dot" in my path.)

    Edited by: jverd on Mar 18, 2008 1:45 PM
  • 18. Re: diff b/w String str="somestring" and String str=new String("somestring"
    807601 Newbie
    Currently Being Moderated
    newark wrote:
    ...if there were no such thing as a classpath and Java automagically found everything it needed.
    I think it should do that anyways. You should never, ever, ever, have to mess with classpath to find a class in your current working directory. Did i mention ever?
    Additional requirement:

    Java should never, ever, ever mess up my program, just because I've got some old debug classes laying around in the current directory, even though I very explicitly made sure that the current directory is not on the classpath. Granted, this won't come up as often, but still ...
  • 19. Re: diff b/w String str="somestring" and String str=new String("somestring"
    3004 Newbie
    Currently Being Moderated
    newark wrote:
    I think a lot of beginner problems with Java would be solved if
    String s = "java";
    caused a compile error.
    Maybe, but then, being intuitive for beginners is not one of Java's goals, nor should it be.
  • 20. Re: diff b/w String str="somestring" and String str=new String("somestring"
    807601 Newbie
    Currently Being Moderated
    jverd wrote:
    newark wrote:
    I think a lot of beginner problems with Java would be solved if
    String s = "java";
    caused a compile error.
    Maybe, but then, being intuitive for beginners is not one of Java's goals, nor should it be.
    The problem is that "making it easy for beginners" and "making it powerfull for experts" are hard to do at the same time.

    In recent time I come to think that a dedicated learning environment such as BlueJ is actually the correct approach. You can hide away some of the nitty-gritty details (public static void main, classpath, public-class-in-file-with-same-name, ...) and as long as you make the student understand that this is in fact not 100% the same thing as "the real Java" he will learn faster and still be able to learn the technical details later on.
  • 21. Re: diff b/w String str="somestring" and String str=new String("somestring"
    807601 Newbie
    Currently Being Moderated
    JoachimSauer wrote:
    newark wrote:
    ...if there were no such thing as a classpath and Java automagically found everything it needed.
    I think it should do that anyways. You should never, ever, ever, have to mess with classpath to find a class in your current working directory. Did i mention ever?
    Additional requirement:

    Java should never, ever, ever mess up my program, just because I've got some old debug classes laying around in the current directory, even though I very explicitly made sure that the current directory is not on the classpath. Granted, this won't come up as often, but still ...
    That's a good point, but wouldn't that be solved by having the CWD be the absolute last place it looks?
  • 22. Re: diff b/w String str="somestring" and String str=new String("somestring"
    807601 Newbie
    Currently Being Moderated
    newark wrote:
    JoachimSauer wrote:
    Java should never, ever, ever mess up my program, just because I've got some old debug classes laying around in the current directory, even though I very explicitly made sure that the current directory is not on the classpath. Granted, this won't come up as often, but still ...
    That's a good point, but wouldn't that be solved by having the CWD be the absolute last place it looks?
    Sure, that would get rid of most of the (already pretty rare) situations where this might be a problem (you can still construct a situation where the presence of a class that would otherwise not be found can lead to a problem).

    And adding this as well, then the problems caused by this addition would probably be reduced to an acceptable amount.

    But in the long run, having a system with simple rules ("look in every location mentioned in the classpath") is simpler to control in complex scenarios than a system with more complex rules that simplify a simple situation further ("look in every location mentioned in the classpath *and* the current directory"). Occams Razor can probably brought into the game somewhere around here.
1 2 Previous Next