Taking the next step with java development? - java

I want to take the next step in java web development, I am hoping to get insight & feedback on: what my next steps should be and how best to take them.
While learning the basics of java web development, I put together a simple web app that performs simple accounting and financial calculations. The web app is on a single jvm, uses Tomcat, and has standard web functionality - i.e. login/logout, basic security, etc.
How can I make this web app more "enterprise ready" - distribute functionality of tiers over different servers/jvms, HA, balance-able, etc.
What do I need to know/learn? - i.e. EJB3 or Spring Framework (seems spring is better option), REST and/or SOAP, etc.
How would one recommend (books, websites, etc.) I learn the "requirements" (see preceding line)?
Thanks!

In my opinion, you should try different approaches for a same problem, so you could compare the pros and cons of different tools and frameworks.
For instance, try to build an application using EJB, and then the same application using Spring. Take the presentation layer of your code written with JSF and then rewrite it using Tapestry.
I think this will be very helpful to you, as you'll be able to make best decisions when choosing tools for your future developments.

A few things to consider, as food for thought:
How good is the error handling/logging of the application? For example, if the user tries to put in X in for a currency value, what does the application do?
What is configurable within the application from the user and what is in configuration files and what is in a database with regards to configuration? Do you have passwords encrypted within the application?
What patterns would used in building this application? Are there patterns you could see using now that you have a prototype?
Is this application ready to handle different currencies and languages?
What happens if someone leaves the screen for a few hours and tries to use a form?
What administrative functionality does the application have?
Does it handle the case where the user has JavaScript disabled?
What are the limitations of your application, IOW what can't it handle the way it is?
Have you considered trying to write a manual for the application?

EJB or Spring? gets asked quite a lot nowadays, here's a decent related question about them.

Have some real users using your application. You'll be amazed on how many "new" features/improvements can be performed in your app ( and the technologies you'll learn to satisfy those requirements ) by having real users using it.

I would suggest the following books/tutorials are a must for every Java developer:
Manning: Spring in Action - 2nd edition
Manning: Java Persistence with Hibernate
Core JavaServer Faces
Adobe Flex ( Adobe website video tutorials )
Effective Java
Apart from the standard technologies above you must be familiar with
Different testing frameworks , JUnit is a must
Build tools like ANT and Maven
Also you can build small projects by downloading trial versions of MyEclipse or Flex Builder.

I suggest that you create small java experiment projects for each new framework/library that you want to learn.
I've had good success using maven to help me quickly and consistently create java projects that I use to experiment with one technology at a time, such as Spring, Hibernate, etc. I use maven's site life cycle to record notes about what I learned and to document how to build and run each project. So, now I have 20 or so projects that I can use as baseline projects, one for each framework, to build upon.
Also, I prefer buying and reading books rather than relying on google and websites to learn new frameworks. Seems that I'm able to learn a lot faster this way.
I also suggest that you write web apps that you, yourself, would want to use. Or write a web app that solves a problem you've been having. I've found that I learn a lot more this way rather than simply copying and pasting from examples in a text book.
Hope that helps,
- Dave

Spring or Tapestry would be good options for new learnings. Does your app use any web services? If not work those in. Work with other application servers like JBoss and Weblogic and note their nuances with java. I'd also recommend learning Maven and work that into your build/deploy process.
Have fun,
Mike

You could vastly reduce the time taken to build your apps by learning some Test-Driven Development.
Try learning JUnit - it's becoming a core skill now, even in unagile shops.
If you're focussing on the web, try out Selenium - which has a Java controller to drive your tests from Java test cases.
After investing a bit of time in TDD will pay off no matter which frameworks or apps you work on. If you learn to test drive your code, you'll end up with smaller, cleaner code and less debugging.

You might look at AppFuse, which is a bundle of Java things together.
Or, you might take a look at a few more technologies to play with and add in:
Version Control - SVN
Tools - Ant or Maven
Framework - Spring, Seam, Struts
ORM - Hibernate or iBatis
Test Driven Development - JUnit, Emma
Continuous Integration - Hudson
I'd also read the Pragmatic Programmer and/or Code Complete.

Allow me to state that "enterprise"-ready does not necessarily imply scale-out solutions, many, many enterprise Java applications are running on larger systems requiring long-running-systems skill of their own.
I recommend mastering the Java language and runtime, understanding how bytecodes and loading traverse the JVM vs. focus on any given framework.
Speaking of frameworks and if you really have the time, try recreating an application framework yourself. Try and re-invent the wheel. IMO it is an excellent lesson in why frameworks themselves exist and teaches one to employ the features instead of always trying to work around them.
One more thing, never forget the database. I don't care what that looks like Oracle, MySQL or NoSQL, but become also an equal master at the data store.

Related

How much effort needed to deliver a solution based on Apache Ofbiz?

I was trying to get some info from documentation, but it seems that it is one of those projects that you have to check out and play with it to figure the answers out ...
I noticed of hight activity on mailing list and quite a lot of commits, it's a good sign. But when I was looking into the code base (btw 536MB big - not a good sign), I didn't find to much J2EE app fashion in it. No spring, ejb, weird folder structure, quite a lot of non-standard jar libraries. It's like the developers didn't like it so they've done things their own way :-)
I've been using a few similar platforms, mainly portals and for example Liferay is quite easy to work with because it looks as one would expect it to. It is based on Spring, it has, transparent service and dao layer, it has simple plugin architecture (plugin = WAR) etc., typical J2EE development.
I'd like to know what are the key aspects that a developer should be aware of before he decides to use it. And as it is quite non-standard J2EE application, how much time consuming is to get to know it to be able to be productive.
What are its (dis)advantages in comparison with other ERP systems like OpenBravo. If I need mainly Cart rather then ERP backend, should I be interested in OpenTaps ?
I was also playing with Broadleaf Commerce which is way easier to start with.
Thanks very much in advance.
There is a learning curve and it's not easy to get skilled developers who understand the core of the system which is the Entity Engine and Entity Model.
The database model is built on the Universal Data Model which is why it can support a very wide range of data types. Even JIRA is built on the OFBiz Entity engine.
There are many Ecommerce shopping carts built on OFBiz, and it depends on the extent to which you need to customize products or build configurable packages.
It's very well suited for vanilla products i.e. pick and choose, compare, add to cart. Easy to call web services and expose web services, easy to integrate with PayPal etc. So if you're selling Tshirts and Flowers, it's good.
Anything like configuring a complex product like a laptop with various options will require some custom coding in Beanshell (BSH) or Groovy in addition to Java code.
Also it does not naturally integrate with app servers, it runs on it's inbuilt Tomcat but porting to Weblogic etc will be some effort.
The other problem is not enough detailed documentation, I would not say it is missing, it's light - the developer cannot expect an easy tutorial for eveything, it's more "ask and you shall receive" and you will get help on the forums - Usually you get direct replies from David Jones who wrote the framework, so that is helpful. But people who start with OFBiz need at least 3 - 4 months of studying the code and running simple applications before actually building anything.
That's my personal opinion, hope this helps.
I have not worked with Opentaps so really can't comment on that.
Re other Open Source ERP projects: watch out for projects dominated by one company, where the Open Source thing is a marketing vehicle, and it's really Open Core.
Open core means you pay for "plugins" to complete your system, and there is no incentive to standardise and to move functionality into the core.
If it's dominated by one company, they may take the project private at any time, as happened with Compiere.
OFBiz is a genuine community project hosted by the Apache Software Foundation.

Fastest way to code up a quick CRUD app. when I have some reusable java code?

I have to come up with a basic CRUD app. as fast as possible (and by "fast" I mean like 3 days).
I considered going with Django, but I don't have a lot of experience with Python/Django, and also I have a complete set of EntityBeans that I need do CRUD on. So I thought reusing them would be better.
The resulting CRUD app. should be similar to the Django admin page (but the Django admin page per-se won't work though).
Is there some framework with which I can start with EntityBeans and get a quick, Django admin like skeleton?
If you don't want to change a technology stack you're working on and still have an Django-like administration interface, there is a Java alternative - LightAdmin all-in-one library.
After declaring Maven dependency & enabling administration panel in your web.xml, you will have a complete CRUD with some additional features, like filtering, scopes, security, etc.
The only code related to data administration in your codebase would be DSL configurations for UI customization.
The only thing is that LightAdmin could be used only for JPA domain model entities administration for now.
I would recommend the playframework as it is easy to learn and quick to get up and running. They have a CRUD administration module you can use to generate CRUD framework based on your Entity model. Also check out their tutorial page.
You must try AppFuse or Spring Roo.
http://appfuse.org/display/APF/Demos+and+Videos (+online demo)
http://spring.io/
Spring Roo gives you a CRUD application up in 10 minutes. Unlike other frameworks this really is practically usable.
I have downloaded the Roo shell for the first time and without reading any documentation I managed to get an application up and running within minutes.
Naked Objects, if you're look at a prototype. Although it does have a "viewer" for Wicket apart from the HTML viewer, I would recommend using the framework primarily for fleshing out the functionality of your domain.
You might also want to check the Scimpi viewer, although I must admit that I havent worked with it.
A demo application using the HTML viewer is hosted online, and is accessible for having a quick look at the functionality. A tutorial demo is also hosted online.
Give Grails about 2 hours, and if you don't have a CRUD app after that you're doing something wrong.
I've used CodeCharge Studio by Yes Software for several years, and am able to build a CRUD app in less than 10 minutes (assuming database already exists). CodeCharge has a bit of a learning curve if you want to go beyond the interfaces created by the wizards, yet I think my development time has increased by a factor of at least 30 from writing my own code.
I use it at work to create PHP applications that hit MSSQL, and other projects that hit MySQL. Works like a charm for both.
http://www.yessoftware.com/index2.php
I am not a "pythonista" so this may be absolute rubbish but could Django running on Java be the answer for you?
Jython is an implementation of python for the JVM and can run Django.
http://docs.djangoproject.com/en/dev/howto/jython/
Yes Java has many such framework for both web and desktop but .net has very few..
I recently used RocketFramework , which was to my expectation.. So just thought to post it here so that anybody interested have the link :-)
You can create a Quick Crude App in minutes using HTML5, i found www.quickcrud.com that allows you to generate the HTML5 on line and also it's possible to generate Android Apk also in minutes!

Start with Java (JVM) ecosystem

I have came from another question to this one:
How can one start with Java (JVM) ecosystem? What are beginner, intermediate and advanced knowledge-bases (bags!)? To be honest Java ecosystem was always a bit confusing to me, so it would be very helpful to provide some "reference references" and "defacto tutorials" for learning (curve!) JVM.
Note: I want to use JVM with Scala (or Clojure) but not Java itself.
I am a C# developer (WPF, Windows Forms, ASP.NET, Web Services, ... like that).
The Java Tutorial is a good place to start.
Update: you have enough questions for about a dozen posts here ;-) Honestly, you should do some research yourself (Google is your friend), then ask more specific, targeted questions; that would yield better results. (e.g. I don't think anyone can answer your question regarding Swing or JavaFX without more specific details about what you are trying to achieve.) I try to give a few pointers below, about areas I know to some extent.
for servlets and other web frameworks, here is a bunch of tutorials.
Tomcat and Jetty are both application servers.
there are a lot of different web frameworks, because different people have differing preferences, ideas and style, so many have created their own framework. It can be confusing, but at least there is choice :-)
for persistence, apart from JDBC, ORM frameworks are another strong option. I use Hibernate and I can recommend it; in a bigger project it can make your life much easier. Ultimately it depends on your specific project and constraints; there is no single right choice.
AFAIK Java has no equivalent of LINQ.
See also this post for further recommendations.
Java based web applications need to run inside of a web container such as Jetty or Tomcat.
You build your app and deploy it to the container which hosts the application at runtime.
Pure/plain JDBC should only be used directly by simple applications or integration layers that do not have access to the class model.
Most applications that I have seen have used some kind of Object Relational Mapping framework which models the entities as classes at a higher level than plain old JDBC.
Popular O/R frameworks include:
hibernate
toplink
datanucleus
cayenne
For web based development, you could start with AppFuse, see the quickstart guide.
AppFuse is a templating system that generates the skeleton of an application for you.
Then look deeper into what has been generated, and see what frameworks they are using.
AppFuse lets you choose between different technology stacks, so you could compare.
I haven't seen AppFuse support for Guice or GWT.
Guice is a Dependency Injection framework, others that could be used instead are Spring or picocontainer.
Another investigative approach that you could try would be starting with AndroMDA, which is a model driven architecture framework - you start with a UML model and then generate or forward engineer a working application.
AndroMDA also lets you control the choice of the underlying framework implementations by configuring different cartridges, once again you should dig deeper to see what they are using in the generated application.
If you are looking for a basic introduction, then the Java Tutorials are nice. To do other things like Java Web Development, then your going to need to consult google for the respective technology since they vary so widely.
One book though that I highly recommend taking a look at is Java Concurrency in Practice
Yeah, it is almost impossible for new guys to get started. This is going to drive away a lot of developers, and Java is in danger of not having constant new bloods. The old farts would love that, it's great for career security, and that's why they are making Java more and more complicated.

What do I need to learn to build a web app in Java? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I've been doing PHP/MySQL web development for a while and I'm fairly competent in it. Lately however, I've learnt Java and fallen in love with it, and I'd really like to do more Java work now.
I've gotten my first opportunity with a client who needs a web 2.0ish web app built, and he has agreed to let me use anything I want to, including Java. However, I haven't done any web dev. in Java before, I've only went through the official Java tutorial, learnt a bit about applets and build a 2D pacman game, and have done some simple work in Google Web Toolkit.
I need to get started with this project in the next 2-3 days max, so I don't have much time to read long books about the topic. This is what I've learnt so far:
Setup a Tomcat on my dev machine to work with Eclipse
Learnt the basics of servlets, the doPost(), doGet() and init() methods, etc
Built a mini MVC app which displays a HTML page, lets you pick something from a dropdown and when you hit submit, it retrieves your submitted value through request.getParameter() in the doPost() function, and then forwards on to a JSP page which shows which value you picked.
I think these are the next few things I'd need to learn:
How to access/use databases
Sessions and Cookies
Possibly more about the syntax of JSP pages.
There seem to be hundreds of topics about Java web dev which I don't know anything about., but I don't have time to learn everything. I need someone to point out any other crucial things I'd need to learn, in order to build this web app (with perhaps 20 screens) using Java and Google Web Toolkit.
Also, I'm coming from a CodeIgniter background which is an MVC framework in PHP that makes things like form validation, sessions management (it uses database sessions), pagination, and common tasks like these very easy. If there is a similar, lightweight framework in Java that can take care of things like this, please mention it as well.
Thanks.
You should skip basic servlets and use a web framework, from Struts + Tiles (simple to get to grips with - a few hours at most) to Spring, etc. In your case I would also use Hibernate for database abstraction - you don't get up to speed with JDBC in such a short time.
There are so many different Java Enterprise technologies it's pretty hard to know where to start. As previously mentioned, the head first JSP & Servlets book is excellent. I currently work on an Enterprise app that was made years ago with just Servlets. We have migrated over to JSP's as time has gone on but we are not using any of the newer frameworks. So it is for sure a valid way to do it, although dated.
The thing about java, is that most enterprise development is a conjunction of a bunch of different technologies. For example, you could create an app using JSP's for the views with a Servlet back-end, using Hibernate for you DB connections, JDOM for your XML, JUnit for your testing framework, Log4j or AspectJ for your logging framework, Lucene for search, JBoss for deployment (and deployment can be pretty non-trivial) etc. etc. etc. You aren't going to go out and learn all of those technologies in the next 3 days.
What I would suggest is (as previously mentioned) to pick a framework, and there are many to choose from such as Tapestry, JSF, Wicket, Struts, etc. that will abstract away a lot of the underlying technologies. Any java technology you pick will have a good community behind it willing to help.
Another thing to consider, since you seem to be in a hurry to get things working, is that (in my opinion at least) Java is not a FAST language to build things in. It is very verbose and unless you grasp the nuances of good Java web design it is very easy to shoot yourself in the foot. Perhaps you should look at some of the other technologies that are available on the JVM (so that you have all the Java libs available) such as Groovy.
Groovy allows you the ability to program with Java syntax if you choose, or a dynamic Ruby-like syntax. Additionally, Grails is pretty much a Rails clone for Groovy and will let you write a web app in no time at all.
Whatever you choose to do, good luck and welcome to the wonderful world of Java Web Apps.
As a start, I would recommend you pick up Head First Servlets & JSP. It will give you a nice overview of Java web development. From their you would be better able to pick a web framework to use.
I'd recommend Matt Raible's app fuse .
It will give you a crash course in hooking your app up to a database, using a mvc framework, as well as some of the java build tools.
This App fuse demo will show how quickly he gets things rolling.
For basic simple java based web-app follow below things
Install IDE (eg. eclipse,netbeans)
Install web/application server (eg. Tomcat/Jboss)
Configure server in IDE
Create new dynamic web project with JSP/Servlet
learn/develop and run sample applications which includes advance technology like Spring,Struts,Hibernate,EJB etc.
I believe design is more important than technology, so keep learning design patterns. all major frameworks are based on different design pattern.
I would suggest that you try JSP first. JSP is simpler since you don't have to deal with the underlying server technology, not for simple applications atleast. It will get you up to speed. Later, as you gain experience, you can use servlets directly.
It will also fit well with your PHP intuitions.
It's true that starting with Java Web development is not as easy as PHP, especially with CodeIgniter, a framework that I've fallen in love with.
I'd recommend Grails, but first pick up a book on the subject. I've found that in order to get productive quickly you'll need a proper reference. Personally I used The definitive guide to Grails.
I would recommend grabbing a copy of the Servlet 2.5 Specification for reference purposes. It's a fairly nice read, and not too dry for a specification.
It explains about Sessions, Filters, Listeners, threading model, etc...
Also, take a look at the JSP Model 2 architecture (better link) which explains the best use of servlets and JSPs.
I wouldn't recommend looking at Struts or Spring if you only have a few days to get up to speed from scratch. Once you have gained familiarity with servlets and JSPs, then you could look at Spring MVC for an approach that supports easier unit testing for controllers.
You should better learn basic servlet and JSP lifecycles before you touch any framework.. that ll be better, coz you will have a good grasp of the inner workings.. Head First Servlets and JSP is the book you should go for..
I would consider using Groovy on Grails. It's a lot easier to get started and it has a lot of of things that you need built-in. GWT is available via a plugin as is JQuery.
The nice thing about Groovy is that it is basically a superset of Java with the great quick start speed of Rails.
And it will deploy as a .war to your Java EE app server.
I love the Sam's book, 'Teach yourself J2EE in 21 Days'. Awesome for concept reference and basic syntax. Should be pretty cheap by now too.

What OSS project should I look at if I need to do Spring friendly WorkFlow?

We need to add WorkFlow to our Spring managed application. Does anyone have any useful experience in using any of the myriad of OSS Work Flow solutions? Which one is best? Which one integrates with Spring best? Which ones should we avoid?
If you only need some simple process orchestration, Spring's own Web Flow, despite its name can serve as a orchestration task manager. If you need to preserve state for several days then you will need to become an 'early adopter' of one of the open-source projects. You may want to look at Eclipse's BPEL project.
My hunch is that once a clearer picture of the BPEL/BPM/Workflow space emerges you will see Spring provide an abstraction layer the same way they have for JDBC, Transactions, ORM frameworks etc...
Like Brian said if you're doing anything of great complexity you might look at using BPEL.
There are a number of open source BPEL engines, one that comes to mind is Apache Orchestration Director Engine
I second Spring Web Flow. Depending on how complex the process is, Web Flow is great for managing various states and I've found that it's pretty easy to pick up and there's a good amount of documentation out there for it.
ActiveVOS is by far the best BPEL engine in my opinion. Download the evaluation version and give it a go. JBoss have even adopted their open source offering.
We're looking at Drools/Guvnor, possibly integrated with jBPM (as in this presentation), to add a workflow engine to our Spring/Java EE app, but we're still in the very early phases of trying it out.

Categories

Resources