Thursday, December 30, 2010

Thanks, R

Learn. Grow. Smile. Even in your lowest lows. Someone's always with you. Laugh at yourself. Appreciate being foolish. Wise up. Smile. Cry. Pride. Humility. Hope. The Bright side. Pessimism. Put others before yourself. Feel hurt. Keep at it. Celebrate. Share. Learn. Teach. It's never too late. Explore the new. Yet, never forget the old. Make new friends. Regain lost ones. Win. Lose. Music. Books. Movies. Fear. Anxiety. Success. Failure. Poetry. Lend a hand. Touch. Feel. Reach out. Fall back. Fight. Fall. Get up. Start over.

Tag

Frost | Pro | Loose | Tikaaa | Kk 82 | It's beautiful | Pro3 | Pavi | That will also evaporate | Jootay | Pakdo | J-Man | Younix? | P | Lefty | Cya | -273.15 K | Sanchali | indiBlogger | Psynite | Wisecrack | Hot pink & bright orange | r^3 | P=S | PN | 1471 | Z | 9.96 | Cows | Mission: Aloo Paratha | Shoelace | Guitarboy | Tu/Se | IBM | Gatterman | Thund3rstruck | Suru | Jack | D | RapidB | Chikapps | Undocumented functions | Shred masterclass | Breakfast | 99 | Rash | 4th std | Dr. MW | P8 | Warrior

[Ordering is random. In case you don't find yourself, ask. I'll tell you which one you are]

Friday, December 24, 2010

Design Patterns Explained

History

(3000 B.C.) When people first started wearing clothes, they realised that it was not really comfortable. So they tried various designers until one of them (Armani or Versace. I forgot) came up with the idea of using softer fabrics. He decided to call the stuff soft-wear. But due to copyright issues, he had to change the name to software. (Another theory is that people could not figure out which part of the fabric was soft. So they normally said, "Soft? Where?". But question mark was an illegal character, and DOS accepted only 8-letters. So the name 'software' stuck on).

There was fierce competition in the market as more and more 'designs' came out with every fashion week. Soon people realised that they could take whatever was common from other designers' creations, and 'patterns' began to emerge. It was easy to see that this development was seminal for all future work in the field of Software Design Patterns, as we use it till today.

In an effort to create much needed awareness in this field, I have created a condensed list of common patterns in the software world, complete with how to avoid common mistakes, a look at the class diagram, the type of pattern, and a brief description of each pattern. Expert tips and relevant links for further reading have also been included.

Adapter

Not to be confused with - Adopter

Class diagram -

Type - AC-to-DC

Description - In those days, the concept of electricity was not taught very well in school. So there were a lot of voltage fluctuations. In a spark of genius, one of the interns came up with the idea of using an adapter to partially stabilize the current. The designer resisted a lot, but finally gave in. This led to electrifying results. And it shocked nearly everyone in the audience. A great pattern for any occasion.

(See also - Angelina Jolie)

Bridge

Not to be confused with - Fridge

Class diagram -
Type - Suspension

Description - It was one of those times when looming deadlines decided what came into vogue. The designer was already knee-deep in trouble. Having only 4 days to come up with something big, he decided to bridge the gap between modern and contemporary. (At that time, the two were different, duh). As fate would have it, it turned out swimmingly. In fact, he achieved mouth-watering results. A great pattern to have in any designer's toolkit.

(See also - River)

Command

Not to be confused with - Commode

Class diagram -
Type - Hygienic

Description - There was a change in management, and the new boss was unfamiliar with GUI. (In fact, he was quite noob with the command line as well, but still..) In any case, he wanted to obtain a commanding position in the market. So he called his employees and told them to be extra-efficient and also ensured that no one was slacking off. The result -- inch-prefect cuts and immaculate stitches. But as everyone was over-efficient, they displayed the creations 3 days before the actual fashion event. And nobody showed up. So they had to change management again. (Note- this pattern is actually a misnomer. Just telling)

(See also - Control, Alt, Delete)

(Abstract) Factory

Not to be confused with - An actual factory

Class diagram -
Type - Expensive

Description - 'Twas the age of getting artistic with everything. A mini-renaissance was in place, as people began to diversify into those who truly appreciated art, and those who were not fatheads. Obviously, though, the former group took over managerial posts. And tried to explain in vague terms to the designers how the designs should be 'abstractly ephemeral' but not 'amorphously evanescent'. (Whatever that meant). In the mean time, a smart programmer wrote a piece of code that used random numbers to mass-produce weird shapes and print them. The managers were impressed, for apparently, that was exactly what they had in mind. This method has ever since been known as the abstract factory. A must-have if you find yourself being managed by people with an IQ of zero (or less).

(See also - M. F. Hussain)

Flyweight

Not to be confused with - Mosquito-weight

Class diagram -
Type - Insectoid

Description - It was one of those bad days for the fashion industry. A model was walking on the ramp when a fly happened to land on her shoulder. Now mathematically, weight_of_fly >> weight_of_model. (Hope you understand the gravity of the situation) The result? Wardrobe malfunction. Since then, it has been made mandatory to make clothes that can withstand a minimum amount of weight, also known as flyweight. This had the masses protest, but it was a necessary thing to do. A great pattern for the whole family.

(See also - Fly wait)

Observer

Not to be confused with - Webserver

Class diagram -

Type - Class II Evil

Description - When you have competitors in the market, it is imperative to keep a watch on every aspect of the industry. Even a small thing unnoticed can cost the company. Especially spies. The famous spy, Chloro-fluoro-carbon Bond, was hired by a fashion label to spy on the market leader. In 3 days' time, he came back with full details on the next batch of designs. Having spent very little on R&D, the company rolled out the same designs with exquisitely crafted fabric. Thus, managing to wipe out all competition. Since then nearly all companies have started planting 'observers' in their rivals' company. A crucial pattern. Don't stay home without it.

(See also - Observant, Obmaid)

Proxy

Not to be confused with - Frock-C

Class diagram -
Type - Representative

Description - Since most of his time was spent in the studio, it was very difficult for him to maintain attendance in class. So this designer did what any student in his place would do. He asked his friends to 'give proxy'. The perfect blend of smart students and dumb professors ensured that he never had to go to college again. What's more, he could focus solely on fashion design. And produced the best of his work in that period. At present, this is one of those patterns that you just cannot afford to miss out on.

(See also - Prox A, Prox B)

State

Not to be confused with - Union Territory

Class diagram -
Type - Geographic

Description - When faced with the equivalent of a writers' block, one of the designers decided to travel the country in search of inspiration. He travelled many places, trying to imbibe the characteristic qualities of each region. When he got back, he was in a woozy state of mind. In a press statement, he said that he would do something that was never done before. So he categorized all the places he had visited into various states. And made a design on each one of them. Lucky for him, it clicked. Moral of the story? None at all. Still, you just have to have this pattern.

(See also - City, Country)

Template

Not to be confused with - Temspoon

Class diagram -
Type - Culinary

Description - No matter how hard you try, you just always end up arriving a few minutes late. This was the story of an intern who's only problem was just that. But he tried to make up for it by putting in extra effort in everything he did. On the verge of losing his job, he decided to create something that would be so unbelievably good, that he would get instant promotion. Hard-work and diligence paid off. And he got just what he expected -- the Lead Designer's post. Since then, this has been a timeless classic. A pattern that could come in handy in the most untimely moments.

(See also - Temp-ontime, Regular-late)

(Note - If you didn't get the last line for each pattern's description, try to get hold of a copy of Café Coffee Day's gift brochure)

Thursday, December 23, 2010

On Electricity

In the very beginning, the Earth was a great ball of fire. It used to be very hot back in the days. So nearly all inhabitants used to go to the beach. Then one day, the Earth got frustrated of the routine and wanted out. Although it used to relax by listening to music or by taking a walk, it just got too passé, and downright annoying.

So it decided to chill out. Literally. The Earth's temperature kept dropping till it approached room temperature. But there were very few rooms in those days, so the concept of room temperature was hazy at best. In effect, the temperatures were actually lower than you'd expect. As the temperature approached 0 ºC, the Earth tried to stop cooling further. But due to inertia (yes, Newton's First Law), the temperature kept dropping much below that. This extra cooling had some adverse effects. For example, it led to a war between USA and the Soviet Union, better known today as the Cold War.

Somewhere in the caves, there lived a wise sage. (All sages in history were wise, apparently). So, anyway, this sage predicted this phenomenon, thousands of years after it actually occurred. And people believed that he was great. Even though his predictions should have logically been before things occurred. But no-one ever noticed. He released his predictions in electronic versions. The most important one being about the climate, pompously called the iSage. (Some people mis-spell this till today). And everyone bought newer versions of it even if they were heavily flawed.

One fine day, people realised that our wise sage (let's call him Steve), was only fooling them. They started to question the very fundamental facts based on which other theories were formed. The most important one being -- why do people keep buying iSage? So in all the commotion, one of the people decided to catch everyone's attention. He did this by striking a gong with a stick, thereby creating a loud sound. Today, we know this incident as the Big Bang.

There have been certain controversies surrounding the Big Bang. So I have created this self-explanatory combo-image to help clear the confusion --


(The Big Bang)

See? Good. Now that I've cleared that up, let's continue. So, anyway, one of the people at the scene had brought a cat. The cat got terrified by the sound and jumped up in fear, knocking down its bowl of milk in the process. The owner of the cat was about to feel bad for it, but at the same moment remembered that there was no point crying over spilt milk. So she didn't.

Seeing this, all the Gods were pleased. Even time stood still for a moment. (Normally, Newtonian laws of motion would apply, and time would slow down before coming to a halt. But there was no inertia at that time. Because Newton wasn't born yet. Jeez. Try to keep up.)

As time continued to remain in standing position, said milk was still suspended in the air. And the shape that it formed kind of looked like it was leading to somewhere. So people started calling it the Milky Way.

By now the other planets also got to hear about what was happening on Earth (courtesy- WikiLeaks), and so they all started coming near it, but there was this spoilt son of a rich dad (let's call him Sun), who told everyone to back-off, and stay a few light-years away. Now, at that time, the SI unit system was still under development, so everyone had a different value of 'light-year' in their scientific calculators (later on, this was rectified by Cosmologically Adjusted Singularities & Interplanetary Obfuscations, CASIO for short).

Tired of the lack of organisation in all their affairs, they decided to form a set of rules. They thought about it for a few months, and soon came up with a system that consisted that consisted of sixteen R's. (Ruthlessness, Rice-cakes, Ramifications, something like that). But instead of calling it 16R's, they decided it would be more punk (Punk music was all the rage in those days) to name it in a foreign language. They chose Hindi for its awesomeness, and finally agreed upon the sollah-R system (yet another mis-spelled term till date).

But some people were against the idea of using a non-standard language to define a set of standards as it kinda defeated the purpose a bit. So a few groups were formed that tried to oppose this. This battle slowly escalated into a full-scale inter-galactic war. People formed three major factions based on their purpose for entering the war. There were those who wanted to live (as opposed to die, so seems logical). Another group were neutral to the war, mainly coz they were wimps. And the third, more aggressive faction, consisted of those who had a hormonal imbalance due to a Large Hadron Collider-esque experiment gone wrong, which caused weird genetic mutations. So they all had some kind of ear-like things sticking out of their bodies. They were nicknamed ear-things.

The war lasted for several eons, but no one truly gained the upper hand, so they all had to remain content with the lower one. Eventually, they realised that this was only causing pointless deaths, and decided to call a truce. But someone decided that the least we can do is pay tribute to these brave warriors. And that is why we have live, neutral and earthing in all our wirings even today.

(PS- I might have missed out some minor details about how dinosaurs evolved from bacteria, and human beings evolved from Pikachu, but I'll save it for another post).

[Update- Although vastly unplanned, that post has been published. Click here to read]

Wednesday, December 22, 2010

Breathing

Was trying to listen to myself speak.
She decided to stop talking.

Was trying to listen to the echoes in the distance.
The silence was deafening.

Was trying to look for the light.
The darkness was blinding.

Was trying to count the stars.
The skies were filled with emptiness.

Was trying to laugh with the rest of the crowd.
The loneliness was killing.

Was trying to run away from it all.
Walked right back into it.

Was trying to dream.
The nightmares kept haunting.

Was trying to look for answers.
The questions were overwhelming.

Was trying to look through the haze.
It was all a blur.

Was trying to bear the summer heat.
It was my life's coldest December.

Was trying to live for the moment.
Got lost in the eternity.

Was trying to run in the fields.
The water was too deep.

Was trying to breathe anew.
Watched myself drown to the bottom.

Was trying to go with the flow.
The stillness of the water was rushing.

Was trying to fly away.
The wings were too heavy.

Was trying to clear the dust.
Slowly became one with it.

Saturday, December 18, 2010

Pun Unintended

There are people who are simply obsessed with puns. Real lame ones, at that. Annoying at times, but we all love a good pun. Write?

So here's some instances of me in conversation with professionals in various fields. I was running short on time so mentioned only a few. In the meantime, feel free to add your own in the comments section. (Optional- vote for your favorite ones)

1) Lead Guitarist

(at a shopping mall)

LG - I can't decide which one to buy.
Me - They're both good. Pick any. *grins*

LG - Er..right. I was thinking I'll decide based on which color suits me better. What do you think?
Me - The black. Makes you look sharp. (Hehe)

LG - Will you stop? Please be serious for a minute.
Me - Oh, a little high-strung today, are we?

LG - Now you're overdoing it.
Me - Oh, don't be so picky.

LG - Ok, that was lame.
Me - I know. Not to blow my trumpet or anything, but I'm normally better.

LG - But equally stupid, nonetheless.
Me - I'd pitch in with a suggestion, but now I've lost the mood.

LG - Maybe people would consider you seriously if you were serious once in a while.
Me - I'll make a note of that. *sniggers*

LG - Dude, stop. NOW.
Me - Fine, no matter what I say, my words fall flat anyways.

LG - You are the most annoying person I've met.
Me - On what bass-is do you say that? I'm actually a very warm and chord-ial person.

LG - Now you're REALLY starting to piss me off.
Me - Now, now. Don't fret.

LG - ARRGH...

2) Cricketer

(at a bar)

C - Dude, see that girl in red? Boy, is she hot. I want to ask her out. But I think I'll screw it up.
Me - Oh, so you got bowled over by that maiden, eh? (Sorry for the trite remark. I just had to get it out of my system)

C - Well, so to speak. What do I do?
Me - Dude, you're the playa. Go for it. I'll field for you if something goes wrong.

C - But how do I start? What do I talk about?
Me - I dunno. Pick anything vague. Like comic books. See what super-hero she likes. Steer the conversation from there. Maybe she'll talk about Bat-man. (*sneers*) Then show off your batting skills or something.

C - But what if she doesn't like comics? I need to have a backup.
Me - Mm...maybe you can talk about music. Or crack the joke about how you once got drunk and managed to sing at such a 'high' pitch.

C - *gives the how-dumb-do-you-think-i-am look*
Me - Ok, that was a very silly point to make. But dude, she's got fine legs. Don't miss this opportunity.

C - I know, but I'm not going without preparation.
Me - Maybe you could play some fun games with her. Spin the bottle or something.

(This is when I recall that he happens to be a half-decent cook)

Me - Or tell about how awesome a chef you are. Cook up some story. But don't get too saucy. (For someone like me, this was the equivalent of a burst-fire from an M14. Or a 550D)

C - That's like duh.
Me - (on second thoughts) But there's a catch.

C - What?
Me - It could swing either way. Be a little prudent.

C - Yeah, yeah. I know.
Me - I'm thinking I'll stay here. You know, just in case. Plus, there's no need for a third man anyway.

(By now our friend had 'mustard' enough courage)

C - Yeah, I was thinking the same, too. Let's see how it goes. Wish me luck!
Me - Go for it!

(I watch as he diligently obeys my advice)

C - (To girl) Hi, I'm C. (gives brief intro) Do you like comics?
G - Yes, I do! My favorite super-hero is Flash!

C - Cool! Me too! Wait, I'll show you.

(At this point, the bouncer had to step in and take him away. Oh, the irony)

3) Banker

(by the river)

Me - You know, the concept of life has always interest-ed me.
B - Yeah, sometimes I begin to wonder about its intricacies, too.

Me - If you can truly appreciate the tiny things in life, it's really simple, actually.
B - No. I would disagree with you on that one. Nothing can be simplified without compromising the bigger picture.

Me - Life always hangs in the balance. When we begin to question it, I think we make the picture bigger, and disturb it.
B - Actually, the picture was always big. You just never looked.

(By now, B is visibly annoyed)

Me - At this rate, we'll get nowhere. We are both saying the same stuff in circles.
B - Sit alone and contemplate someday. You'll understand what I mean.

Me - I feel loan-ly at times, too. Reminds me -- remember that girl I was talking about the other day?
B - Which one?

Me - The one who lives in the same compound as me. But there's no chemistry. Can you say why? (Double-damage)
B - You know the answer. It lies in what you just said. Look for it and you'll find it. Did she reply to your message?

Me - Wait, lemme cheque. *winks*
B - (infuriated) Oh, shut up.

Me - Ok. You're not in the mood. How about I tell you a joke?
B - How about you don't?

Me - Ok, how did the gummy bears rob the bank, even though they faced a lot of unexpected problems?
B - I dunno. How?

Me - They stuck to the plan. LOL.
B - Jeez. That was lame. Even by your standards.

Me - Well, atleast I cheered you up a bit. You've gotta give me credit for that.
B - Sure.

Me - OMG. I just realised. We are sitting on the bank of the river. Hahahaha.
B - ARRGH...

4) Programmer

(walking on the streets)

Me - Did you close the windows before leaving?
P - Very funny.

Me - Hey! I was serious. Anyways, I compiled a list of jokes just so that you don't get bored.
P - (sarcastically) How can I resist?

Me - What do you call an Indian who likes puns and works for an e-commerce website?
P - Gee. I dunno. 'Sid'?

Me - No. A pun-job-e!
P - Gosh. How creative.

Me - Wait, it gets better. How does Steve Jobs' cat confess to ripping the sofa?
P - Meow?

Me - No. It says- iPaw'd. Get it? iPod? Pawed.
P - Yeah, I get it. Just wasn't funny enough.

Me - Ok this one is MADE for you. How does a humor-blogger format his posts?
P - That's easy. A WYSIWYG editor.

Me - Nah. Using pun-ctuation marks. Haha.
P - Is this the part where I jump off a cliff?

Me - No no. Wait. Maybe you'll like this one. How did the mouse outwit the cat?
P - Is this some kind of tech-thing? Ok I say he used a Mac.

Me - Wrong. He thought of a plan. He kept thinking, and then it finally clicked. LOL.
P - Ok, pretty innovative...NOT!

Me - Ok why didn't my (kannadiga) friend let me use his numpad?
P - Who in their right mind would let you?

Me - Everyone, that's who. But this guy said -- "Nin talle. It's 'num-pad'. Not 'nim-pad'" Hahahaha.
P - I don't get it.

Me - You don't have to. Most of my other readers will. Ok this is totally your level -- In a courtroom, the defendant's lawyer says- "The murder was done with class". To which the other guy says- "I object, your honour"

P - Lame.
Me - That's not even the best part. The judge then gives the murderer a death penalty, and then says- "Oops". ROFL.

P - That doesn't even make any sense.
Me - Ok wait. This guy is standing in a queue, quite listlessly. The man in front says- "Life is like a stack. Don't push it." LMAO.

P - Ok smarty-pants, tell me this -- If life is really an abstract virtual stack. Shouldn't everything be reduced to boolean?
Me - (*smirks*) True.

P - ARRGH..


Monday, December 13, 2010

Stop answering the questions.
Start questioning the answers.