Well, for a strater maybe aku boleh rant dulu. Sekarang most project aku develop dengan Spring Boot, klau **server mengizinkan** (last freelance invite however suggest on php framework, Laravel to be specific). Jangan takut dengan statement **server mengizinkan** tu. Sebab requirement server tu actually just asalkan ada Java (in which most server at least ada run JRE).
Aku asyik mention Spring & Spring Boot, tp maybe ada yg maseh kurang familiar apa kejadah bende tu.
The Spring Framework is an application framework and inversion of controlcontainer for the Java platform. The framework’s core features can be used by any Java application, but there are extensions for building web applications on top of the Java EE platform. Although the framework does not impose any specific programming model, it has become popular in the Java community as an alternative to, replacement for, or even addition to the Enterprise JavaBeans (EJB) model. -Wikipedia http://en.wikipedia.org/wiki/Spring_Framework
Dan Spring Boot pulak:
Spring Boot is Spring’s convention-over-configuration solution for creating stand-alone, production-grade Spring based Applications that you can “just run”. It takes an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration. – Wikipedia
So, senang cakap, Spring ni framework utk buat Java webapp, while Spring Boot ni versi simplified, convention-over-configuration utk Spring.
Before aku teruskan dengan puji-pujian terhadap Spring Boot ni, aku rasa ramai maseh menyimpan prejudis berkenaan Java webapp dan aku akan try debunk each yg aku rasa kurang tepat. Antara prejudis populer tu, meh aku listkan.
- Spring deployment is expensive and difficult
- Spring is slow (being heavyweight)
- Java/Spring susah nk blaja
- Java is old
Spring deployment is expensive and difficult
Previously, yes. Terdapat bermacam2 configuration yg nak kene buat. Ramai jugak yg confuse java webapp ni dengan Java Enterprise nyer application. Actually, dengan most application container sekarang, proses utk setup server java dan deploy application is actually straight-forward. With tomcat, anda cuma perlu extract the package n run catalina script. Then anda boleh masukkan WAR file dalam folder webapps. That’s all we need. Dengan Spring Boot lagi simple. By default, Spring Boot package it’s application with embedded tomcat. As long server anda ada Java(JRE), anda boleh simply
java -jar path/to/app.jar anda untuk deploy. No tomcat, or application container needed. Trust me, it’s far more eaasier than php to deploy enterprise-grade application in java.
Spring is slow (being heavyweight)
To some extent, this is quite true with those bulky JEE. However, bg yang dh start develop dengan Spring, things is quite fast actually. Most application develop with java is being a big, large enterprise application. Of course it will be a bit bulky klu nk compare dengan average php application. I’ve done both and I can tell u how well is the performance of java web application. + JVM performance has drastically improved over the years.
Now, enter the world of micro-framework, Spring Boot. Sebab most configuration has been auto-configured utk anda, peluang utk misconfigured the framework dan menyebabkan performance issue adalah begitu kecil. Why dont u try it first?
Java/Spring susah nk blaja
Syntax java is actually quite similar with php. But instead of loose typing, Java language is using the strict data-type. So, for most part bila nk compare, assign variable, instantiate class (might be something new utk php, though it’s actually there in php) maybe some adjustment is needed. I believe the most difficult part with java is to grasp the object-oriented nature of Java. It’s more of the conceptual side when learning Java. But if you are able to adapt with OO mentality, you are good to go.
In case of Spring framework, there’s a few concept that you have to learn such as Inversion of Control, Dependency Injection. You can learn it over time. With Spring Boot, you can start by fiddling with the guide project from http://spring.io/guides. The tutorial was designed to be done in 15-20 minutes.
Java is old
Yes, it’s true. Bila buat Java, mau tak mau, anda perlu adopt OO principle behind it. And bila dh buat pkai OO, there’s load of benefit comes after. Walaupn Java ni kdengaran agak lama, tapi spec Java sentiasa dikemaskini dan diimprove oleh komuniti yang disar disebalik Java. Even more, banyak language baru improving and retrospect to the Java’s language properties. Things such as strict data-type, multithreading, object-oriented features, hampir semua tambahbaik menjurus kepada design-apect yang sediaada pada Java. HHVM/PHP7, ES6 to name a few. Bezanya, feature tersebut sudah lama dlm Java and improved over-time. There’s also new features dr language lain yang diserapkan dalam Java(ie. lambda expression) and we know it’s always improving.
And so, I will start writing on how to start with Spring Boot easily and building your first Hello Word application.