Do you write tests first in TDD?

I am quite surprised how some technical terms easily lose their meaning over time. TDD (Test driven development) is one of them. I repeatedly meet people who do TDD at their work and when I say I also do TDD at work the next question most of the times I get asked is “Do you write tests first”? Stumped! TDD is always about write a test first and then write its code, test code is not a different citizen from production code while under development.

A few years ago if I had asked an interview candidate “Do you write your unit tests before writing your code if you are following TDD?” the chances are high that the candidate gets offended but now I am given a reply “I tried, but it is hard to do it; so we write tests after the coding is done to keep the coverage at 80”. So TDD has evolved to have a meaning of having 80%(or any other easy number) line coverage than a way of making sure to get a good low level design and have enough safety nets in place.

You are not following TDD if

  1. Not writing tests first
  2. Repeat point number 1

 

Working software vs points

I often come across people at management positions who clearly want to manage by tracking only numbers but fail to understand why were those metrics in place. We were part of a six team project, we were asked to go through our requirements and give an estimate including any proof of concepts and study that we had to do. The estimates were in points in fibonacci but were tightly mapped to number of days. When we questioned about why points to days the answer was to keep the yardstick of measurement same across all the teams in the org. It was setup for failure, but our team had to move on with the development so we went ahead agreeing to the terms.

After the first sprint our team had missed meeting the estimate while all the other teams had achieved it, we were met by one of the senior managers who gave a stern warning to the team that points are non negotiable and wants us not to fail again. When the time for demo came by, we were the only team that did a demo of the working software and product owners were able to immediately grasp what was going on and gave feedback on it. All the other teams had met their estimated points but they did things like ‘Study ABC tool’, ‘Setup CI machine’, ‘Setup Dev machine’ and so on.

Our team did all those and also demoed a working software, the other teams have bloated the estimate and bought time. This went on for some iterations, all the other teams were able to meet the estimates but other than our team all the other teams were not able to showcase their working software. The management did not care much about working software, their success was measured by meeting the points; it was the product owners who suffered the most as it took an extremely long time for them to get something working.

When you choose to measure something people will optimise for the metrics. Velocity and points are a way to help plan and size the software so that people can be allocated and releases can be planned, when it turned out to be a yardstick then there is only movement but no progress. People will eventually game the system and it becomes a toxic cycle.

Please prioritise working software over points

How to kill ideas

During our college days (2001) when Bluetooth was in its early stages the Bluetooth SIG (Special interest group) tied up with IEEE and announced a Bluetooth based theme for CSIDC (Computer science international design competition) with good perks like Bluetooth adapters, Windows XP and Visual studio licenses for participants and good prizes. One of our friends read about this and three of us put up a proposal with our ideas and we got through the initial round. We had a lot of ideas with us to implement a prototype, it is at this point a software company which was run by one of the alumni came over to help us in planning.

Our initial plan was to implement quickly and try it out on the users for feedback. hurry-up-2785528_640
This was for a generic identification device that can be configured to use for payments, tolls for cars, parking etc. The idea was that Bluetooth devices can hold a lot of data and gives the users the flexibility to create as many profiles as they want.

checklist-1643784_640One of the seniors in the company invited us to their place, in our first meeting itself we were stumped when we saw the mountain from which the waterfall process flowed. We were slapped with a software requirements specification document template which would have taken a few weeks to fill for the amount of ideas we had. It also had various parameters to rate the requirements like return on investment etc. I could never forget the feeling that we had on that day, we dropped our idea altogether and went on to find something which had requirements perfectly documented.

By the time we finished the first cut of the project and submitted we were only half emotiguy-1654859_640happy that we did finish something. We ended up converting EEG wirelessly and transmit through Bluetooth which was not a novel idea at all. The Waterfall process killed the idea, the fire and above all nothing useful came out of a defined process. Someone else who had submitted a similar generic id device entered the top 10 and ended up winning something. Some events leave a lasting impression on your life, this one was so strong that I had never accepted to work in waterfall development ever even though that was the only one very active around the time I graduated.

Any process followed for the sake of following it will surely kill a lot of things

Everyone wants to buy, but …

Selling something is very hard, I see this very often at my workplace. A successful sale has stories of so many disappointments, setbacks and strong will to persist through tough times. Even after seeing through all this, I get annoyed when I encounter salespeople who run their runbook on me. I want to buy something for my needs, but I don’t want something to be sold to me through ill will and tactics.

Here are some tactics that I find extremely annoying

Bait and switch

This is so common and effective when you are on the move. We do not prefer cold water so we asked the waiter at a restaurant to get bottled water at room temperature for us. He let us know that he can’t get the water unless we bill it and pay for it. Once we got it billed he gave us cold water saying they have run out of stock of room temperature ones. He pointed to the bill saying goods once sold cannot be taken back when I wanted to return it, we got our money back after creating a scene at the restaurant.

Useless add ons or replacements

This starts with small places like coffee shops to big places like car dealers. This tactic is used to trick the customer into buying add ons that bring great margins with little use to the customer. This is taught as cross selling and up selling to sales people to target ignorance. Have you ever wondered why service bills for cars usually go 2-3 times higher than a regular listed price service, I have been advised to replace my clutch plate which I declined and was able to run it for 30,000 kms more; same with batteries, vipers, brake pads etc. On top of it the cleaning services which adds up to a huge amount if you opt for, which by default the service advisor (salesperson’s fancy title) will add and wait for you to strike that out. I waited once for them to write down all of that and make them do it and refused to pay citing legal reasons that they had written it down in the complaints section instead of opt-in requests section, they immediately cut down the charges fearing legal issues.

Terrorize

This is the favourite one for hospitals and insurance agents who play using the fear in people’s mind. It is very evident if you have rented a car, the salesperson will never let you drive the car out without a hefty insurance package. We were told stories by the salesperson how someone had rented a car last week which was broken into by thieves and how the renter suffered loss of property and on top of it was liable to pay huge fines for car damages. We sternly refused additional insurance as we had got it covered through our company, the salesperson brought a manager outside and who explained that we cannot rent it out as it is at their discretion to prevent damages. We asked for a written statement for the refusal so that we can sue, we were given a car in 10 minutes.

Fake demand

This is common where there is no way to verify demand-supply. You will be presented with a nice product with an offer price that is slightly lower than the advertised price and will be asked to decide then and there to agree or there is someone else to buy. The salesperson will also revise to a higher price to introduce a fake demand.

Ego play

This is a double edged tactic used to make people upgrade. The common way it is executed is you will be asked for a budget and given very sub standard options in that budget. When someone asks for an eye catching option, the salesperson will dismiss it saying that it is not in their budget and hurt their ego. This will make people go for the higher priced product instead of sticking to their budget. Another ego play tactic used on couples is placing one of the spouses as the deciding authority by saying statements like ‘it seems someone else has the control on the budget’, ‘it seems you have no purchasing power’. It instigates a fight within the couple but one of them ends up buying.

Acting insanely good

This is very tough to negotiate out if you can’t say no. The salesperson will spend a great amount of time explaining things to you, help you go through lots and lots of information (often to confuse) and then pounce on you to make a purchase on one of the options. If you step in to look only for options, you may end up buying something because of the pressure exerted on you. I have encountered a person who refused me to go out through the door mentioning ‘I have spent so much time explaining to you, you have to buy something, I deserve it’.

There are many more tactics, with the web it is rapidly replaced by computers upselling and cross selling. As a buyer it is getting increasingly difficult to buy only what we need, instead we buy what is being sold.

 

 

 

Fine print

It is increasingly annoying to visit any place and be assured that you will get good service at the right price or as advertised.

Scenario 1 (Major MNC Bank) – A bank approached me saying that if I hold a salary account with them then I get preferential treatment which means lower interest rates, locker facilities, no pre-closure charges on loans etc. It was on their website, I ended up converting it to the salary account. Surprise 1 – I wanted to pre-close my loan and they said I need to pay a fine of 5% of outstanding (it is flat rate, much more than I will pay interest for remaining instalments). I called up the relationship manager assigned to me and he cooly said, in the fine print it is written that you have to pay a fine, we can waive you for any new loans you take from now. Surprise 2 – I wanted to get a locker, I was slapped with a requirement of taking a useless insurance product with them with a lock in of 5 years. When I pointed them the ad, they said “it is for RBI compliance; we can add you to the waiting list if you wanted as per RBI guidelines”. I got the waiting list number after threatening them about an ombudsman complaint.

Scenario 2 (Multi national car brand) – I took my car to a reputed brand’s service center. The service engineer asked me about the complaints which I did not have any. He proceeded to fill a lot of details in the complaints section like A/C, Air filter etc. I pulled out the user manual to cross verify and it was recommended to be done only after a year not the current service cycle. When I pointed out, he sheepishly smiled and removed the line items saying all customers want their cars in pristine condition so they go for it. I thought he removed all additional items but when I went to collect the car I was billed an additional 1500 rupees. To my shock, he had written A/C cleaning twice and struck off only once; he mentioned that I had signed after reading through all of them. I then threatened them that A/C cleaning is not a complaint in legal terms and it is a customer request which has not been put up in appropriate column so I can take this up with consumer court. Immediately these guys relented and reduced the bill.

The list goes on I was denied insurance claim saying it is a fraudulent claim and then I approached the ombudsman who awarded the case in favour of me. The restaurants waiting for you to open the bottle on the table and then slapping 200 rupees for mineral water which was not told you anywhere. The medical shop switching generics for branded ones which are sometimes 3-4 times expensive.

My advise is to know your surroundings and your rights. It is not possible to read all the fine print but do not allow people to take you for a ride.

Swiss cheese model to understand test coverage

swiss_cheese_model_of_accident_causation

I often get into a debate with people about the type and the extent of testing that has to be done for software. One of the key arguments I hear is that developers should focus on creating only the happy path and leave the rest to the testers to find or have SDETs write extensive automated tests while developers can skip unit tests and focus only on writing useful code.

I have used the swiss cheese model to explain to people about the need for layered coverage instead of concentrating all the effort onto one layer. I first heard this term while watching an air crash investigation episode in nat geo. The narrator explains that though there are millions of parts in commercial airliners, the chance of getting into an accident is far lesser than motorcycles.

How an aircraft with millions of parts is able to get back on to the sky within a few hours after landing from a long trip? The answer lies in layered testing. The pilot has a pre-flight checklist, the ground staff do a routine check for visible damages, the maintenance crew notice the hours of usage and do preventive maintenance, there is a strong network of weather monitoring and routing, ATCs manned with trained staff and modern radars, aircrafts fitted with collision avoidance systems, a long series of protocols for ground and sky movements etc.

It is the same across many engineering and medical disciplines. The risk of something slipping through all the layers of test is very rare and if it happens then it is immediately plugged. In software engineering it is a combination of static checks, unit tests, integration tests, automated ui tests, heuristics & exploratory tests, performance tests etc. No one type of test can be removed altogether and replaced by another. We need the layers to move fast and yet deliver what is required.

Image courtesy: Davidmack, Swiss cheese model of accident causation, CC BY-SA 3.0

Spending, Savings & Investments

When you open the newspaper in the morning, mostly the front page ad will be by some builder luring buyers with a remarkable investment offer that is bound to appreciate in value with unheard levels of return on investments. One question I always wondered about was ‘why don’t these people hold on to their assets instead of selling if the prices are always upwards and skyrocketing’.

Many of the investment opportunities are nothing but spending disguised as investment. Buying a new flat involves taxes, registration, premium, loan fees, interest etc. It is good to buy one to live, but buying solely for investing that too on loans is nothing but a huge spend. We have grown up to see property yielding good returns, but that was largely due to the developments and migrations that happened to some of the cities. Stories of selling inherited houses and making a fortune were told to us which primed us into thinking that buying a property is an investment.

Investment is something that always carries a risk, for example cost of property during 1980s in North Chennai suburbs (like Minjur) and South Chennai suburbs (like Urapakkam) were same, but people who invested in the south reaped the benefits. The risk here was non development, the risk surfaced for some buyers and they ended up just getting inflationary returns. Investment needs knowledge of the market, environment, a bit of knowledge about the economy, a good amount of time and some dose of luck. There is a lesson for investing, do not put all your eggs in one basket but property is such an investment that it is a large egg which sucks up all your savings and locks it up.

Savings does not carry a big risk, but in the long term it definitely erodes away with inflation. Savings can be treated as a low risk investment with a very less return on investment, does not require much market knowledge, it is to cater to short term finance cushion. One should have around 3-6 months of expenses in readily drawable savings, anything more will be eaten by inflation.

What is safe then? Nothing is safe, we need to spend prudently and at the same time invest and save in different baskets to offset the risk of exposure in one area like real estate to the other like stock markets. Don’t succumb to greedy marketing and planned obsolescence, many things last really long.

Baskets for savings (immediate liquidity)

Bank deposits (fixed or savings bank), inflation will eat it over time.

Hard cash and foreign currency, if you travel often. Forex might move with inflation but hard cash will be eaten by inflation from day 1.

Gold, it can be held long as it does not lose too much value but gives less RoI.

Baskets for investments (Risk involved, but always pays over long periods like 15-20 years)

Stocks & mutual funds, equity should be held very long to reap the benefits of compounding and shield from short term market fluctuations.

Plots & farm lands in the fringes of the cities, will take a long time to sell and depends on the development around. If you are lucky could land in a major windfall.

Rental real estate, only if the rental yield is around 7+ % of the cost of the purchase and that too purchased outright without loans.

Spendings

A comfortable house in a locality that brings peace,  when bought on loan; should not burden more than 40-50% of family income as it has a long repayment period. Keep in mind the high costs associated with registration, taxes and fees. Long term returns in the current market conditions pegs flats bought on loan to perform the worst in terms of RoI, treat it as if you are buying a car for yourself not an asset.

A good vehicle, as many people commute a lot. Better to avoid a loan and go for outright purchase which will make people negotiate hard and keep the existing vehicle for long. If you go for a loan then buy only if your outflow is around 20% of your family income and you can finish it off in 2 years.

There are plenty of marketing going on to make us spend a lot more than necessary like changing home appliances every few years, expensive and lifestyle brands etc. Create a budget for spending and try to stay within it as much as possible. Your spending budget per month is best limited as 3 times the rental rate in your area. The rest should be saved and invested.