Archive

Author Archive

Beauty of Spring Batch

February 18th, 2009 Aparna Chaudhary 1 comment

Spring source community is coming up with spring batch 2.0 in Q2-2009. Spring batch is the first java based framework for batch processing. I think the decades of experience of Accenture in enterprise batch processing really helped for defining the use cases.

Most of the batch applications need to process high volume business critical transactional data. While doing so some set of non functional requirements (NFR) are sort of mandatory in such applications. These NFRs include performance, scalability, restartability, repeatability. I worked with couple of investment banks and my experience says that such batch applications are developed based on either Messaging model or Multi-threading model. Lot of efforts and time is spent by architects, developers and testers in building this robust infrastructure for batch processing. Also we cannot overlook the cost involved. Whenever you move across projects, you end up creating your own batch processing framework. Sigh!!

Some nice features that are introduced in Spring Batch 2.0 are conditional step execution, finer metadata access control and chunk based processing. To perform chunk based processing, we need to configure the commit-interval in a step. The transaction is committed after number of items specified in commit-interval are processed.

<step id="step1" job-repository="jobRepository" transaction-manager="transactionManager">
      <tasklet reader="itemReader" writer="itemWriter" commit-interval="10"/>
</step>

Given the features provided and use cases handled by Spring batch, it can prove to be the de-facto framework for enterprise batch applications.

Mate vs Cairngorm

February 13th, 2009 Aparna Chaudhary 1 comment

I’ve recently been comparing frameworks for Flex event handling. We are already using Mate in one of our projects. I encountered couple of problems in the usage and thought of exploring other frameworks available on the shelf.

Here are some Pros and Cons of both the frameworks:

Mate:

Pros:

  • Tag based event driven Flex framework
  • Declarative way of Event management
  • Custom Events are inherited from default Flash event; no framework code in the application
  • Uses the event-bubbling to catch the events with the EventMap without defining a bunch of wiring code

Cons:

  • State changes are to be notified explicitly to all the associated views by making use of property injection
  • Application can fail silently when you inadvertently misspell the name of the event parameter; compiler checking on tags in EventMap is missing
  • Chances of bloated MXML file since the Event dispatch logic is composed into the MXML

Cairngorm:

Pros:

  • Singleton Model – Uses Observer pattern to refresh all associated views on state change
  • Command Pattern – Clearly defines the Unit of Work. Reduces chances of bloated MXML files
  • Introduction of Business Delegate can expedite development process in projects with different teams for Client and Server implementation. Delegate can be mocked by the client development team to return dummy data.

Cons:

  • Makes codebase bit verbose
  • Custom events are inherited from CairngormEvent which introduces tight coupling between the application and the framework code

As per me, Cairngorm is more suitable for enterprise application development with huge development teams. Use of command pattern can really expedite the development process. Mate on the other hand is more suitable for small applications. However, I would expect one improvement in Mate to add compiler checking on tags in EventMap. Sometimes it really sucks when you realise there are some typos only at the runtime when you application breaks.

References:

http://www.adobe.com/devnet/flex/articles/cairngorm_pt1.html

http://mate.asfusion.com/

Categories: RIA Technology Tags: , ,

Getting Started with FlexUnit and Maven

December 18th, 2008 Aparna Chaudhary No comments

flex1Today I created my first unit tests for Flex code using FlexUnit. Later I integrated the tests with the maven build using Flex Mojos. Flex-Mojos is a collection of maven-plugins created to work with Flex.

We have to use the Flex Compiler Plugin. This plugin is basically used to compile the source files and run tests. This plugin has 5 goals which are bound to different maven lifecycles. I chose to explicitly specify goals that I want maven to run. Maven has a default value for testSourceDirectory as src/test/java. For using Flex mojos, we have to specify testSourceDirectory as src/test/flex. Make sure all your tests are created under this directory.

	<build>
		<sourceDirectory>src/main/flex</sourceDirectory>
		<testSourceDirectory>src/test/flex</testSourceDirectory>
	        <plugins>
		    <plugin>
			<groupId>info.flex-mojos</groupId>
			<artifactId>flex-compiler-mojo</artifactId>
			<version>${flex-mojos.version}</version>
			<extensions>true</extensions>
			<executions>
			    <execution>
				<goals>
				    <goal>compile-swf</goal>
				    <goal>test-compile</goal>
				    <goal>test-run</goal>
				</goals>
			    </execution>
			</executions>
			<configuration>
			    <locales>
				<param>en_US</param>
			    </locales>
			    <contextRoot>/</contextRoot>
			</configuration>
		    </plugin>
  		</plugins>
	</build>

Next thing is to add Flex Unit dependency in the dependency section.

	<dependencies>
		<dependency>
			<groupId>flexunit</groupId>
			<artifactId>flexunit</artifactId>
			<version>0.85</version>
			<type>swc</type>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>flexunit.junit</groupId>
			<artifactId>flexunit-optional</artifactId>
			<version>0.85</version>
			<type>swc</type>
			<scope>test</scope>
		</dependency>
	</dependencies>

You would also need flash player installed on the build server. In case if you end up with OutOfMemory error, increase the heap size using MAVEN_OPTS in mvn.bat file.

SET MAVEN_OPTS=-Xmx128m

If you need more help, you can always refer the FlexUnit Example.

Planning Poker

December 16th, 2008 Aparna Chaudhary No comments

Are you ever involved in project estimations? Did you ever enjoy this task? I sure know the answer is big NO. This is because at the planning phase of the project there are lot of unknowns. Some members of the team are given the sheet to bring out those magic numbers. Its tough to get the realistic figure this way.

Planning Poker Deck

Planning Poker Deck

Planning Poker is the answer to some of the problems. Planning Poker is a team estimation meeting. So all members of the team i.e. developers, testers, project manager are present for the meeting. Each member is given a deck of 13 cards. You can see the cards have Fibonacci sequence on it. Whenever a story is to be estimated, each member selects a card from his/her deck that represents the weight of the story and places it face-down on the table. The weight is the unit of amount of work to be done for the story. When all team members are done, the cards on the table are revealed simultaneously. So this technique makes sure that the estimates are not leaned on team’ estimates (really?).

It is very likely at this point that the estimates will differ significantly. If estimates differ, the high and low estimators explain their estimates. This is a good practice as you get to know different views of the team members on a story, and catch some point you might have missed.

I’m using this story point estimation technique in my current project. We have a small team of 5, its working quite well. But I personally feel that there should be different meeting set for developers to come up with CUT i.e. Construcion and Unit Testing efforts and one for testers to get the System Testing, Integration Testing and Acceptance Testing efforts.

So get ready to play poker at work :-) !!

Independent Developer Workstation

October 15th, 2008 Aparna Chaudhary No comments

In one of my projects I did some work on process improvements. The main target was to set up independent developer workstation. We stubbed out all the interfaces. Earlier we tried to share a development database in a group of 4-5 developers. But believe me, I’ve seen developers throwing coffee cups when someone touches their data. Imagine you spending couple of precious hours out of your day on analysing the data and then getting it in right state to run your test cases and the moment before you hit “Run”, someone drops in and mess up all your data. How insane!!

Well the answer is simple, give me my own database and save yourself from the typical excuses. I evaluated couple of open source databases like MySQL, Postgres, EnterpriseDB and finally settled on OracleXE. Well we use Oracle in production and hence its easy to setup development environment with OracleXE with almost no extra tweaks in the scripts. I used DBUnit for testing database modules. It works quite well, but I think my strategy to setup test data was not optimum. It takes bit longer to run the tests now. I used Dumbster as a fake SMTP server and XStream for creating enriched objects for my tests.

Also one useful tool I would like to share here is DBMonster. It really helped me for generating mass random test data. Now I don’t have to request the DBA’ to give me test data. Well its not that simple also, as you need to understand the states of the dataset to create the seed xml files. But I think its still better than having human dependencies.

Happy Development :-) !!

Goodbye Blogger

October 14th, 2008 Aparna Chaudhary No comments

I was really upset with the intermittent 500 Internal Server Error on Blogger. So finally decided to move to Wordpress. I liked the nice flexible themes offered by wordpress. Shaping up my blog in here!!!

Categories: JEE Tags:

CITCON Europe 2008

October 3rd, 2008 Aparna Chaudhary No comments

I’m just back from the CITCON (Day-I), the Continuous Integration and Testing Conference, hosted by Jeffrey Fredrick and Paul Julius.

Earlier I thought its a conference about CI and Testing. Couple of speakers would come and present their thoughts on these topics. But today when I went there for registration, I realized its different. Its not a fixed agenda conference; but an Open Space conference. The idea of Open Space is that the attendees would present or/and demand topics of their interest. These topics on sticky notes are published on the white board. Attendees would then come and vote the topics they wanna attend. Voting works in very simple manner…just come over and make a small mark on the sticky. The organizers would come next day…check the votes and would then decide the whole agenda for the day. Ah!! Sounds really exciting and gives you a feeling of ownership for the conference.

I voted for 3 topics:
1. Managing test data while doing CI
2. Overview of CI
3. Java – Code Quality

I missed putting my vote for TW’ Cruise. But I’m pretty sure this topic would be there on agenda.

Let’s see what’ there on plate for me for tomorrow.

More to come!!

Get Adobe Flash playerPlugin by wpburn.com wordpress themes