This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I am embarking on buiulding a web site and was wondering if someone could point me in the right direction.
The site has to perform well, has to be scallable and must be hosted on tomcat i.e. not a J2EE application server.
So far i have a presentation layer, business logic layer, integration layer and an oracle database. For the integration layer i have used Data Access Objects to communicate with the business logic layer and then hibernate communicates with the database.
My question is what technologies should i use to build the presentation layer and business logic layer so that the system scales and performs. I.e. should i use jsp and servlets, JSF, Struts, Spring.
I am very worried that JSF runs slowly and will impact the performance. I know this is a big question and can come down to preference. But i know there must be a good solution performance and scallability wise.
So what technologies are recommended for the presentation and business logic layer?
You'll probably get as many different opinions as there are posters, but personally I loathe big bulky frameworks such as Struts, Spring and JSF which, to me, get in the way more than thay actually help.
My advice: keep it simple and stream-lined. Implement a light-weight front controller that utilizes the command pattern and be sure to follow the Model 2 web application pattern. (See this article if you'd like).
Use JSP 2.0 with JSTL and EL and avoid scriptlets on your pages, which helps to keep the line between controller and view clearer. [ March 02, 2007: Message edited by: Bear Bibeault ]
+1 on what Bear said. However, if creating your own front controller is too much to handle or you just want something ready to go, Stripes is a very good light weight alternative to the big boys (JSF, Struts, SpringMVC, etc) that are out there.
Scalability and Performance would have several factors to get influenced from. More than technology choice, it would depend on how you design your application.
Which Technology ? There are other things to consider when you design your application,in deciding which technology you should go for. Some of them are: 1. How stable it is 2. Learnability Curve 3. Community Support 4. Support for the specific functionality 5. Support for specific UI experience
Choices For Presentation Module The choices would be: 1. JSP/Servlets 2. Struts 3. Stripes 4. Spring MVC 5. JSF
Even if you choose to go about using JSP/Servlets, you would end up creating some sort of MVC like code, if your application is more than 2 pages.
Using framework is thus not an overhead, rather expediating and enriching.
All frameworks work good, and have been tested for production use. Struts would be my choice for the stability it offers and extensive support for it in various IDEs.
JSF has a learnability curve, provides you drag and drop feature, if you like it and has over head of execution.
Stripes and Spring MVC are new on the horizon, comparitively. Some people swear by Stripes. Very few use Spring MVC, and I think that is more of a convience if they are already using spring, rather than an architecture decision.
Choice For Business Layer Typically all the MVC frameworks would stop at presentation layer. And you would have to use typical delegation design patterns for business layer. The requirements of Business Layer should be - Database neutrality : This would be DAO pattern that your business layer will interact with
- Support for Transactions : If your transaction spans over a single database, the JDBC transactions provided by DAO layer are sufficient. However if you have transactions spanning over multiple resources like JMS, multiple databases etc. you would use a framework like Spring, which provides best practices encapsulated in a framework.
- Distributed Computing: Would you want processing to be achieved across different distributed systems. This is very critical for scalability, and performance. For your requirement I do not forsee this is the case, but EJBs would be one contender in this category.
I would recommend using simple java objects [fancifully called POJOs] for your business layer. For any specialized requirement as one I mentioned above, consider using Spring. Start with POJOs and then you can graduate to Spring if need be.
Choices for DB Layer This is your DAO. The choices would be - Plain JDBC - O/R Mapping, which give you greater flexibility with your queries [ iBatis] - Tightly integrated O/R Mapping : Hibernate - JDO etc.
My personal preference is simplicity of design. Start with JDBC or Spring DAO. If you absolutely need it, you woudl consider using O/R mapping. They pose an overhead in terms of query optimization, learning curve, and possibly more errors.
Other Technologies You probably have to choose a couple of more technologies - Adobe Flex : For an amazing user experience - XML : For configuration, automatic object-xml transfomration (XML Beans, Castor, JAXB), XSL for transformation of XML to XHTML, SAX/DOM for parsing - Web Services: If your clients need that interface. This would get to onto a tangent though
What to do? If the options provided above make you more confused. I would suggest hiring an architect. You could hire me [ Kidding ]
You can look also in some neighbor technologies like PHP. Generally LAMP is a nice combination for fast development. I can't tell about RoR, but many people choose it against more heavy servlet and PHP technologies.