Single Responsibility Principle for you

May 6, 2007

Quite simply, Single Responsibility Principle (SRP) states that

It states that every object should have a single responsibility, and
that all its services should be narrowly aligned with that
responsibility. The principle forms part of cohesion, a concept widely used in software development.

Source: Wikipedia

We all like to do several things in life. These are motivated by various factors ranging from the material to the spiritual. The materialistic reasons would be “need a paycheck”, “everybody’s doing it”, “this is in high demand a.k.a opportunistic”, “it is the next big thing” etc. that have no regard for your internal desire. The external reasons could motivate you and help the adrenaline pumping and you may be able to muster enough energy to get going but only for a while. That “little while” could be any where from days to an entire lifetime, unfortunately.
Choosing activities this way is going against the gravity and eventually the natural force will get you.

If only we heed the SRP, we can get some valuable tips.
I would translate the “Single Responsibility Principle” to “Single Purpose Principle.

I am sure we all have several interests but interests should never be confused for purpose in life. Just as every cell in the body has a unique purpose, we have one as well.
Of course, to get to this point, you may have to try out several gigs but it is important to bear in mind that your undying passion has to be uncovered and lived out.
Why should I care? Isn’t it enough if I have fun, one might ask.

It’s the same reason why every class, method, application, web site, organization should have a clear focus and purpose and serve a clear need. If not, even though it may look cool for a while, it will flounder and eventually fall apart.

Some questions that will help you find and/or clarify one’s purpose are:

What do you stand for?
What are you blogging about?
If you had a million dollars, what would you be doing?
What are your hobbies?
What would your eulogy be like?
Think of a time or times when you were in the “flow“.

For some, this may mean tweaking your career to a different form like researching, writing, talking and teaching about programming instead of programming itself or to something that is altogether different. I am sure you have heard of such stories.

There are several books, essays that have harped on this point.
Without going philosophical, simply I want to reiterate what has been emphasized many, many times but easily gets overlooked, ignored and forgotten, especially by the programmers:

Focus on the one thing that you can do no matter what happens, the one thing that will make you jump out of bed everyday, the one thing that you will do even if it didn’t pay as you would like, the one thing that will give you satisfaction, the one where you will forget to eat or sleep, the one where you will put your heart and soul into and expect nothing in return.

You may not be good at it when you start but just like any other thing, the more time you spend on it, you will get good at it. It is easy to spend more time on it because, it is your passion. Dwelling on such a thing blurs the distinction between work and play.

Once you find such a thing, then see how you can use it to serve as many people as possible. This will happen gradually.

The benefits of pursuing such a thing is that, the more time you spend on it, you will not only get good at it, but you will get remarkable at it. It may be a niche but you will be the expert. You will be able to express who you are through your work.
Fame and fortune may or may not knock on your doors but most certainly, you will be able to live your life to the fullest.

Look at the folks at 37signals. They found out that they stand for “Simplicity” and applied it to software design. The rest is history.

The next time, you want to go on a tirade in a forum against Ruby and Rails or Java, think again. Be constructive in your usage of your time. Remember if your goal is to have a life that is enjoyable, relaxing and satisfactory, then it will only happen when you are aligned with your purpose. Everything else is a distraction.

Being in the world of Information Technology, there is no scarcity of sexy gadgets and technologies that tempt you all the time. Focusing your attention on them is a big diversion to finding/pursuing what you love to do. It requires discipline to stay away from them. It’s like, if you are going to a mall without knowing what you want, you will be stopping at every store that has a fancy sign and end up tired and unsatisfied at the end of day whereas, the clearer your mission is, chances are high you will find exactly what you want.

Patterns of mediocrity, comfort zone, cruising etc. are what one has to watch out for. It takes courage to act but if you need some kick in the pants, take a look at this new book from Seth titled The Dip.

Just as we design our applications and write our blogs to target a niche audience, we need to design our lives to serve a niche audience as well.

Peripheral activities are fine as long as they are done mindfully. It is the mindless surfing, chatting, toying with the cool technologies that keep you mediocre as your mind is defocused from your purpose. But once the theme of one’s life is identified, everything else falls into place. You don’t see things and events the same way anymore. You start applying your theme to them, start thinking how they could be better, draw inspiration from them and apply them to your work in your niche and serve your audience in a fresh and unique way.


Are you “Exception-safe”?

April 17, 2007

Life throws exceptions at us all the time
- the driver that suddenly cuts in front of you, angry client calls, curve balls thrown by family members and not to mention the crimes in the community, catastrophes around the world and so on.

Exception handling in coding is basically handling abnormal scenarios gracefully even though we don’t like for them to happen. Bad handling or no handling includes yelling at the user by showing them the internal error messages, blaming the user for the problem and/or crashing the application.

We all know why not having exception safe code is bad. It is simply asking for trouble as it is denial of the reality. Things happen. The best approach is to do as much as possible to prevent it but accommodate the rare occurrences of the odd ball cases that you are not aware of. The truth is you cannot anticipate everything.

Exception handling routines acknowledge the problem, log them for analysis later and help the program resume or quit in a reasonable fashion.

Just as it is good for your application, having such routines for your life also can be very beneficial for the same reasons.

So do you have exception handling routines for your life?

How would a template of such routine look like?

1. Catch the exception

It sounds trivial, but a lot of times we resist, deny, react angrily, get frustrated, blame others and so on when faced with “exceptional” people, situations and events.

Accept the exception that has been thrown. Understand that the present moment is the reality and it is inevitable.

90% of the problem is solved right here.

2. Handle the exception

Contemplate on the exception based on what information you have with an open mind.

If you do not want it to happen again, see what you can do about it.

Like, on your morning commute to work, you may want to give yourself additional buffer time so that when someone cuts in, you are ready because you are now relaxed and alert and most importantly not in a hurry.

Remember, the only thing you have control over is yourself just like the only thing you have control over in your application is your code and not what the user or machine or network does.

Change your attitude towards life.

Practice breathing and relaxation routines.

Eat healthy, Exercise, Drink plenty of water and

Dedicate some quiet time to yourself everyday.

Soon, you will find yourself handling the exceptions with ease and grace as they happen that they would merely become event handling.

Happy coding and stay exception-safe!

 


Follow

Get every new post delivered to your Inbox.