Thursday, February 17, 2005

Mac at first sight

Last weekend Rajesh had got his new Mac G5 to the office. It was simply superb, to say the least. Karthik and I used the machine for sometime and we were totally bowled over by the features. This was the first time I was using a Mac. I have seen the ibook and the Powerbook, but never really played around with them. This was my first shot at it. In one of my previous posts, I had mentioned that Microsoft was “arguably” the best UI designer. I couldn’t be more wrong!! The UI of the Mac OS simply rocks. It’s a lot more responsive and has tons of visual effects. Also, there’s the familiar bash shell for the console freaks.

We were looking through the hardware configuration of the machine when suddenly something called AirPort caught my attention. Guess what that is! It’s the wireless port! Come to think of it, the name actually makes a lot of sense, doesn’t it?

There’s one thing I dislike about the Mac though. It comes with a single button mouse!! To right click, you need to hold the command key and click. Also there’s no scroll wheel !! The right mouse button and the scroll wheel makes life so much more convenient while using a PC. What were those Mac designers thinking?? It’s like giving the next generation computer with a 20th century mouse.

Friday, February 11, 2005

Unit testing

Everyone knows that unit tests are important. Besides providing a fine grained testing approach, they also help in asserting that the critical functionality is not broken after refactoring. Of late, I'm facing a few problems while writing Unit tests.
While adding some new functionality to the application, I had to modify an already bloated method (approx 80 lines of code) and add a few more lines of code to it. My pair and I didnt want to do this for 2 reasons :- Firstly, the method does too many things by itself and hence becomes unreadable. Secondly, its a nightmare to test such a big method. So we refactored it into a couple of smaller methods and implemented the new functionality. All goes well !!
Not so soon !! We then decided to test the new method ( yeah... we didnt do TDD !!). The method takes a data object as a parameter which has more than a dozen of fields in it. So we created a stub of the data object which implemented only the required getter and setter methods. When we passed this stub as the argument, the test failed !! Apparently the method used some Utlility class to convert the data object to a Domain object (which obviously required the data object stub to implement most of its methods). So now what ??
We moved the call to the Utility class to another method. It looked something like this --

Class foo{
public void method(DataObject data){
//do something;
}
public DomainObject convert(DataObject data){
//convertToDomainObject
}
}

Now to test this method we subclassed "foo" and overrode the "convert" method such that it returns the Data Object with only the required members set. The test passed.
I am not impressed with this style of testing though. What was the whole point of the test ?? At the end we were just testing a proxy implementation instead of the actual implementation. Is this the only way to test such methods? If you are aware of a better way to test such methods, kindly post a comment about it :-)

Tuesday, February 01, 2005

Google

Google never ceases to amaze me. What started of as a simple searching tool for web pages, is probably the most sophisticated searching and indexing tool that we humans have ever come across. And its not stopping there !! Keyhole, Orkut, GMail, Google News (to name a few) are few of its offerings to its users.



There are a lot of things i love about Google. They have changed the very idea of UI design. Most of us assume that a flashy UI with loads of graphics would attract users. Google seems to have proved it wrong!! Its probably the simplest UI design that i have seen. (It has worked so well that even Microsoft, (arguably) the best UI designer has decided to "copy" them in their search engine).
The other thing I like about Google is that most of their developments seem to be triggered by interest and experimentation, rather than for commercial purposes. Consider GMail; Who would have even had the thought of offering 1 GB of email space ? But the moment Google announced it, many email providers scaled their service to offer atleast 250 MB of email space (Though MS was slower than a snail in catching up!!). I do not think that GMail was developed primarily to serve Google's commercial interests. And the idea of content based advertisements totally rocks!! Its such a boon to advertisers; Their ads are now targeting the right audience (well... mostly) and the best part is that they pay rightly for it, rather than pay for some random number of meaningless hits on some other web page.
A few interesting developments from Google that i have noticed :-
  1. You can lookup definitions of terms on Google : try --- define robotics
  2. You can evaluate mathematical expressions on Google. : try --- sin(45) etc.
  3. Convert units in Google : try --- 15 miles in inches.
  4. Look at labs.google.com for more ultra cool stuff from Google like Google Suggest, Personalized Web Search and Google Sets.
I also happened to come across Googlism which is created and maintained by an Australian company. Its a pretty cool site which shows you all the information that Google knows about any person/place/date etc. Pretty cool eh ? If you are aware of any other cool tools from Google, please do post a comment about it.

With all this said, there are few things that I dislike about Google !! Firstly, Google doesn't categorize its searches. Search engines like Clusty and iBoogie do this and I find it tremendously useful when I am looking up on stuff like "Artificial Intelligence" or "Compilers" etc.
The other irritating part about Google's toolset is that its only supported for the Windows platform !! How could they do this ?? Considering the fact that almost all of Google's servers run Linux !! I know that Mozilla has its own Google Toolbar but wouldn't it be better if Google inherently supported it, and not just IE ? And why not a Google desktop search for Linux ? I am aware of beagle, but I am still wondering why Google didnt do it?
Last but not the least, what is Google India doing ?? You can use Google to search for places in the US (i.e Google local) but it still doesnt have a local version for India!! I cant search for pubs in bangalore and expect a map and addresses, but searching for pubs in New York shows Local results with a map !!

Guess what !! I am listed on Google !! Seriously !! I was searching for my name (Chirdeep Shetty) on Google and the very first result is a link to my blog !! On the same result page, if you notice the 7th result, its a link to Anirudh's blog (listed here only coz my name appears in his blog). So now you know what to do to get your site/blog to be listed on Google :-)
And finally, If you have the time, do check out this flash presentation on the future of Google. Its quite interesting.