Sunday, March 18, 2012

Life and Java both throws Exception

With each passing days we realize " man proposes and god disposes" , well we plan some thing if there is an deviation we called it exception. Exceptions are annoying and we just hate it. More or less each exception holds lots of vital information of reality,  to go forward we need to decode these exception. I have not much idea how to decode the exceptions that life throw, but in Java we can certainly plan it very well.
Java got a one of the advanced way to handle exception. To know more about exception handling framework in java follow this link.

I will focus how to design exception in applications. Designing of exceptions is start right from application design. Every time an error happens or something goes wrong, the ideal way is capture as much as information possible and notify some controller who can take alternate steps in run time. Mostly applications are integration of java classes and they perform the task my calling each other method. Consider if methodA of Class A use methodB of Class B and methodB encounter some error. Obviously methodB will not have any idea what could be the alternate flow. The best thing methodB can do is log the exception. Capture as much information possible about the error and wrap it to a customize exception to report to the methodA, methodA will have idea if methodB fail what to do. It should have the alternate plan ( exception handling block).
Mostly application are segregated into different layers like UI layer,  business layer and data access layer. So if an error happen in data layer business layer can take a decision can another operation is possible to carry out or need to report error to UI.And UI layer decide what kind of message need to displayed to the user.

Its always best practice to use application specific exception which wrap java native exceptions. So that it can contain more information about the error. And logging of these exception is very important. Logs help to track the error and the reason of error which gives the required information to fix the problem.
I hope with this we can plan better for unexpected flow in Java, And guys I need your inputs how to handle exception comes in life.


Friday, March 16, 2012

new iPad




After more than one year apple released new version of iPad. And they named it "new iPad". With in less than 2 years people around the globe accepted iPad as a new way of computing and in a lots of way iPad is changing life. Apple is successfully building the ecosystem and content by its app store, iTunes, iCloud and the latest iBook which makes iPad more and more useful.
The new iPad got lots of hardware up-gradation in compare to previous version iPad2. In original iPad Steve Job used to claim it gives a magical experience. And the  experience comes from display and touch. To make the magical experience further better, the new iPad got retina display. And this is big break through in terms of display. To complement it new iPad got a better processor, better camera and new generation antenna system.
In the same event apple had released new version of iWork, iPhoto and iMovie. And these are very powerful and simple apps which specially built for iPad. With apps each day iPad is adding more capability to itself. I am thrilled to see iBook. Reading textbook was never so fun before. It makes book reading more interactive.
I was anticipating new ipad will get Siri. Last year apple introduced Siri with iPhone 4s. which created a whole new way to interact with the system. According to me that is the one this new iPad is missing. Its a great tablet with same old price. I just hope it will be in India soon in right price.