
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
> If an IDE is a way to avoid knowing the language, or to avoid
> understanding
> your own code, I'd rather avoid the IDE.
> A student who doesn't know that an Integer is an object needs a kicking,
> not a safety net.
> (I say a student, assuming that nobody could possibly be working as a
> programmer and make this mistake... if I'm wrong, I'm sure I'll read
> about
> it on the Daily WTF, no need to make me sad by robbing me of my
> comforting
> illusions on a nice Saturday like this one)
You don't know how many pieces of code I've professionally reviewed and
contained that bug. That's why FindBugs is fundamental.
--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
fabrizio...@tidalwave.it
http://tidalwave.it - http://fabriziogiudici.it
"Also, knowing that Integers are objects isn't the problem, it's that == succeeds sometimes."That's for sure. I don't remember who said it, but this is a case of "syntactic sugar leads to cancer of the semicolon". I still say it's the programmers job to know the language, and part of that is knowing that object comparison with == is always wrong, even if the implementers have made a stupid decision to make it work for some arbitrary values. Really, it's not a particularly obscure or subtle fact about the language.
--
That's lovely, but doesn't help at all when you inherit code that does it wrong. :)
On Sat, Mar 10, 2012 at 6:20 PM, Jon Kiparsky <jon.ki...@gmail.com> wrote:
"Also, knowing that Integers are objects isn't the problem, it's that == succeeds sometimes."That's for sure. I don't remember who said it, but this is a case of "syntactic sugar leads to cancer of the semicolon". I still say it's the programmers job to know the language, and part of that is knowing that object comparison with == is always wrong, even if the implementers have made a stupid decision to make it work for some arbitrary values. Really, it's not a particularly obscure or subtle fact about the language.
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+unsubscribe@googlegroups.com.
Well... I would say actually, that this is one of these cases where the Language has it wrong ...... and now every developer dow that road has to pay the tax of knowing that "thee shall never use == for comparing objects for equality. And oh, by the way, Integer is an object too..."
laupäev, 10. märts 2012 23:23.28 UTC+2 kirjutas Ricky Clarkson:That's lovely, but doesn't help at all when you inherit code that does it wrong. :)
On Sat, Mar 10, 2012 at 6:20 PM, Jon Kiparsky <jon.ki...@gmail.com> wrote:
"Also, knowing that Integers are objects isn't the problem, it's that == succeeds sometimes."That's for sure. I don't remember who said it, but this is a case of "syntactic sugar leads to cancer of the semicolon". I still say it's the programmers job to know the language, and part of that is knowing that object comparison with == is always wrong, even if the implementers have made a stupid decision to make it work for some arbitrary values. Really, it's not a particularly obscure or subtle fact about the language.
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To view this discussion on the web visit https://groups.google.com/d/msg/javaposse/-/tKKTvZCNqToJ.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
Well... I would say actually, that this is one of these cases where the Language has it wrong ...
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
I'd say smalltalk (a 70's language) had it right, make *everything* an object.
> On Sun, Mar 11, 2012 at 10:09 AM, Kevin Wright
> <kev.lee...@gmail.com>wrote:
>
>> I'd say smalltalk (a 70's language) had it right, make *everything* an
>> object.
>
>
> Define "right". I used a lot of Smalltalk during my PhD in the early 90's
> and while the environment was revolutionary on many fronts, it was also
> very, very slow (both the IDE and the programs it created). I'd argue
> that
> one of the many reasons for this was because everything was an object.
In fact SmallTalk, from the industrial point of view, is a failure.
Fortunately Java has got non-object primitives and it allows to do number
crunching. All this discussion originates from a typical programmer's
error blaming the language, and for controlling that error we've got
plenty of tools, as if it was the only error that programmers do in Java.
> Primitives are good... if you're a CPU. I have absolutely no objection
> to
> the performance benefits of primitives in bytecode (in the earlier
> pre-JIT
> interpreters at least, the benefit is less clear in a post-JIT world).
>
> But what's in bytecode for the benefit of the compiler needn't be what's
> in
> the language for the benefit of programmers. A translation in javac
> would
> allow Java to have pure objects whilst maintaining primitives in
> bytecode;
> just as javac allows us to create inner classes, even though the
> underlying
> platform has no idea of the concept. We *can* have our cake and eat it
> too.
>
> As for why it's right for everything to be objects? It's a far cleaner,
> more elegant, and a more internally consistent model for programmers to
> reason about. The very existence of this thread illustrates why that's
> important!
>
> To quote: "premature optimisation is the root of all evil", and you can't
> get much more premature than in the design of a language...
I won't object to anything you wrote - I'm just pointing out that in 1995
betting that the compiler could do all the involved magic, and in an
efficient way, was probably a hazardous bet.
I also think it is probably an overstatement to think it was the
existence of primitives that "won" the battle for java, and not a
ridiculously effective marketing push by those involved.
I don't recall it being that feeble. Seemed that Sun took great
efforts to get Java in many college intro courses.
Marketing helped (especially to schools/universities), as did garbage collection and low level concurrency primitives out of the box, faster compilation, saner error messages, and a rich standard library available for free (including AWT).
But I don't believe that anybody every thought "ooh, primitives, I must use this language because it'll be so fast". Not when it was (then) interpreted, and therefore slow for other reasons. The only real benefit of primitives was an apparent passing familiarity to C++ devs.
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
Scala doesn't really have primitives, but doesn't allocate a wrapper object for Ints unless it really needs to, and in Scala List[Int] works, 5.toString works and if you do happen to use java.lang.Integer instead of Int, its == actually does the right thing
On Mon, Mar 12, 2012 at 10:30 AM, Josh Berry <tae...@gmail.com> wrote:On Mon, Mar 12, 2012 at 12:53 PM, Fabrizio GiudiciI also think it is probably an overstatement to think it was the
<Fabrizio...@tidalwave.it> wrote:
> I won't object to anything you wrote - I'm just pointing out that in 1995
> betting that the compiler could do all the involved magic, and in an
> efficient way, was probably a hazardous bet.
existence of primitives that "won" the battle for java, and not a
ridiculously effective marketing push by those involved.No single criterion won, obviously, but I think that Java's decision to use primitives was instrumental to its success.