will java become the next big language?

Started by
145 comments, last by the_nemesis 22 years, 2 months ago
quote:Original post by sjm
java is already a big language, but no, noone is ever going to write operating systems in java well not ones that anyone''s ever going to use


Java isn''t designed to be a operating system programming language as C is. As Java isn''t executed natively, you''ll always need something native to run Java. Though this might change someday, they''ve tried to design Java processors too, with bad experiences so far :I

^Conrad2k
^Conrad2k
Advertisement
no

face it, to do decent 3d you still need a C++ interface dll etc
"java is already a big language, but no, noone is ever going to write operating systems in java well not ones that anyone''s ever going to use"

Actually, a webcomputer company makes a hand held device that runs Java as an OS, and with an interpreter built (or BURNT) into it''s ROM.
---START GEEK CODE BLOCK---GCS/M/S dpu s:+ a---- C++ UL(+) P(++) L+(+) E--- W++ N+ o K w(--) !O !M !V PS- PE+Y+ PGP+ t 5 X-- R tv+ b+ DI+ D G e* h! r-- !x ---END GEEK CODE BLOCK---
quote:Original post by Andrew Nguyen
"java is already a big language, but no, noone is ever going to write operating systems in java well not ones that anyone''s ever going to use"

Actually, a webcomputer company makes a hand held device that runs Java as an OS, and with an interpreter built (or BURNT) into it''s ROM.


I take it its not written in java tho I had a cpc 464 whose operating system was basic. But they hardcoded that too - which is not the same as actually writing the operating system in basic
THE OS WAS WRITTEN IN JAVA AND RUN THRU A JAVA INTERPRETER

Edited by - Andrew Nguyen on March 1, 2002 7:53:13 PM
---START GEEK CODE BLOCK---GCS/M/S dpu s:+ a---- C++ UL(+) P(++) L+(+) E--- W++ N+ o K w(--) !O !M !V PS- PE+Y+ PGP+ t 5 X-- R tv+ b+ DI+ D G e* h! r-- !x ---END GEEK CODE BLOCK---

conrad2k:

Ok ok... You didn''t call it primitive, and I may have
reacted a bit to quick...
However, I know some java-only programmers, who
just started 2..3 years ago, as uni student,
and, were "forced" to try out c/c++ a bit, but effectively
know nothing about c++ programming.
So they can do nothing in c++, but lots of stuff in java,
which means c++ = crap and java best language ever.
Trying to talk about programming with those guys
can get annoying...





quote:
Have you ever used a development tool that can refactor? Once you pop, you can''t stop Automaticly performed safe refactorings and error highlighting just make your life so much easier. When 99% of the compilations after modifications to the code produce zero errors you''ll start to understand


well, 99% no errors, ok, I have to admit that I have only
90% no errors after compiling modifications in C++
In msvc, or even watcom.
Do you know the watcom c++ 11 IDE?
Stone age...

This color changing in JBuilder may be useful,
but it also can get really disturbing.
(at least to me)

And, believe me, or not, but in my recent projects
all bugs had 0.0 percent to do with pointers / bounds,
and I''m only a hobby programmer, who uses C++
for only 3...4 years !!
(did pascal before)
All that talk about pointers and memory deleting
does really tire me, "problems" that are not such big
as they''re made.

If you follow some "safety conventions",
and get used to it, it takes really "no" effort,
you do it automatically, and no pointer errors
will occur.


Conrad2k:

quote:
So you tell me my friend, how do you catch your exceptions. By instance, reference or pointer? What happens to the allocated memory in case exception occurs. Does it get freed automaticly? No, you need to take special care to avoid memory leaks.

By value. Use stl containers and classes that wrap newed memory, so the destructor is called.

quote:
How about if some method declares to throw an exception? Are you forced to catch it? Can method throw exceptions though they didn''t declare that they would?

If you don''t want to catch it, it will unwind the exception stack to main. They can throw undeclared exceptions, they turn into unexpected_exception.

The stl gives you string and vector classes. These eliminate much of the need for explicit memory allocation.

quote:
Talking about templates in general, the error messages a beginning template programmer gets are ridiculously complex and very unredable. You must know the VC++ and the limit of 255 chars?-) I mean, what use is an error message that is 255 characters long?

The template errors in visual studio.NET are much more comprehensible. I agree that c++ isn''t as easy to learn as java, and that template errors can be quite obscure if you haven''t seen them before.

quote:
Well it isn''t directly an issue with the language, but honestly, which code is more readable?


I find most use of istreams very readable:
  complex c;double d;string s;istream& in;in>>s>>d>>c;  


quote:
With Java there are no headers. There isn''t need for them. Actually, why bother to write method name in two places when you can define the method where it is declared?

Rather, in java, everything is a header. If you wanted to, you could program c++ in this way as well.

quote:
Yes, I''m not familiar with STL, I''ve never had time to learn it well. And hopefully I never have to.

I''m sorry you feel that way. The STL has allowed me to understand generic programming, and provides a ton of cool and useful functionality.

Here''s a quick example...let''s say you have a phone directory, and you want to print it out sorted by name, and by number. As input, you have an unsorted file of the form:
Name Number
Name Number
...
  struct record{string name;int number;};istream& operator>>(istream& in,record& r){   return in>>r.name>>r.number;}ostream& operator<<(ostream& out,const record& r){   return out<<r.name<<" "<<r.number;}bool sortbyname(const record& l,const record& r){   return l.name<r.name;}bool sortbynumber(const record& l,const record& r){   return l.number<r.number;}void process(string infile,string outfile1,string outfile2){   ifstream in(infile);   ofstream out1(outfile1);   ofstream out2(outfile2);   vector<record> records(istream_iterator<record>(in),istream_iterator<record>());   sort(records.begin(),records.end(),sortbyname);   copy(records.begin(),records.end(),ostream_iterator<record>(out1,"\n"));   sort(records.begin(),records.end(),sortbynumber);   copy(records.begin(),records.end(),ostream_iterator<record>(out2,"\n"));}  

There are a lot of other nifty algorithms in the STL, and they work on any container.

quote:
Well what kind of machine you code with? 200MHz Pentium with 32 MB of RAM? On 800Mhz P3 with 256 MB of RAM you''ll do just fine. At least I do.

I have a 1.2 ghz athlon. But i''m very picky about my interfaces.

quote:
But how do you explain then that every database vendor concentrates on Java and XML then?

Hmm, afaik there are 2 major database vendors, Oracle and Microsoft. One uses c#, and one uses java. Seems tied to me.

quote:
Refactoring is a lot harder to do on C++ that it is on Java, and this is a fact. Java has simple syntax enough to make refactoring procedures simple enough. In Java there is no need to keep two method signatures synced like there is with C++. And there is no preprocessor to complicate things.

Granted, refactoring is easier in java. Good c++ coding frowns on the use of the preprocessor.

quote:
No matter what you do, c++ will run slower than asm code. It is the same thing. I don''t care if Java is a bit slower than comparable C++ code, all it matters is that I get my work done efficiently.

Actually, this is not necessarily true. Theoretically, there is nothing stopping c++ from performing as fast as assembly. WIth Java, the JVM and JITTER is competing for processor time and cache space. The difference is that you get a huge productivity increase moving from asm to c++, which is worth the performance hit for most applications. However, there is no proven productivity increase for moving from c++ to java.

quote:
As a side note, do you know what QuakeASM is? It is a platform-independent bytecode language for Quake 3.

That''s pretty cool, but considering that the graphics engine is the core of the q3a code, you still have a lot of porting to do.

quote:
x = (int)(f - 0.5);

in Java. Is that really that unreadable? Not to me.


just some random code snippets from my last java project
  owner.drawCube(g,(i)*x/owner.size,(j)*y/owner.size,(int)(x/owner.size*0.9),(int)(y/owner.size*0.9),owner.pieces[i][j],true);colors[i][1]=new Color((int)(r*0.9),(int)(g*0.9),(int)(b*0.9));wincolor=(int)(Math.random()*10);  


versus the c++ implementation:
  owner.drawCube(g,i*x/owner.size,j*y/owner.size,x/owner.size*0.9,y/owner.size*0.9,owner.pieces[i][j],true);colors[i][1]=new Color(r*0.9,g*0.9,b*0.9);wincolor=rand()%10;  

Casts from float to int aren''t necessary.

quote:
Lack of type-safety yes, but how many commercial applications actually throw ClassCastExceptions?
If I need a specialized container for certain class, I''ll write one. But I do just fine with the containers java.lang package delivers

It''s a gratuitous lack of type-safety...just like printf/scanf. There''s no good reason to allow putting different objects in the same container.


quote:
From what point did you consider Swing as a part of the language? It would be same as saying that MFC is a part of C++.

Oh, picking and choosing are we? =) Well, JBuilder(Borland''s IDE) and JDeveloper(Oracle''s IDE) and Forte(Sun''s IDE) are all laggy on my comp, so whether or not they''re written in swing, they''re slow.

quote:
Well, to me there''s nothing cool about streaming in C++.

Nothing cool about it? I can sort a list of integers from a file into another file in 2 lines of c++:
  multi_set<int> myset(istream_iterator<int>(ifstream("numbers.txt")),istream_iterator<int>());copy(myset.begin(),myset.end(),ostream_iterator<int>(ofstream("sorted.txt"),"\n"));  

Try doing that in java!

quote:
But I''ve seen the operator overloading abused badly on C++. What does c = a~b; do where a and b are some form of vector classes?

I can write obfuscated java code as well, if i wanted to, by implementing interfaces and then doing contrary things with them; it doesn''t mean i should though. Operator overloads are useful enough that they are part of the language, despite the potential for misuse.

quote:
There''s seldom need for true multiple inheritance and if there is, you can always solve it with interfaces and delegation.

I could likewise claim that there''s seldom a need for inheritence and if there is, you can always solve it with a virtual function pointer table. Why artificially limit yourself?

quote:
With this you mean platform-independency or goal for being platform-independent?

both.

quote:
Have you ever tried to do a compiler or a parser for any given programming language? C++ or Java especially? It is amazing how much you begin to appreciate a small, simple and consistent syntax when doing so.

That''s why I mentioned LISP =)

quote:
Let''s say we have written same algorithm to our problem in both C++ and Java. Java version performs poorly compared to C++, but both are unacceptable slow. Then we hear that there''s alternative algorithm that will considerably improve the performance, but it is quite complicated to implement. Depending on the problem, a Java programmer can implement the new algorithm usually faster than a C++ programmer with equally skills.


I heavily doubt that. While I agree that Java aids GUI development, I see no reason why coding an algorithm will be faster. The two crucial things are the algorithms provided by the language and library(I believe the stl has the advantage here), and the data structures provided(java and c++ are equal here, since both have hash tables, trees, strings, and resizable arrays).


quote:
Thus, you might have a situation where using VisualBasic would be more wise than using C++! (don''t laugh, I''ve seen it happen!)

I totally agree...pick the best tool for the job. If the majority of the code is gui related, VB(or c# or java) is a great choice. I find that the many programming styles c++ supports tend to make it the best tool for most of what I do.

I have to agree with unshaven bastard on his last point:
quote:
So they can do nothing in c++, but lots of stuff in java,
which means c++ = crap and java best language ever.


This belief is especially supported when the java supporters don''t even know anything about the stl(which makes a HUGE difference in c++ productivity). It seems that most only know enough to denounce it. (ie, MI is no good, templates aren''t important, etc) It''s also curious that most of the criticisms are exactly the features java is missing. If you asked most c++ developers what they wanted changed, i doubt many would ask for the elimination of MI(just don''t use it if you don''t want it), or operator overloads(same reason). Most of c++ has been designed to be orthogonal - if you don''t use a feature, you don''t pay for it.
It seems to me that one of the major themes of theses posts is whether or not java will replace C++ over the next five/ten/whatever years. One of the principle arguments for this idea is that C/C++, like its predecessors ASM and machine code, will cower before the awesome production gains of a true object oriented programming language like JAVA (cue echoes). The reason C supplanted ASM way back in the 1970''s was that C was a completely different way of programming. No longer would the common man be held in the chains of oppression of what was basically machine code with glossy pseudo-english faces like "jz" (five bucks to anyone who can figure out what that one does without ever having studied ASM). C++ has come to replace C as the language of choice among game programmers for a similar reason. Basically, after a non-OOP language reaches a certain number of lines, it becomes impossible to manage. Thus, for large projects, C becomes difficult to use. By a similar rationale, Java should replace C++, since the gap between them is so insanely monstrous, right? I mean, its not like C++ is object oriented or anything. You think I''m being sarcastic, right? Why does this always happen. How could anyone possibly think I was being sarcastic? O wait. Now I remember. I am being sarcastic. Nevermind. Anyway, back to the topic at hand. Another argument for the future reign of Java is that it is being taught everywhere. There''s a very good reason for this: Java is academically friendly. It''s a "true" OOP (because you have to do everything in classes, including "hello world!" programs), it''s very mistake-proof (which is great, since, you know, I don''t have to code correctly anymore and i thinks i use bad grammar in passage and you clean up ok.I SAve times by let u fig. rest out), and it''s easy to learn (so''s PASCAL, which is why everyone wrote in pascal before Java came into being... damnit! must.. stop... overusing.... sarcasm). Ok, so maybe Java doesn''t have C++ beat on those terms... but at least its universal. Then again so is Esperanto. Besides, the PC world is primarily monolingual -- with everyone speaking windowsese. Uh, Java''s easy to use, but then again, VB is even easier (and its so cute). I''ll accept as an argument that if processing power is no limit, Java may be the better language to use. However, sadly, in this world processing power is a limit. Remember, PC programming is for the lowest common denominator, and most serious programs can use a couple of extra cycles. But, perhaps the most obvious reason for Java''s future failure to replace C++ will be C#. C# is a sort Java-like C++. The biggest difference between the two is that C# has microsofts full support. And I''m sure we would all agree that counts for something.
Just to throw gas on the fire of this discussion, there''s some experimental work going on with compiling Java directly to native code. see http://gcc.gnu.org/java/ for more information. I don''t know a great deal about Java, so you''ll have to fill in the details, but:
quote:GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile:

* Java source code directly to native machine code,
* Java source code to Java bytecode (class files),
* and Java bytecode to native machine code.

Compiled applications are linked with the GCJ runtime, libgcj, which provides the core class libraries, a garbage collector, and a bytecode interpreter. libgcj can dynamically load and interpret class files, resulting in mixed compiled/interpreted applications.


So performance may not even be as big or little of an issue in the future as it is now.

They''re working on AWT(don''t know what that is), and then plan to work on SWING, according to their faq. They''ve got some performance problems and some performance triumphs.
---New infokeeps brain running;must gas up!
quote:Original post by Anonymous Poster
"Depending on the problem, a Java programmer can implement the new algorithm usually faster than a C++ programmer with equally skills."

That''s nothing more than a myth unless you can back it up. In my experience the opposite is true. I''d like to see some code or something. Your statement seems to be the main argument of java boosters and yet I''ve never seen it backed up. I don''t want a study either, I want real code examples that aren''t too contrived.


Giving you a code example won''t do, I was talking about the time it takes to implement the algorithm, not the time it takes to execute it.

I would also like to see some proofs of C++ code outperforming Java code, because this seems to be argument for C++ fanatics. We once wrote a thread test for Win32 with both C++ and Java and they were equally fast. There were couple dozen threads executing an synthetic algorithm calculating something, it was basically floating point number crunching. Our test proved to us that a) Java threads are actually native threads and not emulated by software b) due to JIT compilation the actual algorithm ran as fast with C++ as it ran with Java. I can provide you the source code if I can still find it somewhere at my work.

^Conrad2k
^Conrad2k

This topic is closed to new replies.

Advertisement