(April 9, 2010 at 10:26 pm)Tiberius Wrote: This web page: (your URL) discusses the native code compilers for Java, but also some interesting benchmarks that suggest the performance of Java is actually in a lot of cases better than C++, due to the amount of work that has gone into the JVM, compared with some failures in C++ compilers to create efficient native code.I haven't used Java in a pretty long time, so maybe some things have changed. I'll look into that.
I'm clumping these quotes together because they all have the same response...
(April 9, 2010 at 10:26 pm)Tiberius Wrote: You shouldn't have to though, that is the point of consistency. A '+' should always "add" things, whether you are adding together two integers, or two strings (concatenation). A '*' should always multiply, etc, etc.
(April 9, 2010 at 10:26 pm)Tiberius Wrote: Begging your pardon, but this is clearly an absurd example. In Java, if you multiply, you use * (not a Multiply() method) and if you add, you use + (not an Add() method). I'm not sure what experience you have with Java, but if you are honestly suggesting this is how things work, I suggest you take another look...I know that, but that is only true for built-in types. Now what happens when you write your own math class like Point, Vector2/3, Matrix, etc.? Then you are not able to use those operators, because, how will Java know what to add, multiply, etc.? That was my whole point. You have to write methods to do it for you.
(April 9, 2010 at 10:26 pm)Tiberius Wrote: The idea behind consistency is that a programmer can pick up a piece of code, and know exactly what it is doing by looking at it. If you have to learn what * does under a multitude of different types, then the simple code:Almost always, that will be the same thing in C++. Someone could potentially use it for something else (that's what is so great about C++), but why would they? They will most likely implement the equivalent of multiplication for their type.
Code:a * b
could mean any number of things. In Java, it means one thing: a multiplied by b.
(April 9, 2010 at 10:26 pm)Tiberius Wrote: Yes, you should know. However in terms of consistency, knowing shouldn't matter, the == should behave the same way for every object. In fact, checking the reference of an object using == is very useful when coming to design patterns. The Singleton pattern requires it in Java (to detect whether an Object is null), and so you could argue that == is useful for checking the reference of every object in this instance.And it generally does. It generally is used "to check if the left-value is equal to the right-value". But again, the beauty of C++ lets the user do whatever he would like with the == operator.
You could do the same thing in C++ using pointers, and in that case, the "==" is always the same. This is where the argument seems to drift apart. Java, and most other high object-oriented languages, hide the pointer from you and call your object a reference (and rightfully so, of course). C# does the same thing. However, C# took the smart route and inverted Java's method. Operators are overloadable and the base Object class has a few virtual methods such as "Equals", which can compare references. So, if we use pointers in C++ to do what Java does, it works exactly the same. But again, we still have the option to use our overloaded operator by dereferencing the pointer. I don't want to get too technical, but here is an example of my point.
Code:
int *x = &a;
int *y = x;
if (x == y) { .. } // this is a reference equality check
if (*x == *y) { ... } // this is a value equality check
MyWeirdClass *x = &a;
MyWeirdClass *y = &b;
if (x == y) { ... } // this is a reference equality check, our '==' operator is NOT called.
if (*x == *y) { ... } // this is a value equality check, which means it'll call our '==' operator.
(April 9, 2010 at 10:26 pm)Tiberius Wrote: That isn't overloading. X and Y are variables within the class, and if they are primitive types (which they are in Java if I recall - integers) then you are checking the reference (which returns the value stored by the variable).You missed my point. The Point class, as a whole, would implement operators such as "+" and "==". Unless Point is a built-in type (which it probably is, but this is just an example), you cannot check if the two points are equal without expanding it out to what I showed above, instead of simply doing:
Code:
if (point1 == point2) { ... }
as that would compare the references, not the values. That is why operator overloading is useful. Imagine if Java didn't implement a Matrix class (it probably did, I don't know) and you had to write your own. Your class would have to implement "add", "subtract", "multiply", etc. methods to do operations on the matrix, which should naturally be written out as a multiplication symbol, addition symbol, etc.
(April 9, 2010 at 10:26 pm)Tiberius Wrote: I want an IDE I can actually use. What is the point of having an IDE that only runs on Windows if I want to take my work home from the office and I run Linux or Mac? In my opinion, a good IDE should support multiple Operating Systems. If you only use Windows-only programming languages, then I can understand why you'd love Visual Studio more than anything else. I use three different operating systems with different languages that are all multi-platform (Java, Ruby, PHP); I need a powerful IDE, and that would be NetBeans.I absolutely love Visual Studio when programming on Windows. For PHP, and all of those other similar languages, I use notepad++ because I don't care too much for the bulk of a full IDE. However, when developing on Linux I tend to use (depending on my mood) either gedit or Code::Blocks. But no way in hell would I choose Code::Blocks over Visual Studio if I am compiling/working on Windows. Even if my project is cross-platform, I still create a Visual Studio project for Windows, and generally just have a makefile for linux.
(April 9, 2010 at 10:26 pm)Tiberius Wrote: Well it is a fair comparison. Java is designed to run on multiple operating systems...C# has yet to implement that feature. I love the logic of blaming a company that doesn't have any responsibility to port these things across though...good show. Novell port things because Microsoft don't want to.I meant "they must be regretting it now" jokingly, only semi-serious. .NET has taken a lot of competition from Java, including on mobile devices, however. Probably not enough to hurt Sun, but Microsoft has in fact taken some of the competition. I wasn't saying that C# vs. Java wasn't a fair comparison. I was saying that Java vs. Mono was an unfair competition.
You originally said that Sun must have been regretting the decision that led to Microsoft making C#. Well, C# still isn't multi-platform, so it isn't a competitor to Java in that field. It's only an unfair comparison if you asume that C# wasn't a competitor to Java, which you seem to think it was...
What you were doing was comparing another company's funded implementation of the language to that implementation of the original developer. Compare Microsoft's implementation of C# to Sun's implementation of Java, not Novell's implementation of Mono to Sun's implementation of Java. That's all I meant. I never agreed that Novell did a bad job at implementing it either, I was in no way blaming that company for anything. I'm not sure where you got that from. And yes, Novell is funding the porting of .NET, so they did take the responsibility of mono - keep that in mind. But again, I'm not blaming Novell for anything. I, for one, think they've done a great job and I'm glad they ported silverlight and .NET.
(April 9, 2010 at 10:26 pm)Tiberius Wrote: A low-level programming language runs on a specific instruction set architecture with little to no abstraction. It also doesn't have a compiler since it is written for the processor.I never said that C++ was exactly a "low-level" language. I said it was low-levelish by today's standards. So are you saying that ASM (NASM, for example) isn't a low-level language (it does 'compile' (depending on what you mean by that word))?
(April 9, 2010 at 10:26 pm)Tiberius Wrote: C++ isn't written for a specific instruction set (it is compiled down to one), contains abstraction, and has a compiler. Ergo, not a low-level programming language in any sense of the wordAgain, I never said it was. I said I considered it "low-leveish" compared to the higher leveled languages we have today.