Thursday, April 30, 2009

Java Web Development - Shopping Cart Tutorial

I have written a number of tutorials covering a whole range of topics, patterns, technologies and frameworks regarding developing Java web applications. Over the next couple of days and weeks I will be posting these tutorials on my blog. They are primarily intended for junior Java developers who would like a smooth and relatively easy introduction into building web applications.

I have purposefully kept every topic as simple as possible in order to not over complicate matters. The reason for this was to try and give you a base to work from so that you can be up and running as quickly as possible without feeling too overwhelmed.

Why would I recommend these tutorials of mine when there are many similar tutorials like these over the internet? This is a good question and my answer to that would be the following:
  • Working examples – I have created a complete working web application that is used throughout each tutorial. The Shopping Cart application. It starts off small and as the tutorials progress the application grows. You can easily download the different versions of this application for each tutorial, import it into your Eclipse workspace, view the source and deploy it to a Tomcat server to see how it works.
  • Simple - I have tried to keep the examples I use as simple as possible without complicating issues unnecessarily. So often we are thrown into the deep end and expected to swim. We drown in the confusion and complexity. By simplifying each example I hope to give you a starting point for you to build on.
  • Best practices – I have tried to include best practices and design methodologies within each example.
  • SDLC – I follow a specific industry recognized path to take when tackling a project. Each tutorial will step you through the software development lifecycle (SDLC) of the shopping cart application.
  • Wide range – I have covered a wide range of different technologies and frameworks.
  • Online support – I am here to offer support and assistance to you as well as answer any questions you may have. But there is a catch – this is for a limited time only. If you are going through this tutorial and the year is 2030 you really should be doing something else with your time.
So what are these tutorials? Another really good question. The tutorials are broken down into the following steps:
  • Analysis – So what’s this got to do with Java hey? We’re technical people not business people so who cares about this stuff hey? Yeah I hear you…however understanding the business requirements will really ensure you know what to implement and how to implement it. Not understanding the requirements will lead you to implementing something wrong then redoing it and then smashing it done and then taping parts of it together and then you wondering why you ever got into development in the first place and wishing you can find another job to get out of the mess you created. Besides all that it is good practice and your boss would be quite impressed with you because you know what is required of you. So read and learn this tutorial it is important.
  • Design – Based on the requirements and use cases defined in the analysis tutorial we learn how to model and design are application. To top it off we also generate our main service classes from our model.
  • Test cases – It is a good idea to begin your development to write a few test cases to some of our major components. Writing test cases highlights a lot of areas that were missed in the design phase.
  • Build – We add an Ant script to our project to automate our build.
  • Web development  – Ok time to get your hands dirty. We take our design and test cases and we start to flesh out our web application. This would be the first draft of our Shopping Cart web application.
  • Facelets  – A short tutorial on using facelets to add a template to our web application so that you don’t have to have a JSP include on every single web page.
  • Hibernate  – In this tutorial we learn how to use Hibernate to persist our data to a database.
  • Spring  – We learn how Spring can be used to make our lives a lot simpler...yeah you have to learn Spring before than…arghhh but don’t worry you will see it is actually quite simple to use.
  • More test cases – We learn a little more about unit testing and integration testing. We leverage off Spring to make our lives simpler and we use mock objects to test our service layers.
  • AJAX – In this tutorial we learn how to turn our web application into a Rich Internet Application by using RichFaces and AJAX.

Bonus tutorials
I have added these extra tutorials that weren't part of the original 10 but follow on from the last one (i.e. AJAX)

I hope you find these tutorials helpful and I hope to hear back from you.

Tuesday, April 28, 2009

Scalaffinity - Scala, Spring, Hibernate, Maven project

I was looking around to see how to build a JUnit test case using Scala with Spring. I came across this project (currently still in development) called Scalaffinity. You can connect to the SVN repository and download the project. That’s what I did and it has everything I was looking for and more. Thanks to Álvaro Martínez Hernández who put this project together.

Friday, April 24, 2009

Scala IDE -- What Scala IDE?

So I am learning Scala...why one might ask? I was one of the ones who asked and the answer was quite straight forward and direct: "Do it or you're fired you lazy bum!" I knew nothing about the Scala language up until a few weeks ago and I wasn't over the moon to find out I would have to learn yet another programming language but those words were ringing in the back of my head and it was just  enough to motivate me and get me started on my journey in the Scala language.  

Having said that and after doing a little reading up on Scala and playing around with it I have changed my tune...from death metal rock to dance. I am feeling a little excited (even at my age) about this language and can already start to see a number of the benefits this little yet powerful language has to offer.

However...having said ALL that the development tools I have tried have been anything but pleasurable. I was hoping for chocolate nut sundae but got a whopping bowl of fruit salad with cream. 

I use Eclipse (Ganymede)  as Eclipse is my friend. Yes we have good times as well as bad. But we understand each other. I was using the 2.7.3 Scala Eclipse plugin and it was giving me a little hassle. Every now and again the same file would look as though it would duplicate itself and now today while in the middle of editing a Scala class my file became read only for some reason. I noticed a newer version of Scala is available (2.7.4 final) and I found a newer Eclipse I uninstalled the Scala plugin and restarted Eclipse. To my surprise Eclipse doesn't start up...well it tries to start and then it dies and then it tries to start and then it dies. It got stuck in a loop and the only way to kill it was to reboot my pc. Sigh. 

I still have this problem and I will spend more time on it tonight but in the meantime I played around with NetBeans 6.5...hahaha my allegiance, what allegiance you say? I was able to install the Scala plugin for NetBeans and created a project without much hassle. Besides that I haven't done much but will report on how things go. My first impressions are a lot better than with the Eclipse Scala plugin. 

I spent a couple of hours today working on this issue. I tried many things and seemed to be making progress until I completely corrupted my Eclipse installation. 

I did happen to find some useful information on the scala-lang web site. They seem to have addressed a number of problems in the previous version. You need at least version 3.4.1 of Eclipse in order for this plugin to work though.  I updated my Eclipse to 3.4.2 and I had to also follow these instructions to get my Scala classes compiling. 

I had a little time to play around with NetBeans and was pleasantly surprised with it however since most of the frustrations with the previous version of the Scala Eclipse plugin have been resolved I am going to stick with Eclipse. 

So to end this discussion there are tools out there to develop Scala applications. They may still carry a number of frustrations with them but for now I am happier than I was last week. 

Blogarama baby!!

Welcome to my blog...I hope to add useful information that maybe someday somebody out there can benefit from (with no guarantees of course) -- what I would really appreciate is a collaboration of thoughts from various people willing to contribute to the topics discussed. I hope that happens. 

So what is this blog about? It is primarily for programming solutions and thoughts that I have encountered and come across in my line of work. Yes I am one of the many geeky computer nerds out there with their own blog about stuff that is geeky and nerdy. So what makes me any different from the rest? I like to think it is because I am special. At least that's what my mom used to say to me. 

I will be putting together a series of posts on web development. I should mention that I am a Java programmer with a particular interest in web development. 

Until my next post, adios amigos!!!