![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
I am looking at Java and Python and like to know if Java is an interpreted language. What are its benefits over a language like C++?
__________________
I looked it up on the Intergnats! |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: MA, US
Posts: 204
Rep Power: 4
![]() |
Java is a strongly typed, compiled language. Learn C++ or Java before Python. Google C++ vs. Java for more information about their differences.
__________________
"A stupid man's report of what a clever man says can never be accurate, because he unconciously translates what he hears into something he can understand." - B. Russell http://web.bryant.edu/~srk2 |
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
The ostensible benefit to Java (aside from language-utility issues) is that it compiles to byte-code. Machines which have a JVM (java virtual machine) then map the byte code to the appropriate machine instructions. This supposedly provides a "write once, run anywhere" capability, no porting issues. All JVMs are not created equal. As Grumpy has said, it sometimes results in a "write once, debug everywhere" situation. MS's C#/VB ala .NET entree (I'll take Eggs Benedict, thank you) is supposed to capitalize on the same approach (distributable byte code or whatever name is the flavor of the day) and it would be great for El Bill if he could succeed well enough to make substantial inroads on the Java market.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4
![]() |
Another benefit of Java over C++ (specifically) is that while they're both C-derived object oriented languages, Java is a bit neater and simpler. C++ has been accused of being a bag on the side of C - i.e. a big lump of irrelevant extra features - and while this isn't necessarily fair, it's certainly not as neat and 'pretty' (for want of a better word) as Java.
C++ is a bit of an industrial strength language. I suppose Neal Stephenson might call it the "Hole Hawg" of programming languages. Java is a bit like a cute, cut-down C++, lacking features like operator overloading and multiple inheritance. The absence of these features could be good or bad - depending on who you ask - but there's no denying it's simpler and therefore ought to be easier to learn. As a beginner's language, I'd recommend Java over C++. Both are commercially and practically reasonable first choices, and Java's simplicity and essential similarity to C++ make it the better of the two in my opinion. Even little things like having a universal, standard abstract windowing toolkit (for creating GUI applications) rather than a whole horde of competing ones makes it more appealing to a newcomer. |
|
|
|
|
|
#5 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
Thank you very much for the nice answers! I am still a little confused.
I know that C++ code compiles and then links to give an executable file (.exe). Python compiles to a byte code and is then interpreted. Is Java more like Python or more like C++?
__________________
I looked it up on the Intergnats! |
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() |
It's more like C++ in my mind, but i wouldn't trust my mind.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#7 | |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
Quote:
|
|
|
|
|
|
|
#8 | ||
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
This makes it faster than interpretted languages, since it only reads through the user's code once. After that, it uses the intermediate object code to determine what to do. Java, on the other hand compiles into low level bytecode, rather than higher level object code, and this probably gives it a benefit in speed. Correct me if I'm wrong, but I believe Java can also be compiled to native machine code using gcj. Once that's done, the JVM isn't needed (although the Java SDK is needed for compilation). Python, on the other hand, can only currently be turned into an exe via a wrapper, such as py2exe. And that's not exactly a neat and tidy process ![]() Quote:
Python, on the other hand, has more in common with ABC and Modula 3, at least according to this diagram. As a language, Python has a more advanced syntax than Java, but tends to be slower to execute. ( Programming Languages are something of an interest of mine )Last edited by Arevos; Aug 20th, 2005 at 7:03 PM. Reason: correction |
||
|
|
|
|
|
#9 | |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
Quote:
Thanks for the info and the GCJ link. |
|
|
|
|
|
|
#10 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5
![]() |
Java (like any language, actually) can be compiled to native machine code if someone puts in the effort to write a suitable compiler. In practice, Java is usually compiled to java bytecodes, which implies a need for a JVM to interpret them.
Strictly speaking, Java can be dynamically compiled (just look up topics like JIT [Just In Time] compilation). Like Pyton, it blurs the distinction between an interpreted language and a completely compiled one. I would say that Java has little in common with C++ although, syntactically, it looks rather similar. It does well in some niche areas (eg rapid prototyping, applications that can run in a web browser), but those areas are rarely targetted by C++ programmers. It also forces programming in particular styles, regardless of what one is trying to do, which tends to rub experienced C++ programmers the wrong way. Java is significantly simpler than C++ (which is either an advantage or a disadvantage, depending on what you're trying to do). The reliance on garbage collection makes life easier for the programmer for some types of work (eg without gc, it would be very difficult to write non-trivial web applets), but makes it much harder in other ways (eg unpredictable performance hit makes Java less suitable for hard real time or mission critical applications, even if the RT java extensions are employed). |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|