Why Java is called more efficient (in terms of resources consumption) but less speedy, and how is that advantageous in context of web applications?
I have heard a lot of times Java being more resource efficient than being a very fast language. What does efficiency in terms of resources consumption actually means and how is that benef开发者_如何学JAVAicial for web applications context ?
For web applications, raw performance of the application code is mostly irrelevant (of course if you make it excessively slow, you're still in trouble) as the main performance bottlenecks are outside your application code. They're network, databases, application servers, browser rendering time, etc. etc.. So even if Java were slow (it isn't) it wouldn't be so much of a problem. An application however that consumes inordinate amounts of memory or CPU cycles can bring a server to its knees. But again, that's often less a problem of the language you use than of the way you use it. For example, creating a massive memory structure and not properly disposing of it can cause memory problems always. Java however makes it harder to not dispose of your memory (at the cost of a tiny bit of performance and maybe hanging on to that memory longer than strictly necessary). But similar garbage collection systems can be (and have been) built and used with other languages as well.
Resources are cheap these days, esp memory, CPU, disk. So unless you are programming for a phone, or a very complex problem efficiency is unlikely the best reason to use/not use Java.
Java is more efficient than some languages, less efficient than others.
For web applications, there are many other considerations, like user experience to consider first.
A programming language can't be "fast" or "slow" or "resource efficient".
For architecture overview, MSDN Architecture Guide seems nice.
For most accurate/technical description of difference between interface and abstract class, refer to the spec for your language. For Java it's Java Language Spec.
精彩评论