Jun 17, 2014

How to do impact analysis in Java based applications?

Performing impact analysis is a crucial software development task.

Q. What is impact analysis? Is it a trivial task?
A. Impact analysis is about being able to tell which pieces of code, packages, modules, and projects use given piece of code, packages, modules, and projects, or vice versa is a very difficult thing.

Performing an impact analysis is not a trivial task, and there is not a single tool that can cater for every scenario. You can make use of some static analysis tools like IDEs (e.g. eclipse), JRipples, X-Ray, etc. But, unfortunately applying just static analysis alone not enough, especially in Java and other modern languages whereas lots of things can happen in run time via reflections, dynamic class loading & configuration, polymorphism, byte code injection, proxies, etc.

Q. How will you go about performing impact analysis in Java?
A. You need to use a number of different tools and techniques perform impact analysis.

1. Strong emphasis on writing unit and functional test cases

One of the most important way invented in software development to analyze impact of changes is by executing unit tests and functional tests. When a change is made to software, the change will quite often have an undesirable or unintended impact on the software as a whole. So, re-executing the automated tests can identify any potential impact of a particular change. Both agile and non-agile Java projects need to have a decent unit testing coverage.

Q. What is code coverage? How do you measure it?
A. Code coverage basically tests that how much of your code is covered under tests. There are opensource and paid tools like Coverlipse, CodeCover, Cobertura and Atlassian Clover (commercial) to analyze and improve your test coverage. 

2. Making use of the IDEs' and plugins' search facility

You can use the search facility of your IDE, and additional plugins provided for the IDE.  For example,

a) In eclipse Ctrl+Shift+g can be used to search for references
b) You can perform a general "File Search" for keywords on all projects in the work-space.
c) You can use Notepad++ editor and select Search --> Find in files. You can search for a URL or any keyword  across a number of files within a folder.

There are instances where you need to perform impact analysis across stored procedures, various services, URLs, environment properties, batch processes, etc. This will require  a wider analysis across projects and repositories.

3. Search within your code repository like Subversion (SVN)

svn list -R file:///subversion/repository | grep filename


svn list -R file:///subversion/repository | findstr filename

There are SVN tools like SVN Search or SVNQuery  which performs SVN repository indexing and searching engine

Alternatively, checkout the projects to a common folder, and use Notepad++ or other tools to do file system search.

4. Tools like FishEye can be used to search across various code repositories

FisheEye is not targeted for any special programming language. It just supports various version control systems and the concept of text files being changed over time by various people. Handy for text searches like environment based properties files to change a URL or  host name from A to B.

5. Grep the Unix/Linux environment where your application is deployed.

You can perform a search on the file system where your application(s) are deployed.

6. Conduct impact analysis sessions across cross functional and system teams and communicate the changes.

Brain storm major areas affected and document them. Have a manual test plan that covers the impact systems to be tested. Collaborate with cross functional teams and identify any gaps in your analysis. Have a proper review and sign-off process. Get more developers to do peer code reviews.

7. Have proper documentation with high level architecture diagrams and dependency graphs where possible. As the number systems grow, so does the complexity. A typical enterprise Java application makes use of different database servers, messaging servers, ERP systems, BPM systems, Work flow systems, SOA architectures, etc. Use online document management systems like Confluence or Wiki , which enables search for various documents.

8. Analyze across various log files

It is also not easy to monitor service oriented architectures. You can use tools like Splunk to trace transactions across the IT stack while being tested by the testers to proactively identify any issues related to change. Splunk goes across multiple log files.

So,in addition to using a combination of tools, you need to have a proper process in place to to maintain the knowledge of the various systems and processes. This where experience and retaining talented people with internal systems knowledge is vital. You can easily replace a quality Java developer, but cannot easily replace business and systems knowledge.



Post a Comment

Subscribe to Post Comments [Atom]

<< Home