Friday, March 15, 2013

Static Analysis Alone Can’t Help

I am shocked! I am shocked when I see developers do nothing but rely on static analysis tools to help them improve code quality. Some of them proclaim that the IDE that they use helps them write better code. Yes. To some extent IDEs help. Just because IDEs and static analysis tools help to a certain extent, can we afford to do nothing else but relying on them? My answer is a firm ‘no’.

Coding requires not only expertise but also discipline. How can you ignore self-review, refactoring, peer reviews or expert reviews?  How can you avoid setting your own traps ?  -  read my previous post 'The Trap Called Ten Percent Code Review'.

XP- Extreme Programming, one of the agile methods emphases on ‘coding standards’ as one of the practices. ‘Coding standards’ does not mean following a documented guidelines or standards or how to code. It is more than that. It is about writing code in such a way that all team members follow similar style and can understand the code written by other team members. It is about seamless coding in order to ensure high quality code. This is possible when developers write good code even before they put their code through a static analysis tool.

Static analysis tools provide you with valid comments as well as false positives. The less the comments are the more efficient it is for you to complete static analysis. This means that the code that you put through static analysis needs to be good enough.  That is when your static analysis tool will provide you a manageable list of observations.  Writing good code in a team setting is possible when you follow some discipline. This is possible when you do self-review, implement regular refactoring and practice defect prevention. 

Unfortunately in our industry there are agile teams relying on static analysis alone. This does not help as it is an inefficient way of improving code quality. Self-review and continuous refactoring are the practices that are pragmatic in agile development. This is because the code base is consistently evolving. Keeping it clean, structured and simple is what is going to help you in being agile. Else you are struck with growing and messy code base not knowing that you are accumulating technical debt day by day. That is going to cost a lot in terms of maintenance overheads.

I am not against static analysis tools. Static analysis tools are powerful. These tools can provide a snapshot on the health of your product or quality of code - that is a holistic view. A very good analogy is medical electronics. Medical electronics has enabled us check blood pressure at home. Medical electronics has helped clinics do ECG test in a sophisticated way. This does not mean that one can afford to wait for clinical results in order to improve health. Many of us follow a health regime by doing regular workouts, eating healthy food and leading a stress free life. When it comes to coding how can we wait for the static analysis tools to spew hundreds of findings including false positives before we attempt to improve code quality? Don’t we have to improve our coding practices?

Sunday, March 10, 2013

The Trap Called Ten Percent Code Review

Years ago, I was in a meeting with a project team to understand their code review techniques.

I asked, “How frequently do you review code? What is your approach?”

The team leader was proud enough in his response. He said, “We review 10% of the code to know the issues.”

I was curious. “What have been the findings? You have completed more than 50% of coding in this project!”

“We are going to do review 10% of code after a month from now because that is when we would have completed all significant modules.”

“Well. If that is the plan, how would you address review findings? Won’t it be too late in the game?”

A big pause before the team leader opened up.

“We are working on an aggressive schedule. We need to complete this project on time. Such reviews would delay our progress. According to our organizational policy, we can review 10% of the code base anytime depending on project priorities. There are no hard rules here!”

The room was silent. What could I have done at that time? I suggested that the team lead initiates code reviews as early instead of waiting for a month to pass. He did initiate code reviews. He did that to comply - nothing more. The results were ineffective and the whole issue was put to rest – a temporary rest. This is because he and his team members succumbed to schedule pressure.

Months later when we delivered the project, the rate of increase in the number of acceptance bugs was sky rocketing. Bug fixing revealed severe code quality issues. Major refactoring to fix the messy code base resulted in schedule overrun and team burnout. And of course, we had to pay off what we had accumulated - I mean, technical debt.
The trap called ten percent code review is very common. And you must have seen this happening elsewhere too.

Can we avoid this trap? Yes. Of course! How?

The answer is simple. We can avoid this by doing it right.

First, we must understand the meaning of ten percent code review. It means conducting code reviews right after 10% of code completion. This means that you need to include ‘architecturally significant’ or ‘critical’ modules early in the cycle. No one can afford to do these after 50% of code completion. A better approach is to start code reviews no later than 10 days from the start of coding.

It also means that doing effective reviews by involving experienced reviewers and ensuring that the findings are not repeated in future.

It does not mean that ten percent code review is sufficient to ensure code quality. It is one of the techniques. Besides ten percent code review, one should consider defect prevention, the usage of static analysis tools, peer reviews of critical code segments and so on.  The effectiveness of techniques such as defect prevention depends on the rigor of code reviews.  Without rigor it is difficult to idenitfy deep code quality issues.

Ten percent code review is not an escape route to spend limited time in code reviews in order to succumb to an aggressive project schedule. When you don't do it right, it becomes a trap. 

Have you come across similar traps? What has been your approach?

Friday, March 1, 2013

Life after Graduation: Expecting the Unexpected - Part 4

This is the final post in this 4-part series. I suggest that you start from Part 1 and read through Part 2 and Part 3 before reading this post.

Two Dimensions: Platform and Purpose
Many of you are going to graduate in couple of months. Among all youngsters in our country you are privileged. I said this when I visited this city in August 2012 and presented statistics to demonstrate how gifted you are.  This presentation is available at

Your parents have done all they can do to give you this platform. You are at a high platform. From here where do you want to go? What is your purpose?

When you get a job, gain experience, and create wealth, you are going to strengthen or expand this platform. Life is not about building a grand platform alone. You have to have a purpose. Your purpose cannot be about enriching your platform.

Subroto Bagchi says, 

Your platform is truly a critical part of your existence. But there is something beyond it as well.

It is your purpose.

As we start our life and, sometimes, well into it, many of us get so preoccupied with building the platform, that we forget that it is not what makes us complete. A platform, as the meaning of the word suggests, is just a springboard. It is a surface on which you stand to go someplace. Your platform, like a railway platform, is a place from where you need to go someplace. That someplace will be determined by your purpose.

Your platform is not your purpose”.

How do you identify your purpose? Think! What are you passionate about? What do you want to be? How do you want to contribute to your community of professionals? How do you want to positively impact your country or world at large?

It is not enough to identify what you are passionate about. You need to validate. If you are passionate about playing guitar, don’t stop. Try and learn guitar. When you do this, two things can happen. With regular learning and practice, you may start playing on stage in couple of years from now. You may become part of a band that performs for great causes. Or with multiple attempts to play and unbearable pain in your fingertips, you may decide that it is not your cup of tea and move on. Why not?

Hanging onto what you want to do but not doing it does not make sense. When you say, “If I had …. I would have…” after you become 50, won’t you feel unfulfilled?

Are you creative? Are you unique? Think! As I said earlier, being aware of the present is going to provide you enough clarity. With this clarity, you will be able to identify your purpose. It may take several years to reach the destination. Start now. Don’t give up!

How many of you want to become IT managers? Do you think the job of IT managers is fashionable? What do you think are the challenges in the job of IT managers these days? Let us watch this video!

Also, download and read the free PDF that contains Subroto Bagchi's talk on ‘Platform and Purpose’.  It is at

Challenges in our industry
Our industry presents several challenges. All these challenges can be grouped under these five categories.

Technology evolution:  IT professionals need to be lifelong learners in order to live with this challenge.

Global competition: Whether it is outsourcing or product development we live in the world of global competition. We must excel in what we do to lead the pack.

Economic factors: This is a significant area of challenge for us. Both global economies as well as software engineering economics have room for improvement. We have a role to play here.

Social and political factors: The power of social and political situations in our world cannot be undermined. The impact of such situations is felt in every walk of life. Our industry is not exclusion.

Skills and competencies: To be successful in our industry we need to have skills and competencies that can help us deliver meaningful solutions to customers. Identifying, nurturing and retaining skills and competency is a big challenge in our industry.

All such challenges have created immense opportunity for us!

Yes. Challenges present opportunities too! Those who are aware of the present, possess the ability to understand challenges, do their best to manage those challenges, and visualize unforeseen opportunities! Their equanimity helps them consume news updates coming from different sources and directions without any signs of anxiety. They are focused.

Start with a purpose! Aim high! And master the seven essentials!

You will find more information on the seven essentials at

All of you are going to be knowledge workers. Here is a quote I want you to remember.

If you have a job where someone tells you what to do next, you've just given up the chance to create value.
- Seth Godin

My best wishes to all of you!  Thank you!

Life after Graduation: Expecting the Unexpected - Part 3

I suggest that you read Part 1 and Part 2 before reading this post.

My journey and questions
I started my career in 1988. From 1988 until 1994, I expected that

• Computer education would spread in all states across the country
• The usage of computers would become a necessity in all industries
• Data processing would be the major area of application in IT
• Computer literacy would provide job opportunities
• Computer graphics would be confined to a handful of application areas (such as image processing, medical diagnostics, engineering design, GIS etc.)
• Artificial Intelligence would be the winning field of research and applications

On the other hand, I did not expect

• The Y2K problem (was not known until ‘94)
• The growth of service industry and international footprint of India in IT
• Internet and e-Commerce
• Touch screen, mobile technology, tablets
• Voice over Internet Protocol (VOIP)
• Digital photography, multimedia, and so on!

I am sure all senior professionals who started their career in late 80s or early 90s resonate with what I am sharing. Over these twenty years our world has undergone drastic transformation. There are new markets. There are new requirements. There are new devices, platforms and technologies.

Aren’t you curious? You are going to graduate and traverse in corporate world for more than thirty years! Things you see and things you expect are not going to be the things you are going to see ten or fifteen years from now!

How can we take a shot at the future? I know. That is the question you have in your mind.

It is difficult to predict all the technologies and trends of the future. However, if you try sincerely, you can identify your strengths and start moving in the right direction. How do we do that?

First, we need to be aware of the present! Are you aware of the present? Let me ask you some more questions to help you find an answer to this question.

• How do you manage yourself? Do you use computers and smart phones as devices mean for consumption? Or do you learn new things and try to create something new using those devices? How do you learn?
• How do you make the right choices? How can you make right choices so that your decisions can enable you?
• How can you weather the storm and adapt? Are you used to predictable, normal events? Or are you prepared to embrace change?
• How do you manage when the visibility is low? How confident are you in managing uncertainty?
• Have you attempted to realize your potential? How can you do that?
• How do you manage conflicts and decide on the next steps?
• How frequently do you introspect and improve?
• How can you co-exist with those who live with you?

When you think through your answers to these questions, you will know what else you need to know and do at present in order to be aware of the present before you attempt to take a shot at the future.

Do you know what is happening in the travel industry and the transformations it may go through in future? Let us watch this video clip!

Many of you are going to graduate in couple of months. Among all youngsters in our country you are privileged. I said this when I visited this city in August 2012 and presented statistics to demonstrate how gifted you are.

What does it mean to you? You will find an impressive answer in Part 4.

Life after Graduation: Expecting the Unexpected - Part 2

Let me continue from where we ended Part 1

Ironically, we study enough to get the ‘cut-off’ percentage or grade to qualify for campus interviews. The interview goes well, and we get a job. Job provides monthly salary. You go to office, and your manager tells you what you are going to do. You do that month after month, year after year. And you think that you are performing well just because you do what your manager asks you to do. Is this what you expect? Does it work that way? Do you want to do that? Do you think a job like this will ensure a rewarding career? No! Not in our industry. Not when you are a knowledge-worker.

Let me reiterate. Limiting yourself to a part of syllabus or limiting yourself to a specific percentage or grade can’t happen at work! It does not provide you bright results at your college as well! Colleges provides you knowledge, intends to make you a scholar and wants you to be a committed student whereas corporate stresses on professionalism.

Corporates stress on professionalism
Yes. When you are in college, you approach your faculty members for help. Don’t you? Think about the last time you and all your classmates, as a single big group, approached your professor just because all of you wanted to postpone a class test! Think about the last time when you ignored regular preparation and burnt midnight oil to prepare for an exam! Those moves or approaches may work for students! You cannot bring them into your life after graduation.

Corporates stresses on professionalism. To become a professional you need expertise as well as several other things such as communication skills, interpersonal skills, team skills, analytical skills, flexibility, adaptability, detail-orientation, creativity, critical thinking, problem solving, organizational skills, leadership skills, lifelong learning, self-direction, industry knowledge, customer focus, dedication, self-confidence, etc.

When you are weak in one of these skills, you will get a chance to improve or build your skills. You may get one or two chances to improve.

There are non-negotiable qualities as well. These are honesty, integrity, work ethics, decorum, social responsibility, non-discrimination, etc. You know these. You know the boundaries. You know when the boundary is crossed. For example, you know or you can sense when there is a violation of honesty or integrity. You can identify discriminatory actions or transactions.

If you are weak in one of these skills and if such a weakness results in action, you will lose your job, your will lose big opportunities and you will tarnish your image. You will not even get a chance to retract. Violation of such values is irreversible.

How can you merge smoothly?
Let me tell you an analogy. Moving into corporate life after graduation is very much similar to merging onto a highway after years of practicing in city roads where the speed limit is 30 or 40 miles an hour. You know your city roads as much as you know your college campus. You know your fellow drivers. There are rules – simple rules! The traffic is less or moderate.

Highways have multiple lanes and the speed limit is 60 miles or more! You must know the rules of the game before you enter the highway. It is not just entering. You must know how to merge smoothly. Also you must know when to yield. You must know how to make decisions as you move on.

The expectations of our industry on college graduates has transformed over years. Decades ago, one has to be skilled in a specific language or database or platform. That is not adequate at present. Let us watch this video.

I want to tell you about my journey and I want to share what I expected and what I didn’t. I have added this in Part 3.

Life after Graduation: Expecting the Unexpected - Part 1

This blog post is about my keynote session at Computer Society of India (CSI) Annual State Level Student Convention 2013, Goa on 23rd Feb 2013. I am writing this to outline the flow as it is necessary in addition to sharing my slide deck which has more pictures than words. If you are a student, you will benefit from this – please feel free to share your questions or views. If you are in you will find a mix of familiar and new thoughts in this post.

More than one hundred students, faculty members and industry experts attended this event. The venue, Institute Menezes Braganza Hall which is one of the historic buildings in Panjim provided us the right ambience. After the welcome address, my session started at 10am. And this is how it unfolded.

Good morning! What do you think is the fee for a 1-day IT conference in some of the large cities such as Bangalore or Pune or Chennai? Typically it is about 2500 rupees. Depending on the type of event and organizing team, it ranges from 1500 to 2500 rupees. You may be surprised; there are 1-day events that cost rupees 7500 too. Considering the session titles and speaker line-up, today’s event is as good as or better than many events organized in some of the big cities of India. However the fee is very nominal! It is one-tenth of what we pay for such events in big cities. On Monday, you should talk about this event with your class mates and friends. Let all of them join us next time! With that note, let me appreciate Computer Society of India, Goa Chapter and all organizers and volunteers for putting together this event and begin with a quick snap of college life.

A quick snap of college life
It is a life filled with energy and enthusiasm. Students enjoy lots of freedom! Their life revolves around their campus and their institution. In a state like Goa, you spend your college days in natural surroundings and relish some of those unforgettable moments!

Life before graduation
Before graduation, we are used to several factors. Most or all these factors are rooted in the way our colleges and universities are structured. Here is a list that we must go through. This is a global phenomenon. I have adopted this list from a paper titled ‘College to Workplace Issues and Strategies: A Primer’ by Dr. Paul Heittich.

• Frequent and concrete feedback
• Some freedom to set a schedule
• Frequent breaks and time off
• Minimum marks to pass
• Ready answers and model question papers
• Correct answers usually available
• Passive participation permitted
• Independent thinking supported
• Environment of personal support
• Focus on personal development
• Structured courses & curriculum
• Few changes in routine
• Personal control over time
• Individual effort & performance
• Intellectual challenge
• Acquisition of knowledge
• Professors

When you enter corporate life, you are going to experience a different set of factors. For example, in corporate life, you will not get frequent and concrete feedback similar to college test scores. Corporate life is different. Let us assume that you have to release a product after running all tests and meeting the acceptance criteria. You cannot afford to limit yourself to 60% of the tests with no valid reason unless you want to lose your job. There is no such thing as minimum scores to pass. There are no model question papers and ready answers! Some problems or questions in corporate life do not have the right answers! Acquisition of knowledge is the primary goal when you are in college. When you enter corporate, you have to have the right balance of acquiring knowledge and applying knowledge. Results matter and lifelong learning to produce results matters!

I have discussed this further in Part 2.