Thursday, August 20, 2009

Evaluate Your JavaScript

Usually people have hard time in evaluating their JavaScript code, I found a interesting tool which helps to evaluate the Javascript JSLint - The JavaScript Code Quality Tool. Its quiet easy to use; navigate to
This will help ensure our code is compatible with IE 6 and IE 7.

Strict white space

Assume a browser

Disallow undefined variables

Disallow == and !=

Alternatively, you can add this line to your javascript. This will ensure these values are "checked".

JSF Life Cycle

The six phases of the JSF application lifecycle are as follows (note the event processing at each phase):
  1. Restore View
  2. Apply request values; process events
  3. Process validations; process events
  4. Update model values; process events
  5. Invoke application; process events
  6. Render response

The six phases show the order in which JSF typically processes a form GUI. The list shows the phases in their likely order of execution with event processing at each phase, but the JSF lifecycle is hardly set in stone. You can change the order of execution by skipping phases or leaving the lifecycle altogether. For example, if an invalid request value were copied to a component, the current view would be redisplayed, and some of the phases might not execute. In this case, you could issue a FacesContext.responseComplete method invocation to redirect the user to a different page, then use the request dispatcher (retrieved from the request object in the FacesContext) to forward to an appropriate Web resource. Alternately, you could call FacesContext.renderResponse to re-render the original view.

Focusing your efforts

Some developers using JSF may never write a component or extend the framework, while others may focus on just those tasks. While the JSF lifecycle will be the same for almost any project, you'll likely tap into it at different stages based on your role in the project. If you're concentrating more on the overall application development, you'll likely be concerned with the middle phases of the request processing lifecycle:
  • Apply requests values
  • Process validations
  • Update model values
  • Invoke application
If you're concentrating on JSF component development, you'll probably focus on the first and last phases of the lifecycle:
  • Restore view
  • Render response
In the sections that follow, I'll walk you through every phase of the JSF request processing lifecycle, including event handling and validation. Once you have a basic understanding of each phase, I'll introduce a sample application that shows how they all come together. Before we get started, take a look at Figure 1, a diagram of the JSF lifecycle.
From -

Jackson JSON Processor

The Jackson JSON Processor is used for marshalling and unmarshaling JSON strings. It is capable of converting JSON strings into Java objects and vice versa. THis biderctional conversion simplifies passing information between java classes and javascript code. Other processors exist, such as XStream, that marshal and unmarshal XML and JSON. The Jackson JSON Processor is by far the fastest one out there.

Using Java Beans

Code examples based ion release 0.98.

When working with Java Beans, the following restrictions are used by the Jackson JSON Processor. The bean has an empty public constructor, methods exposed follow the set/get/is construct, and the class CANNOT be an inner class.

Construcitng a bean and exporting it via an ObjectMapper is the preferred approach. With proper planning, you might not even need to copy information into the target Java Bean for transformation.

Code sample to generate JSON form a java bean.

ObjectMapper mapper = new ObjectMapper();
StringWriter sw = new StringWriter();
mapper.writeValue(sw, myDS);
String testStr = sw.toString();
System.out.println("json Bef3 [" + testStr + "]");

Code sample to unmarshal JSON into a java bean.
ObjectMapper mapper = new ObjectMapper();
DailySchedule sample = mapper.readValue(testStr, DailySchedule.class);

The same ObjectMapper may be used.

Agile Unified Process

The Agile Unified Process (Agile UP) is a streamlined approach to software development based on IBM's Rational Unified Process (RUP). The Agile UP lifecycle is serial in the large, iterative in the small, delivering incremental releases over time.

Agile UP Disciplines

Disciplines are performed in an iterative manner, defining the activities which development team members perform to build, validate, and deliver working software which meets the needs of their stakeholders. The disciplines are:




The goal of this discipline is to understand the business of the organization, the problem domain being addressed by the project, and to identify a viable solution to address the problem domain.


The goal of this discipline is to transform your model(s) into executable code and to perform a basic level of testing, in particular unit testing.


The goal of this discipline is to perform an objective evaluation to ensure quality. This includes finding defects, validating that the system works as designed, and verifying that the requirements are met.


The goal of this discipline is to plan for the delivery of the system and to execute the plan to make the system available to end users.

Configuration Management

The goal of this discipline is to manage access to your project work products. This includes not only tracking work product versions over time but also controlling and managing changes to them.

Project Management

The goal of this discipline is to direct the activities that takes place on the project. This includes managing risks, directing people (assigning tasks, tracking progress, etc.), and coordinating with people and systems outside the scope of the project to be sure that it is delivered on time and within budget.


The goal of this discipline is to support the rest of the effort by ensuring that the proper process, guidance (standards and guidelines), and tools (hardware, software, etc.) are available for the team as needed.


The Agile UP is characterized as being "serial in the large", something that you can see via its four phases which you move through in a serial manner.




1. Inception

To identify the initial scope of the project, a potential architecture for your system, and to obtain initial project funding and stakeholder acceptance.

Lifecycle Objectives (LCO)

2. Elaboration

To prove the architecture of the system.

Lifecycle Architecture (LCA)

3. Construction

To build working software on a regular, incremental basis which meets the highest-priority needs of your project stakeholders.

Initial Operational Capability (IOC)

4. Transition

To validate and deploy your system into your production environment.

Product Release (PR)