Monday, January 12, 2009

Exception Handling - Code for failures - Part-1

Exception Handling - Code for failures (Part-1)
This article is not about what is Exception Handling, this article is just providing some tips, do's , don'ts and sharing the knowledge about Exception Handling and designing of Exception Handling...


Exception Handling is nothing but preparation for failures, if we do not prepare for failures, then expect the more system failures.

Normally we the programmers do not bother much about failure cases while coding, programmers concentrate more on to code the funcationality, yes it is important to complete the optimistic path of the program but the world is not so perfect.
We write a program to run successfully in a conditionl environment, that means we define a program run successfully in this environemnt for this inputs and in this state, so we must concentrate on the Exception Handling to face when the program runs in improper environemt or inputs or states

Improper or poor exception handling will lead for the following things
1. Maitenance will be very difficult
2. Difficult to debug.
3. More turn around time.

Do we have any gauge for perfect Exception handling?
Never mind, as long as we are able to identify the reason for failures without looking the Stacktrace then the Exception Handling is done in good manner.

I will write more in the next part...

Part 2 is here

Wednesday, January 7, 2009

Core J2EE Patterns best practices and design strtegies e-book

Definition for Design Patterns in Wikipedia is
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

Most of the time you are not the first person to face some problem in the world, some one might face this issue earlier, the solutions or method they find solution would be useful to resolve your problem. this is where patterns are important.

Design Patterns are not difficult to understand, I found the website javacomp.org explains the basics of Design pattern in a simple and easy to understand manner.

The above design pattern is common for OOAD, most of the time we look solutions on platform oriented, the sameway we need patterns for J2EE...

The Design Patterns Java Companion by James W. Cooper also simple to understand

I found that the book "Core J2EE Patterns best practices and design startegies" by Deepak Alur, John Crupi, Dan Malks is veryuseful.

you can download the softcopy of the book by clicking this link

In the book they mentioned abouot what this book is about and what this book is not about

What This Book is About?

This book is about:

• Using patterns for the J2EE Platform.
Based on our collective J2EE platform experience, we have assembled the
pattern catalog in this book. The J2EE Pattern Catalog describes various best
practices related to architecting and designing applications for the J2EE
platform. This book focuses on the following four J2EE technologies: Servlets,
JSP, EJB components, and JMS.

• Using best practices to design applications that use JSP, Servlet, EJB
components, and JMS technologies.

It is not sufficient to merely learn the technology and the APIs. It is equally
important to learn to design with the technology. We have documented what
we have experienced to be the best practices for these technologies.

• Preventing re-inventing-the-wheel when it comes to design and architecture
for the J2EE platform.
Patterns promote design reuse. Reusing known solutions reduces the cycle
time for designing and developing applications, including J2EE applications.

• Identifying bad practices in existing designs and refactoring these designs to
move to a better solution using the J2EE patterns.
Knowing what works well is good. Knowing what does not work is equally
important. We have documented some of the bad practices we have
experienced when designing applications for the J2EE platform.

What This Book Is Not?

This book is not about:
• How to program with Java or J2EE technologies
This book is not about programming. While this book is heavily based on the
J2EE technologies, we do not describe the specific APIs. If you wish to learn
about programming using Java or using any of the J2EE technologies, there
are a number of excellent books and online resources from which to learn.
The online tutorials on the official Java home page at http://java.sun.com
are highly recommended if you wish to learn about individual technologies.
The official specifications for J2EE technologies are also available from the
Java home page.

• What process and methodology to use
We do not suggest any type of process or methodology to use since the
material presented in this book is not related to either. Hence, this book does
not teach you about a process or methodology to follow in your projects. If
you would like to learn more about processes and methodologies, there are
a good number of books that deal with various object-oriented
methodologies and new books on lightweight processes, such as Extreme
Programming.

• How to use Unified Modeling Language (UML)
This book is not going to teach you about UML. We use UML extensively
(specifically class and sequence diagrams) to document the patterns and
describe the static and dynamic interactions. If you want to learn more about
UML, please refer to the UML User Guide [Booch] and the UML Reference
Manual [Rumbaugh] by Grady Booch, Ivar Jacobson and James Rumbaugh.