Blog Archives

How to perform impact analysis across Java based applications?

Performing impact analysis is a crucial software development task. It is all about calculating the impact of software change.

Q1. What is an impact analysis? Is it a trivial task?
A1. An impact analysis is about being able to tell which pieces of code, packages, modules, and projects get impacted by a change.

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.

Q2. How will you go about performing impact analysis in Java?
A2. You need to use a number of different tools and techniques to 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 a 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.… Read more ...



How to write internationalized Java applications?

This post answers questions like — How to write internationalized Java applications? What do you understand by the terms internationalization (i18n) and localization (l10n) relating to Java programming? What is a ResourceBundle?

Localization (aka i10n, where 10 is the number of letters between the letter ‘i’ and the letter ‘n’ in the word localization ) refers to the adaptation of an application or a component to meet the language, cultural and other requirements to a specific locale (i.e. a target market).

Internationalization (aka i18n, where 18 is the number of letters between the letter ‘i’ and the letter ‘n’ in the word internationalization) refers to the process of designing a software so that it can be localized to various languages and regions cost-effectively and easily without any engineering changes to the software. A useful website on i18n is http://www.i18nfaq.com.

Q. What are the characteristics of an internationalized program?
A.

  • The same executable can run worldwide without having to recompile for other or new languages. 
  • Text messages and GUI component labels are not hard-coded in the program. Instead they are stored outside the source code in “.properties” files and retrieved dynamically based on the locale. 
  • Culturally dependent data such as dates and currencies appear in formats that conform to end user’s region and language. (e.g. USA date format mm/dd/yyyy, Australian date format dd/mm/yyyy). 

Q. What are the different types of data that vary with region or language?… Read more ...

Tags:

Understanding atomicity with a Java example

Q. Explain how you would get thread-safety issues due to non-atomic operations with a code example? A. The code snippets below demonstrate non-atomic operations producing incorrect results. The program below uses a “Counter” object, that is shared between three concurrent users (i.e. three threads). The “Counter” object is responsible for…

Read more ...


Working with .properties config files in Java

Managing properties for an enterprise application can be a bit trickier than one might expect.

Q: How would you go about managing properties files in your application?
A: One great advantage of property files is that they let you change your application’s configuration without recompilation. However, you most likely need to restart your application for the new configuration to take effect. However, you most likely need to restart your application for the new configuration to take effect. There are different types of properies files like

1. Environment independent files are archived within a war or ear. These can be loaded via the classpath.

2. Environment independent files stored outside a war or ear. These need to be loaded via a file loader. Define a JVM argument or system property for the path of the file.

3. Environment specific files stored outside a war or ear. These need to be loaded via a file loader. Define a JVM argument or system property for the path of the file.

It is a best practice to store environment specific (e.g. test, dev, uat, staging, prod, etc)  files outside the war or ear archives as the same archive can be deployed to any environment without having to package environment specific archives.… Read more ...



500+ Enterprise & Core Java programmer & architect Q&As

Java & Big Data Tutorials

Top