Our applications all have very different nature and purpose. However, inasmuch as they are different, one thing remains constant: they are all web applications. In the past, developers would take the lessons learned and patterns acquired from one application and carry it over to the next one; and by carry I mean copy and paste. Ouch!
What is the one benefit that developers strive for with object oriented design? Code reuse maybe?
Think of the time and money invested (wasted) in paying our developers to go and redo (reinvent) what we had already done before.
Conceptually, an archetype is like a mold or template for an entity. In our case, an archetype is a template for a software project. You can create archetypes for projects in any platform: Java, python, PHP, etc.
In an effort to solve this problem, I considered using Maven Archetypes. Our team was already using Maven for builds pretty successfully, so it was a natural step forward for us.
I came across a great step-by-step article:
Currently, I have built our department's archetype project and will have it ready to use when it comes time to build yet another web application for our customers. The idea was to code the greatest common denominator of component scaffolding required to kick off a software team that then only have to worry about the domain specific problem.
We rely heavily on Google's App Engine platform and Google Web Toolkit (GWT) for the client.
As part of the archetype I added things like:
- Single-Sign On strategy
- MVC framework
- Backup solution
- Standard POM file (very important)
- Common utility classes that we rewrite every single time.
- Google App Engine libraries
- Basic DAO Layer with common entities
- Basic application level services
- GWT integration with RPC and widget library. Unit tested using GWT Test Case.
This is time and money that could be saved and could be invested in doing more upfront design, documentation in the particular problem domain. It made it easier and quicker to set up the development environment and spike solutions in a manner less prone to errors. If your organization has any code review policies, this is the one thing that should be put in the radar. We use Crucible at work, and this is a crucible project in itself that gets code reviewed by all team leads and senior members. It's the the core of all projects.
In conclusion, I think that you will find there is a lot of work in creating an archetype since you have to abstract all of common components for your organization but the return of investment is promising.
Next time we need to endeavor into another project, I just issue a:
mvn archetype:generate -DarchetypeGroupId=net.rt.blog.maven.archetype
-DarchetypeArtifactId=maven-gwt-gae-archetype -DgroupId=net.rt.blog -DartifactId=myproject
command, and I just gained many weeks of development and reduced headaches.