EH and Comments.!

Exception Handling plays an important rule in Commercial enviroment where un certainity of input is common you cannot imagine of writing a code that lacks exception handling apparently comments play an important part as well. Logging exceptions of every kind and having logs of every event is very necessary when you’re working with systems which does Financial transactions . This post is not about how to do exception handling or how to write comments in your code. But its all about what msg to pass on exception handling ! Lets say you are working on a project which is deployed on a server which is being monitored by a Certified System administrator and the client you’re working for is very decent they sent you out logs as-it-is  from the server by the Server Administrator. Then you should write a code like

void myFunction(string someparameter)

{

try {

// some code here.

}

catch(Exception ex) {

throw new Exception(“There was an exception Processing myFunction Source = ” + ex.Source + ” Error Message = ” + ex.Message);

}

}

Now Lets take a case where you are working on a project which is deployed on a Server with no authenticated Server Admin and all of the sudden you get an phone from a moron which happens to be a server admin showing you entire stack trace and yelling that your application lacks logics and all ! and after looking in to logs you find that Problem really doesn’t exists on your side but on some other system. The criteria of handling exception changes not in code though but the msg !

void myFunction(string someparameter)

{

try {

// some code here.

}

catch(Exception ex) {

throw new Exception(“OMG OMG OMG WTF WTF WTF !! SOME THING IS REALLY BITCHIN myFunction UP! FUCK IT AM NOT PLAYING ANY MORE !  “+ ex.Message);

}

}

Some of you might ask me why this well a good answer to the question is that the Moron looking Server admin would never call you up and tell you the entire stack trace he would basically mail you up the entire logs voluntarily  !

It works! Not necessarily all time Why ! ? the moral of people varies if the above thrown exception doesn’t work out for you i would recommend to slightly change the message or include some phrases like “I M GAYLORD” it might work out for you.

I usually comment my code a lot the reason behind it is not that i love to comment or its a good coding practice no way ! but the fact is that i don’t my self remember what i wrote an hour back comments like

// ALAAAAAAT! PAPU !! AGAYA !

// LOCHA HERE !! FIX IT AFTER LUNCH OR FUCK IT!

// YEAH BABY YEH !

the rest are censored. Comments are basically made for the convenience of a programmer and i feel like what i comment on my code can be easily understood by any typical karachite and believe me its fun to read my code :p .

Advertisements

~ by Azeem on November 20, 2008.

7 Responses to “EH and Comments.!”

  1. I want a code file plzzzzzzzzzzzzzz 😀

  2. […] This cup of tea was served by: Azeem Personal play ground […]

  3. I think we need to do code review as mandatory 🙂

  4. 🙂

    i like the part
    “Lets say you are working on a project which is deployed on a server which is being monitored by a Certified System administrator and the client you’re working for is very decent they sent you out logs as-it-is from the server by the Server Administrator.”

  5. I have serious doubt of you liking the server admin :p

  6. hahaha the comment part was FUN 😛
    easy to understand urself and ur fellow tortured beings 😛

  7. True b/w it’s not a torture for fellow’s it’s just a indication that this code is being written by me.So when naveed see some wierd logs he would buzz me and ask whats wrong with that part of code :p

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: