Yeah, the same good old Java interfaces..
Was just thinking about a friend of mine, with whom I had some issues recently. Most of the times, there are many who have issues with me, rather I should say, I have issues with them. This friend of mine was just one of them.. nothing special to notice in this case. But, somehow it made me think about Java interfaces. See, it's simple, I will explain (DON'T imagine Dushyant from Sarabhai speaking here :P)..
What does an interface say? It just says - "okay, these are my capabilities, this is what I output when I get such such input.. I cannot do anything more than this. If you are fine with it, use me!" Don't human relations follow identical (notice identical, not just similar) semantics? May be not always, but I guess in this particular case, we both followed exact semantics. And, then we finally concluded that - okay, our mutual inputs outputs don't match, so leave it! It's exactly like a Jigsaw puzzle or any such puzzle where one tries to put pieces together to form big pictures. If a piece does not fit, we say it's not matching and remove it and try to put it at some other place. Similarly, there are lots of people around us, you pick someone you really like at first meeting or so, like you know, normally a kid would pick say the biggest piece or say red-colored piece because at first glance, that's something the kid gets attracted to.. adults too behave similar (yeah, not identical).. they will themselves create an impression about someone. Then this will create some closure of expectations.. it's like - okay, this person *seems* to be like this, so it is *expected* that s/he will behave this way in this particular situation. And such expectations give rise to more and more other.. and thus a closure of expectations! Anyways, this big balloon of expectations soon blows out and the relation shatters. But, this never happens with Java interfaces, you know! That's because, there is NO closure of expectations built by *assuming* things that might not exist at all! It's actually very much simple. As in, consider an example:
Say, there is a class with 5 member variables and 3 of them are declared public and 2 as private. Once we know this, we will never never expect the remaining 2 to be public even though they are related in whatever way. But, this, we don't do with people. We always try to generalize, if person X is behaving like this, s/he will react to a particular incident in this abc way - why? Why can't s/he act in some other way? What's the guarantee that our prediction is correct? There is no such guarantee! Still, one always does that! Expect, expect and get annoyed! Whom to blame then? Of course, the one who generated that closure of expectations! That means, the one who suffered.. quite true!
Now, a different way of looking at this.. What if the documentation of that particular Java class / interface specifies something which is inconsistent with the way it is actually implemented? Then, well yes, there will be a different set of expectation, though not a closure but clear cut expectations! sure! still, still the same things *will* happen. As there was inconsistency, obviously expectations won't match. The Q remains is - whom to blame for this?
This happens when a person pretends. S/he pretends to be someone else / to be like something else and this is like (may be, purposefully) writing wrong details in the documentation! So, you know whom to blame now! The cheater, the pretender and not the one who suffered..
0 टिप्पणी(ण्या):
Post a Comment