why java number one? [closed] - java

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
Why is Java the most used programming language ? Why are the most programmers jobs for Java ?
Don't get me wrong here ? I like Java and I work in Java ? I don't have anything against it ?
Also, I'm trying to learn some other stuff out of the OOP box, like Clojure with its functional programming.
But, I'm wondering, why is Java number one ? I mean, dynamic languages (Ruby, Python, Php, JavaScript) people says that static types languages (Java, C/C++, C#) people envy them for their productivity ? They say they get the job done faster...
Ok then, if dynamic languages are more productive, how come Java stands where it stands ?

It was backed by a major commercial company Sun -- which other business value when decided on adopting such things.
It continued in the syntactic tradition of C++ -- already a widely used language at the time. In many ways, it was sold as a far improved C++.
It came with batteries included -- the framework.
Superb marketing effort of write once / run everywhere (platform independence).
The fear of Microsoft's dominance at the time forced a lot of companies to collaborate in the Java endeavor, notably IBM.
I don't think other languages on your list had these qualities (even if I fall into the dynamic/productivity camp). Arguably Python filled some of those niches at the time.

Typically it's easier for people to conceptualize in imperative languages with garbage collection (C#, Java)
Spolsky considers Java to be an easy language, he has a famous post on it.
Java is well-defined and thus easier for formal analysis efforts
Java runs on most modern platforms without massive grief
Java is "enterprisey", by which I mean it seems to be heavily adopted and developed by large corporations, which, due to sort of a best-practice risk-minimization approach, means other large corporations will also use it.
Java is taught in many universities.

Just off the top of my head...
Huge potential user base.
Large set of libraries.
Established community.
Fast VM.
Platform independent.
It's free.
It's been around for ages.

Some of the factors that have given Java its popularity are:
Its Maturity
Easiness to learn
Great API
Also, due to its philosophy of "Write Once Run Everywhere", Java programs are extremely portable and the Java platform itself is quite mature, in terms of the kind of applications that can be developed with it; not to mention the plethora of new languages that are being developed to run on the JVM.
Remember, most used, doesn't mean better; for many purposes you'll find that Java simple falls short of a viable solution.

Related

C++11(native code) vs Java(bytecode) [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Lately I've been thinking about the difference about native and bytecode.
I did some research and all information I've read was about C++ code compiled into native code vs Java code compiled into bytecode(runs on JVM which takes advantage of multi-core processors). The conclusion was that applications written in Java run faster.
Does C++11 change this?
Does applications written in C++11(since adds threads) run faster than Java ones?
The conclusion was that applications written in Java run faster.
That's a big leap to come to. There are so many factors which contribute to the performance of a system that it's very hard to say one approach will always be better or even faster than another.
C++ has always been able to use threads, it just didn't have as much detail on how they could be used. I don't believe C++11 is about performance but standardising things like memory models.
IMHO Given any amount of time and expert developers, a C++ program will always be faster than a Java program. However, given a limited amount of time and developers of mixed ability you are more likely to get something working and performing well in Java. Your mileage will vary. ;)
Making my answer clearer...
Does C++11 change this?
No. I don't agree it is the situation nor does it change it.
Does applications written in C++11(since adds threads) run faster than Java ones
Yes, but not always, Just like earlier versions.
Neither C++ nor Java automatically split your program into multiple threads. The closest you can get to automatic parallelization in modern languages is to use parallel collections. There are libraries to do that in C++ but there is better support for that kind of stuff in more functional languages e.g. Haskell, Scala, Clojure.
Another way to get automatic parallelization is to use an actor library and write your entire program with actors. Erlang was the first language with full support for that but the Akka framework for Scala/Java is also very good.
I would just say All Your Java Bases Are Belong To C++.. The JVM itself is written in C/C++. C/C++ run at native speeds on the bare-metal of the machine, while bytecodes are interpreted by a C/C++ code(that's running on top of the metal). One byte-code instruction could translate to about 5-10 asm instructions(or more). Hence speed of execution of C/C++ is considered faster than Java's. Ofcourse, if Java's runtime were thrown onto the metal and we had bytecode interpreted at machine speed, then it would be a fair comparison.
That said, see an example in the book called "Programming Pearls" where the author runs an interpreted BASIC program on a Radioshack personal computer, which with sufficient optimizations, runs faster than it does on a super computer. Which means, speed of execution of your program depends on your algorithms and coding/optimization practices.

Play! framework vs Ruby on Rails [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
It's not going to be a request for general comparisson:
Play! framework is Java based which means the code is interpreted to bytecode and then compiled by the JVM in runtime. On the other hand, Ruby is a dynamic language which means the code is interpreted with every request. This is certainly obvious for every programmer.
Another aspect is the development process and the ease of the language (strong typing vs weak typing).
Currently I'm developing a new website using Play!
So, for the questions:
Performance for an HTTP server (Play! runs on the JVM, Ruby is dynamic) - does it really matter for a website? would you see a significant differences?
I feel RoR has much larger community, sources, tutorials etc, and it's a little batter me. Or should it?
Well, it depends.
Ruby's not a particularly fast language, but language execution speed is likely not to be your bottleneck—in my experience, ruby's relative slowness is often just a drop in the ocean of external service calls (e.g. databases), algorithmic problems (e.g. synchronous, blocking subroutines), and design choices that are just generally inappropriate for the problem domain. Keep your whole technology stack in perspective.
Community's important, and Ruby/Rails has an extremely active one. AFAIK Play's smaller, but in my own experience Java and Scala (and the myriad other languages that have JVM implementations (including Ruby)) also have good communities.
All of this depends on the specific needs of your app (and you!). If Ruby's too slow, it's too slow. If you absolutely need some library that only exists in Java, use Java. Choose the tool to fit the task. But keep the entire task (and your own needs for completing that task) in perspective.
Many differences between these two models. As for the performance, my opinion about Java based & RoR:
1, Java based website(running on several Java Application Servers), has its unique advantage, such as multi-thread model(highest speed to read local data), global memory, easy to pooling resources, plenty of efficient clients to connect all kinds of 3rd part OSS tools...
2, RoR (and Php) model of HTTPServer connection, need to "proxy" request to App tier. Multi-process model increases inter-process communications. And as a "dynamic language", the performance is lower.
But, nowadays, web programming depends on other tools to boost up. The widespread uses of cache, NoSQL(Memcached, Redis, TT/TC), IPC/RPC framework(netty, akka, )... shift the bottleneck. I knew both above models has been used in large-scale networking social games.

Java's popularity in Internet Algorithmics (Search, Big Data etc.) [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I have been writing C/C++ code for years. Recently started doing lot of Java too because some of the very fine products that I am using to solve my computing problems are all written in Java (Example: Lucene/Solr, Hadoop, Neo4j, OpenNLP etc.).
I am seeing this chage since last 3-4 years that Java has really got very popular atleast in Internet Algorithms (Clustering, Search, Big Data & so on). Though their are counterparts of the products that I have mentioned above in C++ (like for Search Sphinx written in C++ is a great option, Google has its Map Reduce written in C++ etc.)
I am just curious to know what are the factors & strength's that are making Java very popular these days specially in the Information Retrieval & Big data domain.
I just wanted to know the strengths of Java which is making it very popular in Internet Algorithms space? Is it just because of platform independence thing?
I would argue that Java and C++ perform at a similar level outside of the arbitrary, contrived situations which are so often used to prove that X is faster than Y.
Once you factor in network round-trip times and other, real world delays, I can't see a C++ application offering a measurable advantage over a Java application simply due to being C++ as opposed to Java. You will, however, see a measurable difference between a well-written application and a poorly-written application.
plattform independance is a nice feature, but doesn't always work in java. depending on what you do
java gets its popularity for the fact, that it's more safe than c++
you can not use pointer arithmetics and you can not manage memory allocation on your own
if something wents terribly wrong, you get an exception or an error, or the program just crashes but in java you are relatively sure not to continue doing things you definitely don't want to do
yes you can do all that in c++, but that's not the question, isn't it?

Java vs. PHP Speed Comparison [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
Which language is faster for web, Java or PHP?
It is a difficult one to answer as in theory Java should be faster:
it's precompiled, any trivial algorithim will run faster in Java than PHP and there has been a vast amount of work done to optimise Java from improving the code, standard libraries, to JIT compilers, etc.
PHP is loaded and interpreted every time if you're not using the Zend optimiser, objects are intialised on every execution, even the most trivial string varaible is actually a complex object with many methods to support.
The problem is that in practice PHP sites seem to run faster using fewer resources.
I think this is because PHP developers take a more straightforward approach to design and don't get lost trying to implement exotic design patterns and implementing endless pointless abstractions.
Speed doesn't matter
in most cases.
Processing is cheap. Code in what you're comfortable with. Writing proper code goes much further for speed then choosing a language. Solid coding conventions and design plan will also help more.
Best answer I could find
"stuff to consider:
Java web applications are compiled
to bytecode. Even JSPs, which are
compiled at runtime. This is an
advantage over most uses of PHP,
where the Zend Optimizer is not in
use.
Data can be cached in a live servlet
instance - no direct/easy way of
doing this in PHP to my knowledge
(there is only ever a single
instance of a servlet/JSP in memory)
If anybody knows how to cache data in PHP without resorting to ugly
hacks, please enlighten me!
Java applications tend to be
n-tiered, which generally results in
a more maintainable application at a
slight performance penalty. This
probably sounds trollish, but
honestly: even within Java itself
direct use of JDBC will always be
faster than going through three
layers of objects to the database.
But is an n-tiered Java application able to hit the database sooner than an uncompiled, hacked-up monolithic PHP script? I don't think there's an answer to that question.
All that said, I'm working on an n-tiered MVC framework for php 5 (it's called Pure (http://www.sf.net/projects/php-pure)), so my PHP applications are generally n-tiered too. I'll worry about speed when and if it becomes an issue. For now, it's definitely not an issue."
courtesy of krumms
Speed aside, I believe the performance of Java is better than PHP. But developing a project in PHP is faster.
Can't answer this question with one or the other unless you define what you want to measure the speed of.
Some things are much faster in PHP (in a native function for example), other things are much faster in Java.
The intent of each language is substantially different from the other, so if you're debating over which to use for a particular task, you should generally based the decision on that task (and how well suited each language is to it) rather than performance.
For raw performance of code written in the language (as opposed to simply calling code in the standard library), Java will probably run faster than PHP as an extremely general rule. If that matters, chances are that PHP just isn't very well suited to the task at hand.

For what reasons do people choose Ruby over Java? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 13 years ago.
I am a beginner to Ruby. I've heard the following complaints about Ruby, and was hoping the Stack Overflow community could address each point raised.
Common complaints about Ruby that I've heard:
Ruby is slower than Java
Ruby is not statically typed
It's not suitable for large projects
Given these admittedly opinion based statements, how is Ruby 'better' than Java? and will Ruby ever be a widely used language both by businesses and individuals?
Ruby is slower than Java to run but faster to write, or read. Which is more important to you? I don't know any company in the world who'd pass if given the opportunity to (say) cut their dev time in half at the cost of doubling their hardware.
Ruby is not statically typed, but neither are Python, Perl, Lisp, shell scripts, etc. Is this really a problem for you? I'm sure you could find just as many people in dynamic languages who would complain that Java, C#, C++, etc., are statically typed. We've no lack of examples of systems built on dynamic languages.
I'll agree that Ruby isn't suitable for large projects, but neither is any other language we have today. The state of software engineering is pretty clear to me: nobody can reliably build large systems well. At least Ruby makes your large projects smaller in lines-of-code, which makes them (somewhat) more manageable. It's syntactically richer so you can say (something closer to) what you mean. It's faster to write so you'll find out quicker if you're going down the right path or not.
If these are the best arguments against Ruby, then Ruby is doing better than I'd thought.
Ruby's speed has greatly increased in the latest version. Though in older versions Ruby is slower than other scripting languages.
For some purposes, Ruby is too slow in operation. For others, it's fast enough.
For some purposes, Java takes too long to develop.
For some applications, static typing is unnecessary, for others it's highly desirable.
The size of the project is largely irrelevant.
In some ways, Java is better than Ruby, in other ways Ruby is better than Java. Anyone who maintains that one is "better" in any circumstance probably doesn't know enough about either to hold a valid opinion.
And what about JRuby?
I think it's fairly well-documented by now that Ruby is "popular". Not as "popular" as Java, C++ or C, for example, but popular nonetheless.
See
http://www.langpop.com/
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
The answer to the question "which language is better, this or that?" is always subjective. Sure, objectivity is valid and you can somehow reach a conclusion about a language being better for X task/project.
However, even then, if your team is happy with some other language that is not the first choice for a certain task/project, but the work can be done anyway... a wise team will choose the language that makes them happy because their productivity will also be greater.
Concluding, no one can tell you his choice is better than your choice. They can try to persuade you, but if for some reason X language makes you more excited, they cannot do anything about it.
Having said that: Ruby 1.9+ has improved a lot as far as performance is concerned. If you ask me, my biased opinion is choose Ruby because I like it. But if you wanted an unbiased opinion, we would have to discuss more aspects and examine what exactly you want to do with the language/framework etc.
I advise you to try both languages and then decide which you think is best.
Ruby is a popular language already :)
I don't agree with you on "We should always think about the performance" and "ruby is better than java". On some project, code readability may be more important than performance. Think of optimized C++ code which no one can read and maintain for example. And there is no perfect proof that "Ruby is better than Java". Where did you take that information ?
how is Ruby 'better' than Java?
It's not, and Java isn't 'better' than Ruby. Both have their pros and cons, and it depends on your project; what is the best tool for that job.
Depending on what you need to do.
We expect our code to run for decades. Staying with pure Java means that we are pretty certain that the technologies will stay "in fashion" and that future colleagues can maintain the code. Going for the language of the day, will eventually mean that you will have programs written in languages which have gone out of fashion and therefore is more difficult to maintain.
"Pure java" basically means we are staying with the standard Java Runtime, and implementations of Sun specifications (like JavaServer Faces). It is not as boring as it sounds :)

Categories

Resources