Sunday, October 25, 2009

Super Frameworks - develop Java web apps at lightning speeds

In the early days of J2EE (that's how we used to call Java Enterprise Development back then) we had fewer alternatives of technologies, frameworks and reusable components. Web application development was then far simpler than it is today - there was no need for developers to learn a bunch of different things like Spring, Hibernate, JSTL, JSF etc - and things were much simpler to learn and understand. I am not that nostalgic, however, because some big drawbacks compared to what we can do today are that most of what we did was not really reusable (it is hard to consider Copy/Paste as reusable code), we had to spend time writing low-level logic to handle aspects like persistency and logging, code was hard to unit test... the bottomline is that we had to spend more time on infrastructural aspects of our systems than on business logic, essentially killing our productivity and making code quality suffer.

When someone pays you to write a system they want it finished on time and working without bugs. And 99% of the time they have no idea what a JDBC or some other arcane technical acronym is, so they expect you to focus on the screens and public APIs, not in infrastructural code that has nothing to do with visible functionality that they are interested in.

Then few years back we started to see many production-ready frameworks and technologies pop up as new alternatives in our Java development toolkit - far too many actually, but I still think in this case it is better to have more than less. Frameworks and tools like Spring, Hibernate, Struts, jUnit, Ant etc focused on multiple different aspects common to most Java projects like persistency, security, presentation, logging, building and testing, thus improving our productivity.

But then, while this new set of tools helped reduce the need for us to re-invent the wheel it also made the learning curve considerably more steep. Now, just to create a new project we have to install a bunch of frameworks and then integrate each one. It doesn't sound that bad, but let me tell you, it is bad. Instead of wasting time writing connection pools developers now can spend (many) days figuring out why Spring isn't working properly with Hibernate or some other framework. Again, they are not focusing on the business functionality their clients are paying them to deliver.

There are multiple alternative solutions to this problem, each with its own set of advantages and drawbacks. One is to forget Java and move on to another platform like Ruby / Ruby-On-Rails. Instead of a Frankenstein-like system requiring hundreds of independent frameworks patched together, RoR is just one single framework that tries to address most of the aspects I mentioned before. Because of this RoR is more consistent than a bunch of frameworks implemented by different teams. But while many developers love RoR with passion (or perhaps they needed a new theme to sell books?) it is still just a very small niche if we compare it with Java.

A more enterprise-friendly alternative (and therefore one that may help you land in more jobs) is the use of a super framework - which, as the name implies, is a set of frameworks packaged in a pre-configured, pre-integrated manner, with tools to automate redundant manual tasks to improve productivity and quality. There are also dozens of such super-frameworks based on Java but probably the two most known ones are JBoss Seam and AppFuse.

Seam comes packed with more functionality than AppFuse, but it is also less flexible. I don't advocate one over another, but I do believe that if you work implementing web-based Java applications you should consider using something like that. Seriously, after you learn well how to use one of these frameworks you will be amazed how much faster you can do things you did before, like web UI tests, web services, security etc. Not to mention your boss will think you are the fastest developer on Earth, if you do a good marketing of your work.

There are few books available describing both frameworks in detail but you can learn a lot from the project official pages and user forums. There are tutorials you can follow, and the forums have very responsive developers (at least that was my experience) to help answer questions and troubleshoot issues.

I spent a good time learning and working with AppFuse since its version 1.9.x and I can say it was one of the best things I did for my career since I took my first Java certification, back when these certifications were worth something.

Saturday, October 24, 2009

Tools for an efficient development environment

In this post you will find a list of the most common tools and apps I use for software development with a brief description of each.

In the next posts I will describe in more detail some of these tools, especially those that I believe are not that well known. Obviously I am not saying that the tools listed below are perfect for every developer or every situation, nor I am suggesting you should try it (i.e. don't sue me if one of these tools make you sick, kill your cat or something). I am just saying that, so far, they are helping me get the job done.

Lastly, note that each tool may have different licenses (GPL, LGPL, Apache etc) but all are (or have a version that is) "free-as-in-beer" when it comes to simple use.

Development

Eclipse IDE for Java EE Developers - Great editor (or Integrated Development Environment) for Java, JSPs, JSF etc. It used to require hundreds of 3rd-party plug-ins to be decent but since they began bundling it with parallel projects it became truly powerful and way more stable. The only plug-in I find myself installing on a clean instance of Eclipse these days is Subversive, a Subversion client.
Maven - Build manager system. I took some time to get used to Maven after years using Ant but there are just too many cool functions here to let it pass, like built-in online dependencies download, archetypes and hundreds of great plug-ins.
Subversion - SVN is a CVS-like source code versioning and repository system. If you are working on a team of developers you need one of these. But even if you are working alone you need one too. :D
Jenkins (or its former incarnation Hudson) - Continuous integration web portal. Basically you take the time to set it up once and it will pay back in interest every time you have to run a build.
Nexus - This is a maven repository proxy. I will write more about this one in the next posts, but enough to say that if you use Maven you should not rely on the public Maven repositories out there, you need a maven repository proxy. Nexus has a free version and it is powerful and freaking easy to use.
Trac - Trac is a project management, task tracking and WIKI system. I just hoped Trac was based in Java - it is not hard to install it but I guess I'm getting spoiled with tools like Nexus and Hudson that you can install simply by dropping a WAR file in Tomcat's webapp folder. But once Trac is setup it shines - you can easily integrate it with many other tools like Hudson and Subversion.
SoapUI - Use this when you want to run functional tests on your web services. Just do not use it for high-volume performance tests.
JMeter - Use this for high-volume performance tests. I know, SoapUI and LoadUI look nicer and shinier (though I really hate LoadUI's funky UI) but pair JMeter with this and it will save you lots of headaches.

Note: Your development environment gets especially powerful and productive when you integrate tools like Subversion, Trac and Jenkins together to automate aspects like documentation, deployment and testing, and to streamline the communication in your development team.

General

Notepad++ - This is what I use to replace the Notepad application that comes with Windows.
7-Zip - High-performance archiver that also works with almost every format out there.
Agent Ransack - Replacement to the Search function that comes with Windows. I could not hate more that dog that shows up during searches, especially when it does not list files that I KNOW it should be listing (see here for more details on a Windows "feature" in the search function that causes it to not show files under certain conditions)!
WinMerge - Great to compare folders with hundreds of files, like when we want to compare two slightly different local copies of the same project.
FileZilla Client - Great SFTP client.
CCleaner - Remove junk from your disk so you get more available space... and while at it, also remove junk from the Windows' registry. Tip: you can make it even more powerful by dropping this file into CCleaner's path. This will add lots of options to CCleaner (all disabled by default). Just be careful not to set the "enhanced CCleaner" to remove something you might need later.
MyDefrag - Simple, powerful, configurable... best disk defragmenter out there. You can also use Defraggler for quick defrags and leave MyDefrag for big environment updates. Just make sure you don't use any defragger's in your SSD.
Paint.NET - Best free Paint replacement out there.

You can automate the installation of many of these tools with Ninite. This is a great tool that can save you time especially if you use / manage multiple computers and want similar tools in all of them. Go to the website, select the tools you want and download the executable file. Then, anywhere you run this file it will silently install the tools you marked, no questions asked.

You can also use FileHippo Update Checker to keep most of these apps up to date. This app can quickly let you know about updates to most of your installed apps.

And lastly, if you are interested in many more great freeware tools you can find the best ones at the TechSupportAlert's website.


So, this is the initial list. In the next posts I will describe in more details few of these tools, including Hudson, Nexus and SoapUI, and concepts like Build Automation, Continuous Integration etc. If you like this list, a comment would definitely help motivate me to write more. If you find better tools that do about the same of one of the ones I listed, please drop a comment, I am always happy to learn a new trick.

Greetings and my own "get rich" scheme plan

Greetings to you all. Yeah, I know by ALL I meant my still-zero followers, but before I start with my ramblings on Java development and technology I think I should first introduce myself and describe why I think the Internet needs another tech blog.

First, as my personal description states (and where you can find more info about me - though I don't know why you would bother), I am a technology enthusiast who has been working with Java development for more than 10 years. I still remember vividly when Java Server Pages were "the next new thing", and we even had to name extensions of the pages based on the JSPs 1.0 spec like "*.jsp10" because all other JSPs were based on the 0.9 spec. Good times, good times...

But despite that, and my wish to be heard in this channel, I do not want to sound like I am an expert on anything. I just love what I do and I think this blog could be a good tool to keep in touch with like-minded people for a good exchange of ideas. And, if in the process this blog makes me filthy rich with its google ads, then it will be just a mere coincidence - though I think I am overly optimistic on that. Well, I promise if I ever get filthy rich I will write a book (or better yet, pay someone to do it while I spend life in the Caribe) describing how I got rich, and then I will be even richer. Ah if it were that simple... coming back to reality, I guess if your clicks get me one burguer meal per year it will be a burguer more than I expect. Who knows, if I keep writing here years from I could publish this as a book like Joel Spolsky - yeah yeah, I know I am just starting this thing and I am just another developer with a blog, but we gotta dream high, right? :D

My plan for the next posts is to focus on tools and techniques I have been learning or experimenting with, like how to setup an efficient development environment on the cheap (i.e. free-as-in-beer), and more specific techniques related with Oracle databases and Java Server Faces. From there I will keep posting whatever I will be learning / experimenting with in the future.

I will also include here all the sites I read almost everyday, and reviews of the best books I read. Hope you enjoy the ride and help this blog (and its author) with your feedback so I don't feel I'm talking all alone here.

Lastly, I hope you have patience to forgive my obvious lack of English skills - it has been only 3 years, more or less, since I moved to the US. I did not attend school here but went directly to employment, which surely didn't help make me the next Shakespeare. So, bear with me with a little patience and I promise I will try to improve as fast as I can. But if any error passes through the cracks (and I'm sure they will) I will blame MS Word or Google language translator. :D

Yours truly,
Pedro Burglin