Skip navigation.

By Accident or By Design

Random Musings of a Geeky nature

Learning something new everyday...

, , , ...

While I do learn something new in life every day, it is rare that I actually learn something about Java.

Not to sound prudish or something... I learn new ways of doing things in Java, and find new libraries to use, and find innovative ways of using existing libraries, and innovate around algorithms and stuff every single day... Its just been a long time (I'd say about a couple of years or so) that I learned something new about the Java language itself. Its not even something sensational or mindblowing or anything... It just pleasantly surprised me today.

Enough preamble, I don't really need a justification for posting on my own blog, do I?

Consider an abstract base class
AbstractBaseClass
. This base class has a concrete implementation of a method
concreteMethod
. The concreteMethod is basically in the AbstractBaseClass because the implementation depends on data already available in the objects of AbstractBaseClass, and not really those that the ConcreteSubclasses need to worry about.

Moving on, there is a specific abstract subclass of the AbstractBaseClass,
AbstractSubClass
. This is an aberration of sorts, because all other subclasses of AbstractBaseClass are concrete... AbstractSubClass is not really that big an aberration, as it does have a few ConcreteSubSubclasses of its own..

So, where's the problem?

None, yet.

The problem arises when you realize that the implementation of concreteMethod in AbstractBaseClass is not really appropriate for the
ConcreteSubSubclassA
and
ConcreteSubSubClassB
, which are both concrete sub classes of AbstractSubClass. Wait a minute..., you realize... The implementation of concreteMethod is not really appropriate for any current, or future subclass of AbstractSubClass...

Which means that you have a concreteMethod in your AbstractBaseClass, which is perfect for all other concrete subclasses, except for concrete subclasses of AbstractSubclass, which need different handling per class for concreteMethod, which means that overriding concreteMethod in AbstractSubclass is not the answer.

How do you ensure that all subclasses of AbstractSubClass actually provide an implementation for concreteMethod, while maintaining the AbstractBaseClass implementation for all the rest (except those that need to override it anyways, stupid edge case...)??

<drum roll>

Apparently, it is legal to override a concrete method and erase the implementation, making it abstract, in AbstractSubclass, to enforce subclasses of AbstractSubclass to implement concreteMethod, as if it were just another abstractMethod, similar to some of the other abstractMethods in AbstractBaseClass.

...

...

That was it.

Have I managed to confuse someone?

I'll try and maybe draw a figure or something tomorrow... Maybe some code samples might help...

Then again, maybe the idea won't seem so awesome, after I've paid off a bit of my sleep debt, so don't hold your breath much....

Initiative

, , , ...

in·i·tia·tive (ĭ-nĭsh'ə-tĭv)
n.

  1. The power or ability to begin or to follow through energetically with a plan or task; enterprise and determination.
  2. A beginning or introductory step; an opening move: took the initiative in trying to solve the problem.
  3. The power or right to introduce a new legislative measure.
  4. The right and procedure by which citizens can propose a law by petition and ensure its submission to the electorate.

adj.
Of or relating to initiation.
Used to initiate; initiatory.



I like people who take an initiative. I like taking initiatives. I love selling ideas to people and getting them to follow my initiative.

I've had a couple of instances where I've taken an initiative, and felt better at the end of it.

I also remember the frustration of people who not only lack the initative, but lack the energy to follow another person's initiative, even though they believe in it.

Project Coffee is an example of someone who has taken an initiative for a cause, and is lacking the support he should have had. Its depressing.:irked:

Anurag Singh, 27, Software Engineer, who has started off a hunger strike to protest against the reservations law being passed in India. Several people in my company started the Save Brand India. I love these guys! What is frustrating is the lack of support that these initiatives are getting. Its hard to put in words.

Anurag, don't lose heart yet. India is with you. I'm going to get as many people interested in your cause as I can. I'm sure that the lack of people signing up for your cause is not because they don't support you, rather that they don't know about this online initative. The support is visible on the front pages in the newspapers everyday.

Guys, please sign up for Project Coffee. Its the least that you can do. And it only takes a few seconds to add a comment to his blog. Do it, and lets take this fight to the finish!

Your Bill Buddy

, , ,

My company started out this cool new service called YourBillBuddy.com

For starters it is targetted at the Indian Mobile Phone users market. You can upload your mobile bills, and it analyses the bills to figure out if there is a better plan that you could switch to, either in your same provider or in another provider.

It also uses some really cool graphs and stuff to convince you of this.

I wish I had been on the team that developed this, but the idea really rocks!

Click here to find out more, and register.

Code Monkey

I came across this awesome song in a forward:

http://www.jonathancoulton.com/mp3/Code%20Monkey.mp3

I'm also attaching it with this blog post: Code Monkey.mp3

Link to lyrics on Slashdot:

http://slashdot.org/comments.pl?sid=183853&cid=15185815

I've been listening to this song since morning. Its stuck in my head. I love it.

My experiments with SEO

, ,

In the last week or so, I've been tweaking things with my site (http://www.ujjwal.net/), with the result that I'm now at #1 for the Google search "ujjwal". I also have high results on some other engines (notably Lycos), while I don't figure anywhere in the picture for some others (sadly, Yahoo!).

It is said that Search Engine Optimization(a.k.a. SEO) is a pretty difficult and unpredictable task, and they say that seeing results in times as less as a week is almost impossible.

What have I been upto?

Several things:
  • Google Sitemaps
  • Adding keywords and descriptions meta-tags to my pages (some of them already had it)
  • Publishing my website URL on various profiles that I have, including Opera, Orkut, Blogger among others.
I'm still wondering which among these is responsible for improving the ranking of my page in the search results. Notably, my PageRank on the Google toolbar still says 0.

I'm still working on improving the content on my site, and retaining the #1 ranking as long as possible.

Please let me know of other tips to improve search engine rankings. I'll keep my efforts updated on this blog. :smile:

Another Day, Another Blog

To date, I have two blogs and a website already.

  1. My home page
  2. My Disaster Blog
  3. The signs of our times - A photo blog that I share with Dj


I've been thinking of starting another one about technology since a long time, and have finally got around to it.

Lets see how far this journey goes :smile:

For the record, I love Opera! :yes: (thats why this blog is here!) I feel that Opera is the coolest piece of technology available today!
July 2009
S M T W T F S
June 2009August 2009
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31