Tuesday, June 26, 2007

Template-less Data Access using Spring

Alef Arendsen from Interface21 blogged about the usage of HibernateTemplate/JpaTemplate. In his blog he demonstrates an alternate approach by using the Hibernate Session API directly in the data access code without the need of templates. The recommended approach is also documented in HibernateTemplate and JpaTemplate Javadocs.

To access Alef's blog, please click here.

Sunday, June 24, 2007

Lean Software Development

The main idea behind Lean is to avoid over production because over production is not only wasteful it prevents rapid response to changing customer demand.

The lean initiative in the product development primarily revolves around the concept of eliminating waste and getting quality right the first time. Lean product development is a new concept. This concept is first developed and tested in Toyota's Motor Company design studios and it is a very successful approach that Toyota uses to design new car models. Toyota’s success caused their methods to be studied and imitated by people in many diverse industries, including software development.

Lean Software Development Principles

Lean principles are very important for organization that continuously improve its process. Let's look at the basic principles and practices of Lean, as applied to software development.

Eliminate Waste
The three biggest wastes in software development are:


Extra Features
We need a process which allows us to develop just those 20% of the features that give 80% of the value.

Churn
If you have requirements churn, you are specifying too early. If you have test and fix cycles, you are testing too late.

Crossing Boundaries
Organizational boundaries typically increase cost by over 25%, creating buffers that slow down response time and interfere with communication.


Focus On Learning
Planning is useful. Learning is essential.


Use the Scientific method
Teach teams to: establish hypotheses, conduct many rapid experiments, create concise documentation, and implement the best alternative.


Standards Exist to be Challenged and Improved
Embody the current best known practice in standards that everyone follows, while actively encouraging everyone to challenge and change the standards.


Predictable Performance is Driven by Feedback
A predictable organization does not guess about the future and call it a plan; it develops the capacity to rapidly respond to the future as it unfolds.



Build Quality In
If you routinely find defects in your verification process, your process is defective.


Mistake-Proof Code with Test-Driven Development
Write executable specifications instead of requirements.

Stop Building Legacy Code
Legacy code is code that lacks automated unit and acceptance tests.

The Big Bang is Obsolete
Use continuous integration and nested synchronization


Defer Commitment
Abolish the idea that it is a good idea to start development with a complete specification.



Break Dependencies
System architecture should support the addition of any feature at any time.

Maintain Options
Think of code as an experiment – make it change-tolerant.

Schedule Irreversible Decisions at the Last Responsible Moment
Learn as much as possible before making irreversible decisions.


Deliver Fast
Lists and queues are buffers between organizations that simply slow things down.



Rapid Delivery, High Quality, and Low Cost are Fully Compatible
Companies that compete on the basis of speed have a big cost advantage, deliver superior quality, and are more attuned to their customers' needs.

Queuing Theory Applies to Development, not Just Servers
Focusing on utilization creates a traffic jams that actually reduces utilization. Drive down cycle time with small batches and fewer things-in-process.

Limit Work to Capacity
Establish a reliable, repeatable velocity with iterative development. Aggressively limit the size of lists and queues to your capacity to deliver.


Respect People
Engaged, thinking people provide the most sustainable competitive advantage.



Teams Thrive on Pride, Commitment, Trust, and Applause
What makes a team? Members are mutually committed to achieve a common goal.

Provide Effective Leadership
Effective teams have effective leaders who bring out the best in the team.

Respect Partners
Allegiance to the joint venture must never create a conflict of interest.


Optimize the Whole
Brilliant products emerge from a unique combination of opportunity and technology.

Focus on the Entire Value Stream
– from concept to cash.
– from customer request to deployed software.

Deliver a Complete Product
Develop a complete product, not just software. Complete products are built by complete teams.

Measure UP
Measure process capability with cycle time. Measure team performance with delivered business value. Measure customer satisfaction with a net promoter score.


Now, let's look at the agile principles from the agile manifest.

Agile Principles


. Our highest priority is to satisfy the customer through early and continuous delivery of valuable software.

· Welcome changing requirements, even late in development. Agile processes harness change for the customer's competitive advantage.

· Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale.

· Business people and developers must work together daily throughout the project.

· Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.

· The most efficient and effective method of conveying information to and within a development team is face-to-face conversation.

· Working software is the primary measure of progress.

· Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely.

· Continuous attention to technical excellence and good design enhances agility.

· Simplicity--the art of maximizing the amount of work not done--is essential.

· The best architectures, requirements, and designs emerge from self-organizing teams.

· At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.

The non-agile world values Process whereas the Agile world values People. Documentation and Traceability are key objectives in the non-agile world and Working Software is the main objective of Agility.

The executives lean towards Lean Product Development more readily that they do Agile. This is partly because Agility is expressed in the language of developers, not managers. Lean, on the other hand generally makes sense at all levels from developers up through executive officers. Lean speaks the language of "production" without much regard to what is being produced.

References

1. http://www.poppendieck.com/

Saturday, June 16, 2007

Dynamic Routing Using Spring framework and AOP

This article is published in InfoQ.com under exclusive content. So all the readers are requested to visit the following link.

http://www.infoq.com/articles/dynamic-routing-using-spring

Friday, June 8, 2007

JIRA, BAMBOO And Confluence Wiki - A well thought out tools for the enterprise

JIRA, Bamboo and Confluence are tools created and supported by Atlassian. This whole set of tools would cost $4800 company wide, which is the same as the price for 1 floating Clearquest license from IBM.

JIRA is integrated with the popular open source development environment (Eclipse) for an additional $250. Cruise Control is the leading open source continuous integration tool which is not integrated with the development environment. But Bamboo can be integrated with the development environment.

The Atlassian tool set is scalable up to 500 users, the tools are web-based and they will greatly aid the company in collecting software development life-cycle (SDLC) metrics to support those who are pursuing CMMI certification. Even otherwise these integrated tools will greatly enhance the quality of the software product.

Bamboo can also be integrated with Cobertura. It can also be integrated with PMD.

The following links gives an idea about how to integrate Cobertura and PMD with Bamboo.

Bamboo with PMD: http://confluence.atlassian.com/display/BAMEXT/PMD+plugin

Bamboo with Cobertura: http://confluence.atlassian.com/display/BAMEXT/Cobertura+plugin

Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage.

PMD scans Java source code and looks for potential problems like:
  • Possible bugs - empty try/catch/finally/switch statements
  • Dead code - unused local variables, parameters and private methods
  • Suboptimal code - wasteful String/StringBuffer usage
  • Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
  • Duplicate code - copied/pasted code means copied/pasted bugs
JIRA is a bug tracking, issue tracking, and project management application developed to make this process easier for the team. JIRA has been designed with a focus on task achievement, is instantly usable and is flexible to work with.

Confluence is an enterprise wiki that makes it easy for the team to collaborate and share knowledge.

Continuous integration (CI) automates the process of compiling and testing source code, saving time as well as identifying build problems as soon as they occur. Bamboo is the continuous integration server provided by Atlassian.

Click here to see Bamboo in action.

Capability Maturity Model Integration (CMMI) is a process improvement approach that provides organizations with the essential elements of effective processes. It can be used to guide process improvement across a project, a division, or an entire organization. CMMI helps integrate traditionally separate organizational functions, set process improvement goals and priorities, provide guidance for quality processes, and provide a point of reference for appraising current processes.

Thursday, June 7, 2007

Oracle 10g release 2 XML parser hacks and Spring framework


The Oracle 10g release 2 supports only JDK 1.4.x and both Oracle XML Parser and Sun's parser have issues in loading Spring framework 2.0 application context xml files particularly Spring Webflow 1.0.3.

The exception that arises out of buggy XML parser is given below:

oracle.xml.parser.schema.XSDException: Duplicated definition for: 'identifiedType'

The configuration change in opmn.xml in the diagram shown above seems to work just fine. The example OC4J application component instance shown is app1.

Sourcing xerces-2.6.2.jar and xml-apis.jar in the application's bootclasspath level overrides the Oracle's buggy XML parser while starting the application component instance.

Alternate way to circumvent the Oracle XML parser issue is by putting xerces-2.6.2.jar and xml-apis.jar in $ORACLE_HOME/jdk/jre/lib/ext. However this may void Oracle's application server support if the enterprise has purchased support from Oracle since they do not support their clients to hack Oracle controlled JDK environment.

Run a Java program without the main method

Here is an example of how to run a java program without the main method ...
public class HelloWorld{
static{
System.out.println("Hello World!");
System.exit(0);
}
}

Display: Hello World!

Now let us test the program without System.exit(0). The program will terminate complaining that there is no main method.

public class HelloWorld{
static{
System.out.println("Hello World!");
//System.exit(0);
}
}

Display: Hello World!
Exception in thread "main" java.lang.NoSuchMethodError: main

Wednesday, June 6, 2007

The benefits of Virtualization Without Performance Penalty

Today, virtualization is emerging as the fastest way to help businesses with scalability, security and management of their global IT infrastructure. Virtualization is a set of technologies that helps IT run more applications on a given set of servers, can dramatically increase utilization of existing capacity and could enable businesses to leverage their current hardware to meet their needs for years to come. This facilitates IT to make immediate, incremental changes to capacity to meet dynamic business needs without incurring new costs. But performance penalty is an inevitable result of the traditional approach to implementing virtualization.

I have read an interesting white paper on virtualization and its benefits in avoiding the performance penalty from BEA. The white paper is available at the following link.

http://dev2dev.bea.com/2007/05/BEA_Virtualization_wp.pdf

My first experience with Spring framework

This happened when I was hired by a local company in Maryland back in early 2003 to design and implement an enterprise solution to one of the US Federal government agencies. The higher ups have already decided to use the Enterprise Java Bean solution for the project. This is when I came across one of the best selling books I have ever read is Expert One-on-One J2EE Design and Development by none other than the father of Spring framework Mr. Rod Johnson. I fell in love with the book immediately simply because of the practical things outlined in it.

I went to the management and talked about what I learned from the book and I decided to give it a try on some of the things mentioned in the book. I downloaded first set of interface21 libraries published with Expert One-on-One J2EE Design and Development and started applying in the prototype I was working on then. A few months down the road these libraries became one of the most popular Java/J2EE frameworks now in the Java/J2EE development community which is the Spring framework.

Since 2003 I have designed several big enterprise applications using the Spring framework/Spring web flow stack.