10 ms·
Why isn't Java used for modern web application development?
- TrevorJ 14y agoI think because of it's age, the pitfalls and limitations of the language may be more well understood, so it may suffer from a sort of 'grass is greener' effect.
- Ogre 14y agoIts age relative to what? Python is older by any measure, and the first public release of Ruby was only 7 months after Java's. Java certainly had a higher profile than either at the time, but they're all from essentially the same period. http://en.wikipedia.org/wiki/Java_%28software_platform%29#History http://en.wikipedia.org/wiki/Java_%28software_platform%29#Hi... http://en.wikipedia.org/wiki/Ruby_%28programming_language%29#Ruby_1.0 http://en.wikipedia.org/wiki/Ruby_%28programming_language%29... http://en.wikipedia.org/wiki/History_of_Python http://en.wikipedia.org/wiki/History_of_Python
- batista 14y agoAge in the spotlight doing web development. Not age since the development of the language. Mid-nineties it was CGI and mostly Perl. Then Perl started to fade, and in the late nineties, early '00s, it was all Java and PHP. Then Ruby/Python etc co started to catch on in the mid-00's. And already Ruby and RoR is considered "passe" and old, and fadsters turn to Node.js and such. Seems to be a 5-7 year cycle.
- deleted 14y ago[deleted]
- terjeto 14y agoIt's mainly the coolness factor. Oracle's ridiculous Java lawsuits also contributes to that.
- taligent 14y agoI don't think that the Oracle lawsuits have made a single bit of difference to anybody. Oracle isn't the only big fish in the Java space.
- cldrope 14y agoBut they own Java. I'm sorry, but as a Java developer seeing Oracle pick it (anything Java) up like a dead fish and try to see who they can smack big money out of is horrifying. It goes against the culture of Java that I'm familiar with. I've been learning other languages on the JVM for the express purpose of being ready to jump ship if I need to with those other languages. (Jython can jump to Python, JRuby to Ruby, Java to C#/C++, and Scala can be mapped to something I'm sure).
- lnguyen 14y agoDon't forget IBM. (Not that they might seem any better than Oracle...) They own a large chunk of the enterprise Java space with WebSphere. And they're also are a large driving force for Eclipse (was also their original code).
- ticks 14y agoI've got to say, I'm wary of supporting technologies that are linked to disagreeable behaviour like that - for a time I was considering phasing out MySQL for a similar reason. I saw Sun as one of the good guys.
- cheatercheater 14y agoCame here to post that. Oracle are known for being major assholes, over and over. I wouldn't want to work with anything they spawned. I'm not sure why you got downvoted. Believing in the tools that you work with is as important as what those tools can do.
- flomo 14y agoFramework of the month fatigue.
- pairing 14y agoWhen starting web development, I found it easier to learn Ruby and the Rails Framework from scratch than to use Java which I had several formal classes in. I think that says something about Java's documentation/community support. Ruby/Rails has railstutorial.org, tryruby.org, rails for zombies/code school, and railscasts. All these high quality beginner resources made using Ruby instead of Java an easy choice. The other reason for me is that I find the code I write in Java to be too wordy and found the more concise syntax of Ruby refreshing and fun.
- taligent 14y agoI don't think the problem is Java documentation/community support. It's really that with the exception of Play/Grails/Vert.x the frameworks are horrifically over-engineered by developers who live and breathe in the enterprise space. Nobody has ever really cared much about smaller, more startup land developers. So Java has required so much knowledge and involvement just to do the simplest things. I would take a look at frameworks like Play for the future of the platform.
- deleted 14y ago[deleted]
- taligent 14y agoIt IS used extensively for modern web application development just not by a lot of startups. In the enterprise space you really only see Java and .Net used for the core pieces. One reason that Java is becoming less popular is that you don't need to use Java (the language) to be a part of Java (the ecosystem). You can use Groovy, Scala, Python, Ruby etc which are often less verbose and have more exotic features. So developers can try new languages out but don't need to abandon their existing libraries. Best of both worlds. This is the approach that companies like Twitter and Etsy have taken.
- Ogre 14y agoI work in an industry where C++ still rules. I haven't ever written more than a few lines of Java. However, here's a job posting from our web team: http://us.blizzard.com/en-us/company/careers/posting.html?id=120000E http://us.blizzard.com/en-us/company/careers/posting.html?id... Java is the only language mentioned by name. Last time I talked to them about a thing I was working on and mentioned I would soon have (now actually do have) a Python implementation, the response was basically "That's neat, but can you do it in Java too?" So, in my little world at least, web development is the only place where Java actually does get used.
- kilemensi 14y agoGoogle (at least Gmail), LinkedIn, etc are to me modern web applications & AFAIK they are written in Java (or at least partly in Java) and I'm not counting countless enterprise web apps. Java is what they call mature technology. It's past the hype and language flame war phase. Those who know its value, just use it to GTD without any ceremonies.
- deleted 14y ago[deleted]
- dotborg 14y agoModern web application development process is not limited to only one language or one framework.
- v33ra 14y agoHere's an old HN thread: Any web startups using Java? - http://news.ycombinator.com/item?id=1932821 http://news.ycombinator.com/item?id=1932821
- irahul 14y ago> why the hate toward Java for modern web applications? Verbose language. But more importantly, needlessly verbose and badly designed apis. JSP: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <c:choose> <c:when test="${emails.unread != null && fn:size(emails.unread)}"> You have ${fn:size(emails.unread)} unread email(s)! </c:when> <c:otherwise> You have no unread emails! </c:otherwise> </c:choose> Saner templates: You have ${emails.unread ?: 'no'} ${emails.unread?.pluralize('email')} ! http://paulbuchheit.blogspot.in/2007/05/amazingly-bad-apis.html http://paulbuchheit.blogspot.in/2007/05/amazingly-bad-apis.h... > But I can't help thinking to myself, "I could do this much faster if I were using Java," primarily due to my relative experience levels. If you are more comfortable with Java, and are just beginning with Rails, it goes without saying you will miss Java. That's not a very useful metric. Give rails 4 weeks, then compare them for ease of use and expressiveness. If you don't have a month to learn rails, then stick with Java. > But also because I haven't seen anything critical "missing" from Java, preventing me from building the same application. "It can be done with Java" isn't the same as "It can be done concisely with Java". I would say learn Rails/Django. Use them for CRUD. I have checked Java ecosystem recently, and they are still far behind in terms of expressiveness when it comes to regular web programming. Play framework is close - I haven't used it personally apart from toy examples. For long running services, depending on your needs, you can either write it in Ruby/Python on top of some infrastructure tool(resque, zmq, celery....), or you can write in in Java if your service is CPU intensive.
- Isofarro 14y ago"Saner templates: You have ${emails.unread ?: 'no'} ${emails.unread?.pluralize('email')} !" At the cost of throwing internationalisation out of the window. At least the example you led with is more conducive to localisation.
- irahul 14y ago> At the cost of throwing internationalisation out of the window. At least the example you led with is more conducive to localisation. Right. i18n is the reason you have to import two taglibs and the template doesn't support basic conditionals. /s JSP is horrendous. There is not a single reason for its existence, and it should be quarantined. As far as i18n/l10n goes, the example I quoted was from play framework. This is how an internationalized version will look like: # Messages file unread_emails=You have %s %s no_email=You have no email # Template #{if (emails.unread) } &{'unread_emails', emails.unread, emails.unread?.pluralize('email')} #{/if} #{else} &{'no_emails'} #{/else} Are you arguing internationalized jsp is somehow better than this? I tried really hard, but I failed to think of a single templating engine that's worse than JSP.
- tzury 14y agoJust remember when you talk about "cool" and popular that, Google+, GMail, LinkedIn, and many parts of Twitter are Java.
- raverbashing 14y agoFor twitter: JVM != Java Also remember that Google uses C++ as well for their infrastructure LinkedIn, yep
- rabbitfang 14y agoGoogle is heavily reliant on Java. LinkedIn and Twitter both use Scala and Java. I'm not really sure that pointing out that Google has some C++ code really disproves that Java is used heavily at google. Java is still very widely used, more so than more fashionable languages like python and ruby, but the syntax is a bit long on the tooth, hence the popularity of Scala, Clojure and Groovy.
- raverbashing 14y ago" I'm not really sure that pointing out that Google has some C++ code really disproves that Java is used heavily at google. " Of course not "Java is still very widely used, more so than more fashionable languages like python and ruby"" Yes, but "widely used" is a tricky term, I'm sure cases both for and against can be found. But to talk about Google, last I heard it's only possible to develop application there in the following languages: JS, Java, C++, Python (there are exceptions of course, for specific libraries or things like ObjC for iOS)
- latch 14y agoPart of the answer is Java itself. It's verbose, static typed, and requires a lot of boilerplate code to do properly. The fact that classes are a compile-time concern, rather than a runtime concern, is just such a drag. You end up with interfaces you don't really need, only so that you can inject them into constructors so that your app is properly decoupled and testable. Part of it is a framework issue. Struts is horrible...absolutely, stunningly horrible. Your controller is an XML file (seriously). Freemarker (the main templating language) makes ColdFusion look awesome. Play is better, but it seems built for the way websites were created in mid-2000. JSON is still a second-class citizen. Static actions are a weird choice given IoC is achieved via DI in a static language. Edit: I should add that there's also the persistence story. Anyone who's done [n]Hibernate knows that it's, at best, a mixed blessing. Even Java's NoSQL drivers are verbose compared to their dynamic brothers (first-class hash support is a big issue here, for some drivers in particular). I'm not sure something like Sequel would even be possible to write, and the AR implementations are, again, limited by the compiled-time nature of the language and the inability of bend the syntax into a nice DSL. Java also lacks lambdas, and generic support is weak. And what's up with int vs Integer...the list goes on and on.
- batista 14y ago>Part of it is a framework issue. Struts is horrible...absolutely, stunningly horrible. Your controller is an XML file (seriously). Freemarker (the main templating language) makes ColdFusion look awesome. Play is better, but it seems built for the way websites were created in mid-2000. JSON is still a second-class citizen. Static actions are a weird choice given IoC is achieved via DI in a static language. 99% of websites are still built "the way they were built in mid-2000", and there's nothing wrong with that way. Client-side rendering and such is not the "new way", is just an alternative way for certain types of websites, that is still quite immature and can take you to a world of pain if done bad (see Twitter).
- latch 14y agoMy complaint isn't about client-side rendering. It's about _anything_ that involves getting in JSON or outputting JSON. It's essentially being able to easily bind json to objects on the way in, and being able to use respond_to and to_json on the way out.
- gbog 14y agoNo it is not the coolness factor, it is the paradigm. Java forces you to use OOP and OOP is not very fit for web development: you want to answer fast to a stateless request by checking some data trough different filters (eg a template), you don't want to recreate a full world of objects and pass along some messages.
- franzus 14y agoHmm, last time I checked all the "new" frameworks were OOP too. Be it rails or django - they all have some kind of OO paradigm they adhere to.
- gbog 14y agoYes, and there is this ORM impedance mismatch thing. I stopped writing classes for all tables and it removed many useless code and many issues related to stateful methods. Just one example: if you delete a book with book.delete() then how come you can two or many lines later change its title with book.title = Foo?
- zxcvb 14y agoYou can't. The JVM will tell you that the book object you are referring to no longer exists. I'm assuming your delete() method did actually remove the object.
- cromwellian 14y agoMany Google services are backed by Java on the backend, and Closure compiled JS or GWT on the frontend.
- cromwellian 14y agoTo flesh this out a little more: The question should be "Why isn't Java used by startups or for small projects?". Java certainly used for "modern Web apps" at more established companies. The issue is one of speed vs scale. Startups need to get to minimum viable product. They are usually small teams of 1-3 engineers, and value iteration speed over performance or maintainability. Running up against scalability issues or team code code maintenance issues is a problem "you'd like to have", that is, by the time you reach that stage, it's a sign your initial implementation helped you over the initial hump of getting customers or investment. You can afford to rewrite the app at that point. A company like Google can afford the luxury of building things for scale up front, even though they may be wasting their time implementing scaling for something that might get no users, because they can absorb the loss. At least, that's my opinion, that many many "cool", "hip", "modern" companies build small apps with small teams where iteration speed and simplicity are the greatest requirements.
- agiamas 14y agoCorrect but also a company like Google knows that the moment they put up a link in the frontpage they can drive vast amounts of traffic towards the new property. Secondary reason is that a web app from Google that doesn't scale is really bad PR and draws comments like "omg, lulz it's Google and they can't handle traffic???!!!1!" Hence, they build with scaling in mind. A startup has none of these concerns and just cares about time to market and making some money to convince VC's that it's worth investing.
- deleted 14y ago[deleted]
- sgt101 14y agoWe use Java to develop web apps because while we could use anything ( I run a research team) I know that I will face problems downstreaming the work if we do. The application support groups can get a Java developer with a whistle, the same is just not the case for any other language, apart from possibly PHP.
- karianna 14y agoDisclaimer: This is cribbed from my upcoming "The Well-Grounded Java Developer" --------------------- If you investigate Ola Bini's pyramid where languages fall into static, dynamic and DSL layers you'll see his arguments for what type of programming tasks suite which layers. Java sits firmly in the stable layer, and so do all of its various web frameworks. As expected for a popular and mature language, Java has a large variety of web frameworks, such as these: Spring MVC, GWT, Struts 2, Wicket, Tapestry, JSF (and other related “Faces” libraries), Vaadin, Play, Plain old JSP/Servlet Java has no de facto leader in this space, and this partly stems from Java simply not being an ideal language for rapid web development. The former leader of the Struts 2 project, a popular Java-based web framework, had this to say on the subject: "I’ve gone over to the dark side :-) and much prefer to develop in Rails -- for the conciseness mentioned above, but also because I don’t ever have to do a “build” or “deploy” step during my development cycle any more. But you guys and gals need to be reminded that this is the kind of thing you are competing against if you expect to attract Rails developers ... or to avoid even more “previously Java web developer” defectors like me :-). Craig McClanahan, Oct. 23, 2007"(http://markmail.org/thread/qfb5sekad33eobh2 http://markmail.org/thread/qfb5sekad33eobh2) Java is a compiled language, and as alluded to previously, this means that every time you make a code change to a web application, you have to go through all of these steps: 1. Recompile the Java code. 2. Stop your web server. 3. Redeploy the changes to your web server. 4. Start your web server. As you can imagine, this wastes an awful lot of time! Especially when you’re making lots of small code changes, such as altering the destinations in a controller or making small changes to the view. If you’re a seasoned web developer, you’ll know that there are some techniques you can use to try and solve this problem. Most of these approaches rely on some sort of ability to apply code changes without stopping and starting the web server, which is also known as hot deployment. Hot deployment can come in the form of replacing all of the resources (such as an entire WAR file) or just a select few (such as a single JSP page). Unfortunately, hot deployment has never been 100 percent reliable, and the web server often still has to perform expensive recompilation of code. If you must use a Java-based web framework, I highly recommend products called JRebel and LiveRebel (http://www.zeroturnaround.com/jrebel/ http://www.zeroturnaround.com/jrebel/). JRebel sits in between your IDE and your web server, and when you make source code changes locally, they’re automatically applied to your running web server through some genuinely impressive JVM trickery (LiveRebel is used for production deploys). It’s basically hot deployment done right, and these tools are seen as industry standards for solving the hot deployment problem. Generally speaking, Java-based web frameworks don’t reliably allow you to have a fast turnaround time for your changes. But that isn’t the only concern with Java-based web frameworks. Another factor that slows down rapid web development is the flexibility of the language, and this is where static typing can be a drawback. In the early stages of developing a new product or feature, it’s often wise to keep an open-ended design (with regards to typing) of the user presentation layer. It’s all too easy for a user to demand that a numeric value have decimal precision, or for a list of books to become a list of books and toys instead. Having a statically typed language can be a great hindrance here. If you have to change a list of Book objects into a list of BookOrToy objects, you’d have to change your static types throughout your codebase. Although it’s true that you can always use the base type as the type of objects in container classes (for example, Java’s Object class), this is certainly not seen as a best practice—this is effectively reverting to pregenerics Java. As a result, choosing a web framework that’s based on a language in the dynamic layer is certainly a valid option to investigate.
- kephra 14y agoimho, Java is a great tool when it is deployed for its original goal: Platform independent GUI clients. Unfortunate its now mainly used on the server side, where it fits badly. The main reason I'm not using Java on server side is memory footprint. A typical Lighttpd, fastcgi, Rails, MySQL stack runs well within 256mb of memory on a Xen instance. A typical Apache, Tomcat, JBoss, Hybernate, Spring, Oracle stack requires 4GB or more on a root server. I think most startup coders shy Java, because they know it mainly by maintaining enterprise dead horses and bloatware. See: Tate, Bitter Java, ISBN: 193011043X
- cturner 14y agoUsers generally dislike java on the client side because the widgets don't integrate with their platform quite right. Java apps don't "feel right". A good web app is generally easier and cheaper to build and better than a bad GUI app. I think the server is where Java shines. Good Java is almost as fast as good C (if it's not, you're using bloaty libraries or being cavalier with memory), and when something breaks you get a stack trace that a support team can make some sense of, and the build/dependency system is a lot nicer. Sun sold Java as a plug-together ecosystems. They encouraged a mindset of putting together big teams of developers who live in padded IDEs and lean on bloaty frameworks, and not to think about resource usage. This won a mental traction with companies who wanted to believe that software work and developers should be a commodity, but has lead to a lot of bad systems. The results cause people to have some strange ideas about Java, like that it's slow. The Java world places a lot of emphasis on inheritance, which may be an anti-feature. Before I became fluent with python I used to create thick abstract class hierarchies that aimed for perfection and reuse. In truth the result was a bloaty, brittle mess. Python's awful inheritance model forced me to learn how to think in ways other than inheritance. Your example technology stack isn't a like-for-like criticism. You're criticising Java because Oracle takes up stack of memory and because you'd choose to use hybernate and spring. Why can't you use lighttpd, fastcgi, Java and mysql? The rails ORM isn't sophisticated, and it'd only be a couple of days' work to hack something up equivalent in Java. The result will be faster than rails and less memory intensive. You missed the obvious advantage of rails over java for web development - a lot of web development involves heavy string processing, and the tools you get in ruby/python style languages for list processing and string manipulation are a luxury compared to what you get in Java! That was the main reason I moved away from Java for web work. With Java you try to build things to be configurable. You might need to do a different option later, and you know that it will be a laborious refactor. Whereas with scripting languages, the configuration language and the programming language are the same thing. So you just write the thing to do what you need it to do. And if you needs change a bit later, you throw away what you had without it feeling like the death of a child and then do the new thing and get on with your life.
- fizx 14y agoI've been hacking Rails since 2004, and I've made the switch to Java (dropwizard+mustache) for basic web development this year (sometimes with a meteor-like micro-framework I rolled myself). Benefits: - Higher quality code. Java is easier to refactor than Ruby, which makes up for the lower language power. - Performance! - Actual concurrency! - Faster server spinup and incremental changes. Rails with 20 gems in development mode is super sluggish. - Better library ecosystem! - Better dependency management system (maven > rubygems) - Better debuggers - Better profilers - Easier deployment and ops environment(java -jar myjar, vs bundle install, ruby/passenger/unicorns) - Reasonable in-process metrics
- lucian1900 14y agoIs Rails that slow? There's absolutely nothing on my machine slower to start up that the jvm.
- sterwill 14y agoThe JVM is very fast to start on my machines. For Java 7 on Linux x86_64: t:~% time java HelloWorld Hello from Java! java HelloWorld 0.04s user 0.02s system 94% cpu 0.063 total It's not as fast as C or Ruby, but who cares about .063 seconds spent once at start-up? t:~% time ./hello Hello from C! ./hello 0.00s user 0.00s system 0% cpu 0.002 total t:~% time ruby hello.rb Hello from Ruby! ruby hello.rb 0.00s user 0.00s system 86% cpu 0.009 total
- democracy 14y agoHow about the same test with a '-client' switch...
- sterwill 14y agoI get the same times, more or less. I'm not sure the -client switch changes any behavior that early in the VM's life, before any garbage collection or sizable allocation happens. It would still be using a 64-bit data model with the -client switch (-d32 gives me: "Error: This Java instance does not support a 32-bit JVM.").
- pkaler 14y agoJava is a language that is in a weird space. It doesn't compile to binary like C/C++ and it isn't high-level and interpreted like a Ruby or Python. It's a weird middle-times language. It originally appeared in 1995 and is somewhat pioneering in the web space. But it isn't as clean as C# since C# appeared in 2001 and was able to learn from the mistakes of Java. It's definitely not as clean as Go which appeared in about 2009 and was able to learn from the mistakes of C, C++, Java, and C#. The framework choice is probably more important than the language choice. There is a fragmentation of frameworks. Starting a greenfield project with Spring, Struts, Stripe, WebObjects, etc would probably be a bad choice. Play is probably a reasonable choice. But this is not an issue with Ruby or Python. You're probably going to pick Rails or Sinatra as your choice if you go with Ruby. You're probably going to go with Django if you go with Python. Tyranny of choice is a problem with Java frameworks.
- Eduard 14y agoCan you explain why you favor Play instead of any other Java framework?
- TheCondor 14y agoSpring is a bad choice?
- rabbitfang 14y agoYes. Endless XML configs, and a ton of overhead to get started. Anyone can get productive with Play in 5 minutes. Spring + Hibernate were smart choices in 2003, but no longer the case.
- mgkimsal 14y ago"Tyranny of choice is a problem with Java frameworks." Similar to PHP, moreso than (almost?) any other dynamic language. Greenfield choice for me in Java would be Grails.
- democracy 14y agoNah, there are always favourites and 90% of the industry is following them. If you google 100 MVC web frameworks for Java, that doesn't mean anything but that the language is popular. There are only a couple of frameworks that are in real use. Some large and 'lucky' companies are glued to IBM/Oracle so are forced to use proprietary solutions without this luxury of googling for something new.
- eternalban 14y agoBecause Web is type-less, purely text-based, and dynamic. And Java is not. I remain a Java aficionado, but would reach for it last in the Web tier. Put a dynamic language upfront and hook it to a SOA-based Java backend.
- patio11 14y agoI spent three long years doing Big Freaking Enterprise Java web apps. You can certainly do modern web dev in a Java stack (we were Struts, Hibernate, Spring, and an internal framework). It just fought us every single step of the way, and every time we had to do something new (that couldn't be templates off of working code) they'd have to get one of our three best engineers to spend a week fighting the new library into submission. Sometimes the libraries won. The easiest way I can describe it is that everything you like about e.g. Rails was designed as a specific dig against the Java stack. I am told Play is less painful. On the plus side: Java devs are plentiful, the library support is worlds deeper than the ruby ecosystem (particular around enterprise-y needs), and it plays well with teams of dozens (which you will probably need). I honestly think "restricts your developers terribly" is not a bug for typical Java projects, since the outsourcing shops contributing lots of our code base would have been even more dangerous if the code didn't restrict what modules thy could break.
- chc 14y agoIncidentally, the bit about many of Rails' features being a dig at Java isn't poetic license. Rails' original marketing angle was essentially "Look how different we are from Java!" I think that's why the difficulty of deploying Rails apps in those days wasn't much of an obstacle — they positioned themselves not against PHP or Perl, but against Java, so the difficulty of deployment didn't look like so bad.
- leothekim 14y agoI actually think the IDEs for Java, e.g. Eclipse and IntelliJ, are quite evolved and help speed webapp development, and they do it in ways that make up for Java's verbosity and boilerplate. For me a lot of the web frameworks for Java felt cumbersome and I found that Java worked better when functioning as a high-throughput backend service instead of handling front-end UI. Oddly, with Java, I was more concerned with concurrency issues, GC tuning, threading, and other systems-y problems, and with Python I was more concerned with concise and Pythonic syntax and faster iteration.
- jfaucett 14y agoAs a young developer (early 20's) I think Java's lack of usage in webdev has to do with several "problems". 1.) Java has the rep of being bloated and slow. (At least when compared to C/C++) 2.) Related to #1, almost all the tools the majority of webdevers use are written in C/C++ and not Java. For instance, Apache, Nginx, Redis, MongoDB, MySQL, SQLite, Webkit, V8 - which gives me the feeling that using/improving C/C++ gives me a better understanding of my toolset whereas Java doesn't have any perceived added benefit. 3.) For Application Development itself, using scripting languages like Ruby/Python/PHP makes for BLAZING fast development especially when using a framework like Rails. 4.) The LAMP Stack (if implemented correctly) can handle a LOT of traffic, I'm talking millions of daily users. So this leaves almost every web developer (I'd say around 98%) with no reason to use Java - ever. Why should they? With the current tools, I can build highly scalable apps extremely fast and because I'm using scripting languages I'm free to experiment, mix/match, combine, and build new tools in innovative ways. Also, I think because Java is associated with the group of C/C++ and "lower level" languages it really does loose cred simply because it can't compete in effeciency terms with those languages. Personally, as a programmer who loves C, Ruby and Haskell (so yea I'm biased but who isn't?) just looking at the Syntax of Java makes me seriously wonder what Sun was thinking.
- rabbitfang 14y agoYou're criticizing Java for being slow, and then presenting Ruby as an alternative. You do realise that Java is up to 100 times faster than Ruby: http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=yarv&lang2=java http://shootout.alioth.debian.org/u32/benchmark.php?test=all.... And on multicore systems Java up to 300x faster than Ruby: http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=yarv&lang2=java http://shootout.alioth.debian.org/u64q/benchmark.php?test=al... ...alternatively combine the performance of Java with a highly expressive language e.g. Scala
- jfaucett 14y agoyes, but if you noticed I'm comparing Java to C in terms of program language speed. I'm comparing Java to Ruby in development speed NOT language speed, I thought this was obvious... sorry, If I wasn't clear enough above.
- Herbert2 14y agoThis is just my experience but if there has existed a common line of thinking with the rabid Java fans I've worked with, it would be closed mindedness to the point of being its own brand of Stockholm syndrome. The thinking that whatever the project at hand may be, a Java based solution is always the correct answer and there is nothing to learn from alternative platforms. I've heard "Why would anyone want to use anything other than Spring?" or "C# is shit" more than once. However, if you were to compare the experience of using Spring + Eclipse to C# + ASP.MVC + Visual Studio, you'd have to be pretty set in your ways not to admit that the latter is a much nicer platform to work with and that the Java eco-system shouldn't take something away from it. Having a standard web framework (ASP.MVC) makes .NET teams miles more efficient than the framework fragmentation that is Java web dev. And if you're comparing it to Rails or Django, I honestly don't think you can easily find a 3 or 4 engineer Spring team that could deliver a product as good (or scalable) as Instragram in the 2 years it took them to do it in Django. You just can't iterate as fast.
- berntb 14y ago>>the rabid Java fans I've worked with [closed mindedness] It is hard to argue against anecdotal evidence, but of the cases you mention -- java, Rails, Django -- imho, it is not exactly the Java people who seem to be the worst language/framework fanatics... (That said, scripting languages eat static languages' lunch for development speed in most every case I've seen.)
- Herbert2 14y agoThat kind of framework enthusiasm doesn't really stem from the closed minded mindset I was referring to. Most Ruby & Python devs I've met would admit that Java is a much better choice than their perspective languages for something like that requires distributed concurrency and speed (like Cassandra or Redis). The people I'm talking about are the ones that wouldn't look seriously at RabbitMQ because it's written in Erlang, not Java.
- berntb 14y agoI got your point, I wrote that according to my personal experience the other cases are quite a bit worse. Which is worth as much as your personal stories.
- ExpiredLink 14y agoThis assertion is simply wrong. Java is number one for Enterprise web application development. [Edit] Statistics: http://w3techs.com/technologies/overview/programming_language/all http://w3techs.com/technologies/overview/programming_languag...
- moondowner 14y agoWho says it isn't? Spring MVC + Spring Data JPA or Mongo + Thymeleaf for templating + coffee-maven-plugin for Coffee to JS transpiling and you're good to go. I think the first comment on the question is very true: > "I think you're incorrect: it is still used, it's just lost cool factor."
- mgkimsal 14y agoI've worked with PHP for 16 years, and with Grails for almost 5. There are some aspects of Grails and Groovy that make me more productive than developing in PHP. GORM simplicity and expressiveness, and CriteriaBuilder stuff, combined make using direct SQL very rare (required in a few cases, but rare). However, there are aspects of PHP that make things more simple, and this gets down to somewhat of a cultural thing. Of the PHP people I know, many (most?) of them have done some server setup and understand the entire request stack. I know a lot of PHP people don't grok all that as well, but of the people I know personally, many do. That number is far higher than the number of Java folks I know who really grok the full web stack. I'm not saying none do, but... many don't have to as much as PHP folks. A friend of mine who's done Java for a decade (and Groovy some too) was confused by a complaint I was having about Java web stuff. Specifically, I was (am?) having some trouble getting session replication stuff working. We need to load balance web servers, and I really want to avoid server affinity on a load balancer. In PHP, sessions are serialized to disk, but serializing to memcache or some other database is pretty simple. Java... not so much. My friend's confusion was "why are you doing that? just tell the ops guys to set it up". Well... I am the ops guy. Which gets to the culture of dev stacks. Historically, the Java shops I've seen inside are larger, and there's a bigger separation of concerns - the server/ops person often isn't even much of a developer, they just drop in a war file and keep websphere running, etc. Again - YMMV, but that's been mostly what I've seen. The 'separation of concerns' here is the heart of the issue. In PHP, all session stuff is handled in code. In Java... well, your app server takes care of that for you - 'out of the box' you don't have any real direct control over how they're handled, and configuration of such is never done in code, but at the server level. I'm reminded of PHP in 96/97. If you were doing PHP back then, it's because you really loved it, not because it was your job, and you really needed to grok everything about everything to get it set up and working (locally, anyway). If you're really set on using alt.java tech, you likely have a greater commitment to getting your hands dirty in multiple levels. disclosure - i run groovymag.com and have a bias towards all things grails and groovy :)
- rabbitfang 14y agoGroovy, Scala + Clojure = next generation of languages being adopted by Java devs. All the things we love about Java combined with a more modern syntax.
- hermanhermitage 14y agoSome syntax issues (no function pointers, no lambda, no rich literals, enforcing everything to reside in an object) endears it to Enterprise OO mindset where you want large teams of programmers working "efficiently" - but ultimately a risk conscious and ego driven manager just wants a large team of developers to further their career - and doesn't care how much boilerplate is present or how few lines of code actually do something productive. These are slowly being addressed with newer versions of Java, but it's a long hard road out of hell... and the mental association of Java as enterprise VB is here to stay. I'd say it's guilt by association with the early years of a java. It reminds lots of people of the bad old days of programming. Getters and setters instead of pure data. Using java objects to hardcode schemas in the middle tier. Horrendeous death by meaningless patterns (form over function). Gigantic libraries configured by XML (how can you take a modern language seriously that doesn't have rich literals). Build dependencies and process that again can't be efficiently specified in the native literal forms of the language. Finally Java has no useful pedigree as a client side or UI language. Thus the J2ME fiasco. The AWT fiasco. The android sluggish UI fiasco. You can write a modern web app in BCPL, or Java. But for many people the other options are simply more appealing.
- democracy 14y agoIt is not used for 'Show HN my useless toy I built last weekend'. It is widely used in many start-ups.
- KenCochrane 14y agoI programmed java web apps for 10 years before I switched to python, 4+ years ago. I feel that I'm much more productive using python and can get much more done in a shorter period of time, and to be honest, I'm much happier when I develop in python. Here are some of the reasons why I think python is better then Java based on my personal experience, your milage may very. Web Frameworks: When I first start programming web apps in Java, Struts just came out, and it wasn't great, but it was the best thing available. I created a bunch of struts apps, and a few in other frameworks along the way. Whenever a new framework came out (Tapestry, Wicket, GWT, stripe, grails, AppFuse, Play, RichFaces, Spring, etc), I would try it out and see if it was any better, and most times it was only a little better, and sometimes not better at all. I do have to say the play framework is a step in the right direction. Batteries not included: One of the most annoying parts of Java was the fact that most of the libraries that you use were not included in java itself, you had to include a ton of 3rd party libs from places like apache commons. If you use something like hibernate with any other large library, you end up in Jar dependency hell, where hibernate needs one version of a jar, and something else needs another version. If you load the jar files in the wrong order, you are out of luck. You need to depend on tools like maven, and ivy to manage your dependencies, and this just brings in more dependencies into your project which results in projects being huge. I had some war files 100MB+ war files for the simplest web apps. Too many options: For some reason there seems to be way too many different ways to do the same thing in Java. There are over 38 different web frameworks for java according to wikipedia (http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks#Java http://en.wikipedia.org/wiki/Comparison_of_web_application_f...) and 23 different ORM's (http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software#Java http://en.wikipedia.org/wiki/List_of_object-relational_mappi...) just to name a couple of examples. If you look at other languages they have a more reasonable number. Some people think that having lots of options is a good thing, but it isn't it leads to a lot of wasted effort in the developer community, everyone is reinventing the same wheel, and if you are a new person to the language you have too many option to pick from. App servers: Java web applications are really heavy, and require a lot of resources to run. They are especially memory hungry. Like any piece of software they can be tuned to reduce their resource footprint, but compared to other languages their out of the box setup is horrible. In my past I have used weblogic, websphere, Jboss, tomcat, and jetty. I only used the first three when I was forced to use EJB's, but even if you aren't using EJB's they were large app servers and sometimes hard to configure and get running correctly. Tomcat and Jetty are much better and easier to setup, but are still resource hogs. App Hosting: If you aren't running your own server it is real hard to find shared hosting for your java apps at a reasonable price. The main reason is because java apps require much more memory compared to other languages, so it doesn't make sense for a shared hosting provider to spend their valuable RAM running a java site, when they could run 5 php sites in the same place. That means there are less providers offering java hosting, which in turn means higher costs to run your website. Development Time: When I developing in java, I found myself much slower then what I can do in python. I would need to make a change, compile, redeploy and then test, and this slows down the iterative process. I know there are ways to make this faster, but even at it's best, I felt much slower then what I can do in python. There is also a lot less boilerplate code to do the same thing in python, so I spend less time developing the code as well. Java just feels over engineered in a lot of parts, A lot of the API's and interfaces are just way to complicated for what you want to do. And everyone and their brother thinks they are a java architect and this results in big complicated systems that are hard to use and develop with. IDE: When I was developing in Java, I felt stuck to the IDE, I was lost without it. IntelliJ is the best IDE's on the market, and it was hard switching to python because there wasn't anything like it for python. So instead of an IDE, I just used textmate, which is just a normal text editor. It was hard at first, but because it was just a text editor, it was a really fast and responsive application. I could open my whole project in a few seconds, whereas when I want to open a project in an IDE it could take a minute or more, with a machine with a ton of RAM. The makers of IntelliJ came out with a python editor called pycharm, I bought it when it first came out, and it is great. But what I realized is that I don't need an IDE for python, I'm fine with a text editor. When I go back to working on Java web apps which I have to do from time to time, I try to use the text editor, but I haven't quite mastered that yet. I personally need the IDE for Java more because If I mess up something it takes longer to recompile and redeploy, which slows me down. ORM: When I first started using Hibernate as an IDE, I thought it was great, it had it's problems, and it wasn't perfect, but it was better then what I was doing before. I was happy with it, until I did an application with Django's ORM on a python project, and that opened up my eyes, that is how an ORM is suppose to work. After that project I went back to hibernate, and I just felt disappointed, and longed for going back to Django's ORM. Another great python ORM is sqlalchemy, which is similar to Django's ORM, but a little different. I have limited experience with ROR's ORM, but from what I remember, it was pretty good as well. Templates: The web templating systems in Java aren't that good, and I think I have tried them all (tiles, freemarker, velocity, etc). Most of them offer only basic functionality and are a pain to work with. On the Python side, my two favorites are Django templates and Jinja2, they have everything that I could need in a templating engine, and are really easy to use.
- mks 14y agoWe (plumgine.com - in private beta) have been using Java with a success with Play Framework and asynchronous AJAX fronted (some parts with Backbone.JS). I have been using Java for a while (8 years - J2EE, Android, some desktop utils) and back in the JSF days I used to hate the Java web with a passion. Then I found Stripes (step in a good direction) and Play Framework (absolutely awesome Java web framework). These days I can whip out prototype in Java+Play Framework faster than anything else. Some of the reasons: * I don't have to worry about naming methods/members because I can safely rename them later * I can easily map Java objects to JSON and back using Jackson * most of the time I don't worry about database schema - Hibernate (JPA) generates it for me * Play Framework works in the "hit refresh" mode to see changes * deployment to Heroku is as seamless as any other. There is increasingly more action going on in the browser in JavaScript and I think Java (with Play Framework) is a great tool for building backend APIs that will be consumed by your JavaScript client.
- mark_l_watson 14y agoI think that Java still has a strong role for writing REST web services and heavy lifting back end stuff because of the robustness of the JVM and lots of great tools and frameworks. That said, most of the web services I have written this year are in Ruby (with some Python in the last few weeks). For web app front ends I really prefer lighter weight tools like Rails.
- st3fan 14y agoI do a lot of work in Python now, which is great. But the one thing that I really really really miss from Java is better dependency management and packaging. I wish I could just create a .war file for my Python project and copy it to a deploy directory on a server to get it going. Using a virtualenv and pip or easy_install works ok but a simple maven config to define my project and it's dependencies is still lightyears ahead of the mess we have in Python now. It is really difficult to beat: 'mvn package && scp target/my-app-1.0.war server:~/deploy/' I hope Python will get there.
- edwinnathaniel 14y ago... and if you wouldn't mind to spend some more time... http://maven.apache.org/plugins/maven-deploy-plugin/ http://maven.apache.org/plugins/maven-deploy-plugin/ "mvn deploy" is probably all you need? :D
- Morcane 14y agoJava frameworks are insanely overengineered. It's utterly and totally retarded. The culture shock I experienced when I switched to Java, from 15+ years of C server/systems programming was over the moon. Factories here, decorators there. wtflol. Patterns are not Java specific, but it is all the lingo you need to be able to parse.... But hey, we can keep selling courses .... It has become an enterprise language and therefore, the biggest issue is not causing too much uprising. On the side, I do RoR and NodeJS projects and those are a ton of fun to do, and give me ideas on how to reduce clutter and complexity in the Java projects.
- 1010011010 14y agoBecause Java sucks. Please, for the good of our industry, please stop using it.