Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Java EE instead PHP

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

I'm just in the beginning of my journey with JAVA but i have already worked with PHP before in web projects. I'd like to ask you guys help me to understand why we should use JAVA EE instead PHP in web projects althou although PHP is more easily to work with.

Sorry but the comparison between both languages appears and how i don't work with JAVA and don't know its benefits i try to ask you here, in the Ranch.

Thanks.
 
Ranch Hand
Posts: 261
15
Android Angular Framework Spring AngularJS Java
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Daniel.

A couple of years back I completed the Oracle Certified Master Java Enterprise Architect certification.  I have done nothing with PHP.  Believe it or not, one of the things one is meant to know for that exam is that Java EE is not necessary for every project under the sun (or every project on the web, of course).

It was clearly stated in course materials that sometimes you just don't need all the extra features of Java EE.  If you were writing a small bulletin-board like system, or a system with lots of read-only users but only one person ever developing it, or perhaps even some more powerful systems without having to use JavaEE.  However, when Java pays off, IMHO are situations like below:
* You have multiple developers writing a lot of code and you want a strongly typed, general-purpose programming language for Object Oriented development.  Java was intended to help avoid certain types of common mistakes, among other things--hopefully alleviating debug.
* You want to use the tooling that is available for java (debuggers, IDEs, performance monitoring, etc.)
* You want to take advantage of a lot of pre-written (usually $ free) code that goes along with it.
* You have or want access to the folks who've learned this already.

...and that's just the Java part.  For the EE (Enterprise Edition) part, here is more.
* If you are doing a lot of transactional processing, Java EE handles that well--even distributed transactions.  You won't have to write the transactional code--just EJBs (which have become far more lightweight these days), unless you are doing some rather unusual transactional processing.
* If you need to have connections and object persistence with databases, Java EE can handle that as a configuration to youre server (combined with annotations to inject things).
* It handles security, propagating roles from the front end (web) to the backend (to the database connection).
* You can have resources injected into your components so that you won't have to wire things up/set things by hand.
* Multithreading is handled by just using the EJB pool.  Each one runs in its own thread.
* You can leverage EJBs (or other beans they have now) for your componentization (breakdown of responsibilities among objects).
* You can leverage their new CDI.  You can leverage Java's JSF (I have not, but I have used Struts as a framework, and JSPs. etc.)
* Your Servlets / Web side technologies--even RESTful--can be done in the same server (or type of server) so nothing else to learn and run.
* You can have a fairly advanced solution for asynchronous processing just built in (MDBs and @Asynchronous EJBs).  These can even be done on a timer.
* If you need it, you can use "stateful ejbs" to deal with user or server state--but they are not required very often.
* All the other JavaEE APIs can be in this one server as well--just reach out and call them.
* You can get servers--even for free--that support all this for you.  There are well established companies for this.  And if you grow and decide you want more support you can purchase that as well.  I have known places that did not bother even with big apps.

The chief drive behind Java EE was: "we know most developers want to write business logic; they don't want to have to reinvent or become experts at things like transactions and multithreading."  If you get around certain developers, these days, they will actually eschew this logic.  I have been running into people especially on my last job who want to build everything themselves because they feel they can do it better than the off-the-shelf system can.  If you are that advanced, perhaps you won't want what comes with JBoss (the free server I mentioned) and you'd rather roll your own.  Further, there is a pretty big community who embraces Spring as an alternative to the whole Sun/Oracle Java EE ecosystem.  However, I have seen the two of them integrated and used together as well.

Another thing I will point out: transactions are going to be more associated with SQL/Relational than the newer NoSQL databases. These newer databases have many advantages, but transactions are one of their drawbacks.  You can integrate JPA (the database solution from Oracle) with several of the NoSQL dbs.  So if you like being able to do it all the same way (or you are mixing SQL and "Not-Only-SQL") this might help.

I Hope that Helps.
 
Daniel Zago
Greenhorn
Posts: 8
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes L Foster that's the kind of answer that i'm looking for. And now i know that here, in the ranch, i will learn something.

Thanks.
 
If somebody says you look familiar, tell them you are in porn. Or in these tiny ads:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic