Saturday, 9 March 2019

Carpentry - The art of making right software

Case of making wooden frame
Suppose you got an order for making perfect wooden frame that can serve for fitting window. How would you proceed?

Traditional Approach 
You trust your skills, you know client has budget that could satisfy costs for making of this frame. You ask client series of questions
  1. Where you want to fit this frame.
  2. What size should be frame made of
  3. Do you want it made with waterproof wood.
  4. What color would you chose for polishing this frame.
That looks like perfect questionnaire for you to Gather Clients Requirement and you did it at very beginning before even starting to make frame.

You got answers for above questions as follow
  1.  In hall
  2. 4 Feet x 3 Feet, 3 inches thick.
  3. Yes
  4. Color which will suit hall
You seem to be happy that you know what client wants you estimate it would be done in 7 days, you start working on it. And you built something like below (right side)


 Well you didn't wish to built something like below, perhaps you don't know carpentry its your first time hence you built it that way. All those excuses but will client accept that. Definitely no.
What went wrong?
Or did you check every time while you was making it.
Lets learn it from Carpenter how to make wooden frame.

Preventive Approach
My father was a carpenter, while he used to create wooden frames i used to observe him. These carpenters have particular way of doing things lets explore those
If we observe both the frames above we would see many things that could have done better since the beginning which wouldn't have led you to that out of shape frame.

First build your units properly
If we see above wooden frame it consists of four woods cut in particular shapes and then joined together. You need to be precised while using chisel properly on edges of the wood so that you cut it in appropriate shape. I use to see my father use to measure the angle between edges with right angle tool every time he use to apply plane.

When making software it is very important that you are building its units flawlessly. This is the place where Unit Testing plays an important role. Unit tests ensure that you are keeping your units intact to the expectations every time you change some of its internals. Its like applying that right angle every time you use plane tool.





Next, Are your units compatible with units they relate?

Now that you have built your units its time to calibrate those units for their compatibility with their pairs (may be one or more). What would you ensure here. you would put two units together and check when they placed together fulfill part of your requirement. Here in case you would check if you place two adjacent woods together whether they form right angle as shown below.



This kind of verification is called as Integration Testing. Similarly while making software you need to ensure every change you make to any of its unit is compatible for its integrated counterparts.

There is this interesting case of Contract Testing which also plays important part of Integration testing. Suppose one of your joint is square groove and other unit which should be fit to this groove was round cylindrical extrude. They wont be compatible right. They don't abide with common contract. This is kind of testing which ensure your participating components abide each other with common contract.

Next, Does the Frame put together looks and feels what was intended by client
This are last piece of tests that you would like to ensure on above frame that it is broadly correct with respect to specification.
In software testing this is called as Functional testing

Do i need to check everything at every place?
If you observe above example closely the more efforts you spend testing primary units then integration very less you would need to spend on Functional part. This is called as Test Pyramid more you spend efforts on bottom part less you need to spend on top part.

What as a QA you can do to ensure that all Test are built properly?

Well to answer this question lets answer this first, in above case who knows it better that right angles of particular edges and 45 degree angle of other edges would lead to correct units, the one who know about quality. So you being QA can pair with developer to list what tests should be applied on various units integration and functional part.

So you get paid for just tasting pasta and not actually cooking it?

Introduction to Software Quality Assurance 

What do you do?

If you work in Software industry then you might have faced this question at least once in your life What do you do? Since Software Industry is now on the edge that it is most news making industry and over the period of time software have touched everyone's life, answering this question to layman became easier than it was in the past few decades. Having said that Developers might just say i create software. Using create word without any doubt in mind. When the same question is asked to QA who in popular term known as Tester he might need to explain a bit more on where he relates to this 'create' word.

Gone are the days when software used to be totally made first and tested later (or was that the case anytime). In the new edge of software development companies or vendors are keener on providing building software by preventing flaw (which in terms of the software industry is called a bug) rather than fixing a flaw. And There is reasonable philosophy for doing that. Let's understand this with the example of making pizza.

Suppose you own a restaurant and the customer ordered a pizza with his own choices of toppings (maybe Pepperoni, Mushrooms, and Bacon) that he like with this pizza. You passed this order to the chef and he is preparing it while passing order you forgot to mention Bacon so Chef just knows that he needs to add Pepperoni and Mushrooms. He placed the base on pan added some base cheese added Pepperoni forgot Mushrooms and added cheese on top of it. Yeah!! The pizza is ready!! Your Stuart takes the pizza and notices that it is missing Mushrooms and Bacon. Since it is already cooked now is there a room to correct it? Ok let's make it fresh again ... Is it worth the cost? Is it worth the time? What if there was someone who was constantly checking and validating makings of pizza with customers order while entire pasta was being made.

This early entry of QA in Software Making process marked the beginning of a new era where QA's responsibility is not to find bugs but to prevent it. Since finding bugs and fixing it is costly and time-consuming process teams are now focused more on preventing bugs at all. So if someone asks me what do you do I answer I am QA and my first responsibility is to prevent bugs.

Those ways QA is not just tasting pizza but actually contributing to the process of creating pasta that will be appropriate for its customers.

How do I do that?

Am I an astrologer for codes who knows this particular part of code likely have bugs?

We will answer these questions in upcoming post.