Skip to content

Category Archives: Coding Guidelines

Singleton Toast

19-May-11

On Android you may have experienced delayed toasts or overlapping toasts. This causes the toasts being displayed with irrelevant context/activity (e.g. user may have pressed backed, or previous toast is still overriding new one, or when too many toasts are displayed on screen). Consider the code below. It defines a single function for toast, that [...]

Handicapped Software

25-Jul-09

[ This post is about software's disability to meet users' expectations. I know you have developed lots of software/applications over your career! Have you ever evaluated them on disability index? No, then read on. "You" = refers to our typical "software engineer" ] Ever heard someone saying “this software sucks”… I love such moments. It [...]

Unreachable code Error or Warning?

08-Jul-09

In Java, unreachable code is treated as compilation error. What do you think? Isn’t making it warning would have made developers’ life simpler? Of course you can write – if( true )    return; What if you could simply write return. This helps in testing a function quickly. As a good programming practice we always remove [...]

Eating Exceptions… eeehhhh!

24-Apr-08

Following are few points you need to take care when you decide to eat an exception. These are very much specific to C# language. a. Limit the code block. Attempt to wrap one or two statements within try. b. If an exception is eaten, log details to some logging mechanism. In short never write empty [...]