sábado, 28 de septiembre de 2013

The java defeat (I)

Ten or twelve years ago, java was the coolest place to be for a developer. Either you wanted a website, an integration between systems, or any kind of server program, java was the first option. Job vacancies everywhere, careers, good salaries. Java was heaven.

Today, as java leaves the top of the tiobe index, things are completely different. This is my opinion about why.


Java and the websites. 
As I was writing this, it became quite long, so I'll divide it in two parts. In this first post, I'll focus on java as a language to build internet sites.

The wrong war.
Ten years ago, when java thought about its big foe, it looked at .NET: big mistake. Not C#, not asp.net: the real foe of java was php. You may say: "What? That interpreted thing that mixes code and layout, and has no debug environment?" Yes. The language may not be the best, but build your site in php and you will have:
-Lots of internet providers that will give you php support, gigabytes of hosting, and a mysql database. And cheap.
-Wordpress! Or if you don't like wordpress, some other php cms tool like joomla or magento. You will get this "out of the box" from the provider!!! Literally, for 40$ a month, you can start your own website in a few hours.
-Cpanel or some other tool, so that even a guy without experience can manage different websites, databases, backups, ... all inside one hosting.
-And a much lower programming cost, of course. The cost of a php developer is always lower than a java guy. Yes, the language may not be so cool or featured, but you can start from wordpress, buy a good template and a couple of plugins for galleries or shopping cart and save weeks of time.

And what do you have in java?
-Google application engine. Have you tried it? I did, and I felt like a big time sucker. No relational databases, no threads, a time limit for your pages to return, frameworks don't work... even the java is not a real java, it is just a weird subset. 
-I haven't tried amazon, let me know if you did, and what you found. As far as I have read, they will give you an empty linux box.
-You can hire some php hosting and ask for a java installation. You may need a dedicated server for this (more expensive) and you won't have the same cpanel support, but to me, this is the best possible idea for a small business.
-Anything like wordpress in java? Not at all. The most similar could be liferay, and it is years away. But let's discuss this later.

Java focused in competing with .NET capabilities: collections, i/o, modularity. Wrong war. Java should have looked for a standard CMS, and to provide a way to be massively supported by hosting packages. Even today, with java going down, there is no popular CMS project for java.

The clash of the frameworks.
Search for "java frameworks" in google, or just take at the java section in this list of frameworks. There are dozens of them. If you build a site in php, you will very likely start from wordpress, joomla or whatever you want to choose. Those products offer a whole website out of the box, and there is a whole ecosystem of third parties that provide templates and plugins. If you want to build a website in java, you will do it from one of these frameworks. What will they provide? Just a way to create pages, little visual components, connect to databases... very fine-grained stuff. But for some reasons, ten years ago, we thought that choosing the right framework was the most important thing. And we had more and more of them, reinventing the wheel once and again, providing ways to create pages and components.

Java frameworks are necessary, yes. But they are also rigid, hard to learn, and they take time be productive. It is not unusual that you have to be searching in forums or in the framework source code for the explanation to why something doesn't work as one would expect. But the worst of all: there is no "plugin concept". You can't buy a gallery, go to a "config" page, select a zip file and be able to use it across your site. You can of course use libraries, but in most cases we are talking again about fine grained tasks. If you want to build a mansion with small bricks it will take you a long time. Wordpress provides big bricks. Java frameworks provide small bricks.

Today we learnt something: the framework in not the cornerstone. Either if you choose one or another, you will have to build your website. And you will likely not be able to use framework plugins or anything that will really save a big time in your development. Just little libraries.

Portal solutions.
There is no standard portal solution in java. The most successful is liferay. I used an old version, that only worked in jboss: it took 3 minutes to compile and build the ear file, and almost 2 to start running. It used EJB's with local and remote interfaces: adding a method related to persistence implied modifying about 7 source files.

I have read about later versions and I don't see this exact kind of complaints, but I see many about other stuff that ends in the same: build code in a rigid way, which will make you slow and improductive. And I also read about something new: undocumented features that take time to be learnt.

But even with all of that, the real power of a portal solution is to have third party solutions that you can integrate: skins, templates, portlets, plugins. Is there anything like this in liferay? As far as I know, not at all. Even more, we see very frequently that licenses avoid this: companies try to have a complete control of anything related to their product, making difficult any third-party interaction.

Conclusion.
Java is not the reference language right now if you want to build a website. Php, that was seen as a little toy, is now the first option even for big projects. But the very sad thing is that I still have no easy hosting option for a java project. Compare this with php, where you can get a hosting with wordpress, mysql and cpanel out of the box and you will understand why java goes down.

Java focused on frameworks, on servers (jboss, weblogic, glassfish,...), on .NET features, and forgot about the websites. To build a website, the best they can give you is an existing website that you can modifiy, withoug having to worry about the pieces that sustain it.

Java tried (and tries) to fight with "competitors" by incorporating more features to the language. But as a developer, I need a full stack and the language is just the bottom layer. And there are no providers for the full stack in java. Dear java world, if you are reading this, I dare you: build a whole java stack (language, database, server, CMS or portal), make it a de-facto standard, and make it easy for hosting companies to provide it. Or you can just look at how java is less and less used for the internet.

No hay comentarios:

Publicar un comentario