24 March, 2006

Refactoring

1. Introduction

The process of changing a software system in such away that it does not alter the external behavior of the code, yet improves it’s internal structure.
- Martin Fowler
Refactoring is the process of taking an object design and rearranging it in various ways to make the design more flexible and/or reusable. There are several reasons you might want to do this, efficiency and maintainability being probably the most important.
- Ralph Johnson

In software world, it is very difficult to design and development a right system at first time. Thus keeping this is in mind, refactoring analysis was carried out to improve the SuD for better performance and maintainability.

2. When to refactor?

Refactoring is a systematic way to clean-up buggy but working code. It is needed when a system lives with bad designs, wrong decisions and poor code. Following are some of the situations which call for refactoring:
It was very difficult to get the system correct the very first time
Lack of understanding of the problem domain
Heavy presence of monolithic code; lack of modularization
Programs that are hard to understand, hard to maintain, contain heavy duplication of logic/code etc. Following are the top ten reasons of bad code smells that ask for refactoring:
Duplicated code
Long method
Large class (too many responsibilities)
Long parameter list (missing object)
Too many case statements
Same class changes differently depending on the additions
Dependency of method is too high from other objects
Lazy class (does not do too much)
Class with too many delegating methods
Too much coupled amongst the classes, accessor classes
Overall slow response time to client requests

3. Refactoring Benefits

Some of the main benefits of refactoring are elaborated below:
Code manipulation in safe environment
Improves scalability, maintainability and portability of the existing system, where possible
Leads to better understanding of existing code
Identifies and reduces an existing system’s performance bottlenecks

23 March, 2006

Automated EAR deployment through ANT script in WAS

Any body who deployed webapplications through websphere admin console will know the pain full process of having series of wizards asking n number of questions.

To avoid, recently I tried for automated deployment process throgh ANT. I thought of sharing my experience wrto same.

Here the steps which I followed:
1.Created the ANT script which builds the EAR.
2.Since our application server situated outside our current dev env, I used SSH facility throgh ant and copied the ear into the server location.
3.Then I used .jacl scripts (which are websphere propietry..) for the copied ear deployment.
4.Created the .sh/.bat file (depends on the WAS installed OS) which will execute the .jacl script.
5.Called the .sh file through ANT script.
6.You can extend your build script to run the JUnits to know how much your build stable??

Agile development

Agile development opened up a new way of developing a software in more meaningful way of day-day development approach.

In the current project which I am associated with contains following agile and xp best practices:
  • SCRUM

  • Contineous Intigration

  • Test-First Approach

  • Sprint Backlog Management

    we found above practices are very useful.
  • One new learning / day - however small it is

    Read a blog / or article Watch TED talk  Read a small self-help book (many free eBooks available with less than 100 pages/can be completed i...