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'm interested in learning a dynamic language after at least 10 years on the Java platform. There are two choices that I was considering. One, learning one such as Clojure / Groovy that ride on top of the Java JVM. Secondly, a language off the JVM, which would include Ruby / Rails or Erlang.
Having knowing alot about the Java side, I'd like to choose a JVM based solution, but considering an off the JVM solution.
My question is:
What advantages / disadvantages would I get by choosing a language off of the Java JVM?
One of my biggest pain points is deployment memory footprint. I'd like to have a solution that allows low memory consumption, because most cloud / ISP providers require high dollar for anything greater the 512 MB / server. I've been so used to using High Memory JVM's which just don't work well with my costs. Maybe this isn't a concern for using clojure or groovy, but I'd expect a high memory footprint since it's running on the JVM.
I've already started using Ruby / Rails lately and I've been impressed with it.
If you go off the JVM then you have a good tool you can use in the cases where the JVM is poorly suited, like command line utilities where JVM startup time is really annoying.
If you go with Clojure you get both, with the clojure compiler you can produce classes for the JVM and with the ClojureScript compiler you can produce javascript that will run on very nearly anything.
My personal and therefore unverifiable advice is to go with the option that will expand your programming mind cough clojure but I am personally rather biased.
You could try JRuby to support ruby on and off a JVM.
I wouldn't assume that using JVM means using lots of memory. This depends on how you use the JVM. Using a profiler and more compact data structures can minimise memory usage. You can look at using C++, but if you are not careful C++ can use more memory. (But not if you know what you are doing)
How much memory you use is more about how you develop your program than which language you use.
For a low footprint solution, you may wish to consider JavaScript coupled with the V8 JS engine and Node.js technology
Related
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.
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.
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?
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.
In order to develop a web application that can easily scale, provide production stability, is easily deploy-able, and allows for fast development cycles, what points would you recommend I look at before choosing one or the other framework - using Java and Tomcat, or Django and Apache/Mod_WSGI?
Some pros and cons I could see immediately,
Tomcat apps are simple to deploy - drop a WAR file and you're done. Django apps seem to need more wrangling (Not sure if creating .egg files and dropping them in would work as well?)
Django's ORM seems much nicer than Hibernate - generates models directly compared to Hibernate's manual configuration files
Python as a language is faster to develop in, and much more concise than Java can be. (Of course, this is a relatively higher level discussion).
I've looked at Disqus's slides about scaling Django and am under no doubts it can be done. But would scaling a Django app be any harder than scaling a Java/Tomcat one?
I'm familiar with both Java and Python and the frameworks mentioned above, and it boils down to getting feedback those who've worked with either (or both) on scale.
Thanks!
Here are my experiences:
Django-Apache fits in 16MBs of memory, whereas Java-Tomcat requires much more than that.
Coding in Python is much faster, that is true. In Java, on the other hand, you have compile-time checks, profilers and debuggers that help you increase the stability of your application.
If you are planning to do heavy computations or need complex data structures, Java's compilation technologies will provide the speed you need.
It is easier to maintain a large project in a strictly object-oriented environment with advanced refactoring tools, such as Java.
Then again, coding in Python is much faster.
It's worth noting that Python code can be extended with C/C++ code. So Django applications can, in fact, be faster than their Java equivalents if one is careful to use native code where speed or complex data structures are required.
Obviously, my vote's for Django.
I choose Python with Django, because it is better in deployment. You don't need build war. You only copy files on server and that's all.
Django is easily scalable and production stable. see this.
If you prefer Java look at Grails. But it has 2 minuses: building war and a lot of memory usage(200 mb without users).
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.