Why programming is fun?

Friday, February 13, 2009

"A favorite programming moment is when I get to fix a bug in code that already has a good unit test. Such work is often akin to putting golf balls into a neutron star's gravity well; I get this can't-go-wrong feeling."— Kristofer Skaug. 

1975, Fred Brooks wrote The Mythical Man-Month: Essays on Software Engineering; he listed the five reasons (“Joys of the Craft" chapter) why programming is fun: 

The sheer joy of making things. 
The pleasure of making things that are useful to other people. 
The fascination of fashioning complex puzzle-like objects of interlocking moving parts. 
The joy of always learning. 
The delight of working in a tractable medium. 
Now after 30 years the programming has even more fun. With invent of PC and Internet the excitement has grown further and there are some more points that can be added to original list. (At Brooks’ time PCs and Internet did not exist.)

Teamwork:- The enjoyment of working with other programmers in a team. 
Hardware:- Being able to play with leading-edge computer hardware. 
Debugging:- Helping to debug complex software systems that someone else built. 
Internet:-Using the Internet to collaborate with other developers on projects and problems. 
Getting paid to have fun. 
Being able to program anywhere, anytime, with my choice of platform, programming language, and architecture. 
Some more items for the list from other sources: 

Because it's a combination of intelligent and creative work. 
Being some kind of nerdy superhero. 
Nearly instant gratification. 
The pride of seeing my work used by other people. 
The thing about it that really hooks me is taking a machine that was designed for no purpose in particular and making it do anything I want. 
The benefit that it brings to users in making their lives easier. 
One comment and one quote deserve special mention:

"A favorite programming moment is when I get to fix a bug in code that already has a good unit test. Such work is often akin to putting golf balls into a neutron star's gravity well; I get this can't-go-wrong feeling."—from Kristofer Skaug. 
"If it isn't fun and profitable, what the hell are you doing in the business?" by Robert Townsend, Up the Organization  

Read more...

One Minute Manager - A Review

Thursday, February 12, 2009

The book “One Minute Manager” by Ken Blanchard and Spencer Johnson is a short and sweet book about how to be a better Manager at work. I’m a huge fan of Spencer Johnson’s books because he is simply the Master of Simplicity. His crisp, story-type style makes for quick reading and yet his books are full of powerful wisdom.

This book covers 3 basic principles of Management that are are simply eye-opening:

One Minute Goals that each fit on one paper and are less than 250 words (somewhat similar to what our company has adopted in the form of Mid-terms and annual appraisal goals since last couple of years) but ofcourse, it underlines the need for “Agreed Goals” between the manager and subordinate right at the start of the work responsibilities. He gives an amazing comparison of goal setting to “hitting bowling pins” in a bowling game. You get instant satisfaction when you hit your target which both you and your manager can see clearly together and there is no ambiguity or last minute surprises involved. Also, the Manager specifically tells his subordinate at the start itself that he would be receiving feedback from him at regular intervals, so mentally the person is prepared for it. This is followed by the Manager hand-holding and closely working with the new subordinate until he settles down.

One Minute Praisings are given as soon as the Manager catches the new subordinate doing something APPROXIMATELY RIGHT! “Help People Reach Their Full Potential” so catch them doing something right…instead of wrong! This is so diverse from what we tend to do in general! Since the Manager hand-holds his subordinate in the beginning, he knows exactly how he is faring and can give specific feedback immediately. Hand-holding principle is something that I see missing very often and usually the Leave-Alone-Rebuke policy is used. The praisings are to be given as soon as the good behaviour is observed, mention specifically about what was good, tell them how you feel about their good behaviour and it should be short but precise praise. I’ve observed that over the last few years, TechM has also adopted this in the form of Pat on The Back & Cookies and it tends to give a fair amount of boosting to the employees (though sometimes it becomes more of a number-completion game or a make-everyone-happy ritual.)
He also compares the Approximately-Right-Praises with a small baby who starts off speaking his first word as “WALLER” and you hug him coz he can now speak his first word!! But the praisings soon stop and you start teaching him “WATER” and give him a hug when he says that. And then it moves to “WATER PLEASE” and then later to “CAN I HAVE A GLASS OF WATER PLEASE”. Imagine if the parents gave a hug to the child only and only when he would speak the full sentence with proper grammar!! This simply underscores the importance of training people to get the final outcomes rather than simply expecting everyone to do their best on the very first day itself.

The praises given out to the subordinate in the initial hand-holding period are eventually phased out and then given only when bigger milestones are achieved. The expectation is that after sometime you would become your own “praiser and appraiser” and measure yourself up against the goals that have been set.This essentially is a step towards helping you become “your own manager” rather than rely on an external person to give you praisings all the time.

One Minute Reprimands usually happen when bad behavior is observed in experienced people. (For new joinees, if things are not going even “approximately right” then its time to revisit the Goal Setting to make sure that the goals are understood well.) The Reprimand for the experienced people is given as soon as it happens, is specific about the bad behaviour observed, tells them how you feel, and is quite to-the-point and brief. This is followed by second-half part of the reprimand where you remind the subordinate that the scolding is for the bad behaviour in specific, and not for the person as a whole who is still very valuable and worthy to the organisation. The Reprimand needs to focus on the bad behaviour, not the person so that the subordinate feels reassured. The second part of the reprimand is very important.

Care for them! Ultimately all these fundas work only if the Manager genuinely cares for his subordinates and wants them to grow. If this feeling is not there in the Manager’s mind and he/she manipulates to get results, then the results would come only for a short stint. But if the Manager is genuinely caring then these three principles would work well because even the scoldings are taken the right spirit because one knows that the person cares. So effectively, a One Minute Manager is sweet and curt at the same time but you love him anyway coz you know ultimately he has real affection and concern for you.
Naturally, such people would have more power to influence or transform people’s lives than those who only want results from people. And these are the Leaders that all organisations want!

Everyone is a Potential Winner! Another interesting thing the authors bring out is that they don’t like the idea of “normal-distribution-curve” mentality in organisations which simply categorises people into few winners, few losers and everyone else somewhere in the middle. They believe that all people are “Winners” and even Losers are only “Winners in Disguise”. All they have to do is simply reach out to these Losers and help them unmask their true potential by using the One-Minute Management.
In my opinion, the One Minute Management System is very similar to Parenting. How many parents begin on a note of thought that “I think we’ve become the parents of a real loser child”. Almost none. Each one believes that they have a child who is extraordinary and it’s their job to bring out their potential. And in that love and caring, the parent showers hugs and scoldings – all with the aim of helping the child reach his true potential. I really don’t think parents can come up with a “distribution curve mentality” for their kids and say, “I think I have 3 kids, so one would be a winner, one would be a loser, and one would be somewhere inbetween!” The parent strives to bring out the true potential of each kid on the faith, love and belief that each child is a potential winner, and that is why the kids love their reassuring and believing parents and try to give their best of their potential.

If Managers thought of themselves as Parents and their subordinates as children who are all potential winners, then I think half the battle is already won!

For anyone who is interested in Management principles and even otherwise, I would highly recommend a read of this simple and powerful book!

Read more...

Handle Custom painting in DataGridView

How to Handle Custom painting in DataGridView?


The DataGridView control provides several properties that you can use to adjust the appearance and basic behavior (look and feel) of its cells, rows, and columns. If you have requirements that go beyond the capabilities of the DataGridViewCellStyle class, you can perform custom drawing of the cell or row content. To paint cells and rows yourself, you can handle various DataGridView painting events such as RowPrePaint, CellPainting and RowPostPaint.

Paint Parts

One important part of custom painting is the concept of paint parts. The DataGridViewPainParts enumeration is used to specify what parts a cell paints. Enum values can be combined together to have a cell paint or not paint specific parts. Here are the different parts:

PaintPart: Example ForeColor value for retrieved object All :All parts are

paintedBackground: The background of the cell is painted using the cell’s background color

Border :The borders are paintedContentBackground: The background part of the cell’s content is painted.

ContentForeground: The foreground part of the cell’s content is painted

ErrorIcon: The error icon is paintedFocus: The focus rectangle for the cell is painted

Focus :The focus rectangle for the cell is painted

SelectionBackground: The background is painted selected if the cell is selected.

Row Pre Paint and Post Paint

You can control the appearance of DataGridView rows by handling one or both of the DataGridView.RowPrePaint and DataGridView.RowPostPaint events. These events are designed so that you can paint only what you want to while letting the DataGridView control paint the rest. For example, if you want to paint a custom background, you can handle the DataGridView.RowPrePaint event and let the individual cells paint their own foreground content. In the RowPrePaint event you can set the PaintParts event args property to easily customize how the cells paint. For example, if you want to keep cells from painting any selection or focus, your RowPrePaint event would set the PaintParts property like so:

e.PaintParts = DataGridViewPaintParts.All & ~(DataGridViewPaintParts.Focus DataGridViewPaintParts.SelectionBackground);

Which could also be written as:

e.PaintParts = (DataGridViewPaintParts.Background DataGridViewPaintParts.Border DataGridViewPaintParts.ContentBackground DataGridViewPaintParts.ContentForeground DataGridViewPaintParts.ErrorIcon);

Alternately, you can let the cells paint themselves and add custom foreground content in a handler for the DataGridView.RowPostPaint event. You can also disable cell painting and paint everything yourself in a DataGridView.RowPrePaint event handler

we will see more on datagridview in our next posts.

Read more...

Back to TOP