Friday, July 20, 2012

Do I need to google ?

To find anything in internet the best way is googling. Any one who use internet the first thing they learn is googling. When I say googling it include all web search like Bing,Yahoo etc. I do googling to read news, to watch video, to check weather, movie sports etc.Since information is scattered in different website, and they are too many to remember. So people use search engine to locate their content. Few years back everything was working in this pattern, we used to search stuffs on web and browse our content in random site. And search engines used to insert some sponsored links, advisement  in the web pages or in search result to earn their revenue.

In last few year few major things happened one is evolution of post pc devices such as iPad,iPhones and other android devices. Its clear that tablet sale is outpacing PC sale. If we combine tablet + smart phones the number will exceed the PC sales. It means more and more people are accessing internet through their post PC devices. In post PC devices poeple connect to internet through different apps. For example to see weather, to read news, to book movie ticket I use my apps on phone. I don't do any web search for that. It doesn't mean web search is reduced to 0 in post pc devices, certainly it decreased dramatically. As pattern of  digital content consumption in post pc devices are quite different. And more or less every body agree that the future is all about post pc devices. Country like India a whole lots of people get introduced to digital world through mobile phones.


The inception of Facebook only resonate Human is a social animal. I will prefer to ask my friends or read post something from closed group instead of searching randomly in internet. People spend more and more time with each other at Facebook. It automatically reduced the need of google search.

Last one but not least. Evolution of "Siri" and similar services in line with it created lots of noise in the area of local search. Currently Apple announced  map service integrated with Siri and opened to lots of Social App like Facebook, yelp gives many useful information to the users interactively.

Its not that anything of above will replace search in future. Search will be there but it won't be first choice anymore it will be the last option.

Wednesday, June 13, 2012

Read me if you can

In my starting days of coding I had a notion if you don't understand the code means its a tough program, some hi-fi advanced code. And if the code compile with out error and execute properly means its perfect in all aspect.
My first programming language was C. There was a lab exam where we need to code 5 given program. I had completed well ahead of time, all the five were compiling and running properly. The teacher was checking each student's program and evaluating. You have to get minimum three programs right to clear the exam. The teacher came to me he read one by one program. He had checked 4 programs and found all are correct. Fifth one he saw the code, in first look he didn't get the logic he told its incorrect with out compiling or executing. Before I could explain back he had already deleted the source folders. I was bit upset because I knew I got five out of five correct. But it was recorded 4.  I was thinking I didn't get 5 out 5 just because some body was not able to read it.
And after I started working in real time project, I understand 90% time you will be working around the codes not written by you. And some point of time some one else will be working on your code for sure. And there is some figure floated on internet, as 80% effort goes in to understanding others code. All these made the point clear codes need to be written such a way that another person can understand it well. And sometime people prefer simpler algorithm instead a complicated one.
There are different best practices in line with various programming language. I found few points which help
1) Naming Convention
name of the variable and method  revel lots of information. for ex :
if ( authenticate(userName,password)
 {
  }
It clearly understood that we are authenticating by passing user name and password.
2) Comments
We all know we need to write comments. I feel Class label comments, method label comments are always handy. It should always tell more than code. I mean certainly by seeing code we get some idea, and comments should add some thing to it. For ex:
/* Check for  Ldap authentication */

if ( authenticate(userName,password)
 {
  }
In this case comments add some more info to the picture.
It is always nice to add few line of comments for a particular block of code.
3)  Use of parenthesis while doing logical operation.
parentheses always make easy to understand complex logical expression.

And the list goes on. You also can share some of the ideas here which helps understand the code. If the code is well understood it adds lots of value. And programmer can happily understand it and work with it. Happy Programmers always do wonderful things. ;)

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.