Monday, November 6, 2017

Code reviews in a Scrum team

Every team usually consists of people from different background and company cultures and with varying experience when it comes to code reviews. As a team lead I find that it is valuable to re-inforce the team with a set of guidelines to be followed in-order to ensure that everyone understands its value and is on the same page. This is a copy of the code review guidelines that I documented recently for my team.

Purpose of code reviews

  • Code quality - This is ensured by having an expert (inside or outside the team) review the code to help the developer with finding any obvious problems or missing gaps in the code
  • Keeping the developers up-to-date and ensure teamwork - It is good to have more than one developer in the team across any code change, so that as an agile team the skills match and so the team gets better at estimation. This also helps with equipping other team members provide support for the same change in the absence of the author of the code.

Common guidelines to everyone involved

  • Adopt a positive attitude - reviewers should avoid negative criticism and submitters should trust the reviewer and have open and healthy two-way conversations
  • Go by the checklist of standards (Refer to the coding standards being followed by the company - if there is no such documentation, you should work on that first).
  • Do not go overboard with attempting a 100% unit test coverage as we also have other testing mechanisms in-place before the code hits production - although ensure that the common happy-path and few negative scenarios are covered. Also do not request for unit tests for getter-setter routines in isolation as there is very little to no value in it - this should be covered as part of the unit test of the caller routine in most cases.
  • "Best code is no code at all" - this is a famous principle which is self-explanatory. The diff of the new changes should be kept as a minimum by removing unnecessary code changes not relevant to the given requirements.

Guidelines to the Submitter

  • Test your code before assigning for reviews and add unit tests wherever applicable - note that for the big dev tasks you may choose to test most of the scenarios (definitely happy path and most common negative paths as well) but leave the rest of the testing to be done while the code is in review in parallel to have early feedback. Code reviewer's responsibility is not for screening for any defects before QA testing. The code reviewer normally looks for coding standards and the overall architectural approach and so might spot some bugs in the process - but do not rely on the code reviews to have the bugs spotted. (Note that this principle varies from company to company and so you may have to suit your team's needs. In my team, we have unit testing framework, integration testing, then QA testing which covers functional requirements and finally regression and staging testing before something hits production)
  • Provide enough context to the reviewers - give useful comments, well named variables etc. For massive code changes with 300-500 lines of code, ask if the reviewer would like a code walkthrough session to speed up the process (prepare to note the reviewer's spot-comments during the session)
  • Assume best intentions from the reviewer - the code reviewer is expected to take ownership of the code he/she approves and is only trying to help you with the quality of your solution and code. So do not take the criticism on your code personally if alternate approaches are suggested; Also have face to face healthy conversations to close out on any comment that needs additional clarification.
  • Respect the code reviewers' time too - if you are running late with the dev work and provide the code for review just before the deadline, it is not justice to the reviewer expecting them to stop whatever they are doing and then do a quick and less thorough review of your code. If you already know that you are running late due to a certain bug or any specific issue, request for "early" reviews from the reviewers so that they can get comfortable with the code and raise any red flags early (so you also get enough time to work through them) and you may get the bug solved as a bonus too. Alternatively, do pair programming.
  • Review your code quickly before submitting - or at least do 'spot checks' to avoid making silly mistakes while submitting the code like typos in the comments or log lines or badly named variables or code formatting etc.

Guidelines to the code reviewers

  • Provide constructive criticism - avoid phrases like "you" or "your" when referring to the code as it is equivalent of making personal statements. Refer to the code in the comments and not the author.
  • Separate nitpicks and blockers. A way of understanding this distinction is by asking yourself: “Will the current version of this code cause significant negative consequences if merged?”. It the answer is “No”, then the comment is probably a nitpick and not a blocker. If a pull request is reviewed and only nitpicks are found, then the pull request should be approved and left to the developer/submitter to address them optionally.
  • Do not add blocking comments for code refactoring work not authored by the developer/submitter, fixes to old code, or missing implementation outside the scope of the submission. If new bugs or missing features are found, then call out to the developer to add new tasks. Reviewers should only hold submitters accountable for what their pull requests aim to do and implement, and nothing else.
  • If the submitter does not agree on something, have face to face conversations on the subject with the submitter and any other reviewers of the task. If you are the sole reviewer and if you are unable to reach any consensus (which is very rare if you are having a healthy conversation on the subject although possible), respect the opinion of the submitter although point out that you are only helping the submitter and it is his/her responsibility to have a proper solution to the problem.
  • Do not block someone else's review for more than a day - this gives less time for addressing the feedback comments and so causes disruption to the developer
  • Review unit tests as well - optionally start the review with the unit tests (TDD approach) - focus on the inputs and outputs to see if most important scenarios are covered.
  • If a code review is handed over at the last minute and you are unable to attend to it, raise it with the team so that someone else can pick up - if there is no one else to pick it up, raise it with the scrum master so that everyone in the team can be gathered and a decision can be made instead of rushing through the code review process.
  • For huge dev tasks with more than 300-500 lines of code change, request the developer to give a quick code walkthrough to speed up the review process rather than loosing attention due to the overwhelming code quantity. Code reviews should never take more than a couple of hours - the effectiveness of the review subsides with time and so there is no point of having healthy reviews just to approve them anyway without much attention given
If you have any more ideas on this subject, please drop a comment.


Tuesday, October 27, 2015

Pasta with carbonara sauce, vegetables and spinach

I am a pasta lover and so are my kids. Earlier I used to just buy them and never tried to cook them at home. Then the day I decided to cook it for the first time, I just bought a ready-to-use pasta sauce and some pasta and made it since making everything from scratch sounded daunting and elaborative. It was good but since I always preferred to avoid buying ready-to-cook items, be it curries or desserts, I wanted to give it a shot. So I decided to make it all by myself. But after reading a number of recipes from the internet, I was totally confused when I was about to start cooking. So I tried out my own recipe, partially based on random recipes from the internet. Basically the carbonara sauce I made might not be truly carbonara. But the end result was delicious! Also, it was very easy to cook, surprisingly! Since then, I cook it once a week and it makes a good lunchbox food for all of us.

Okay, now to the recipe. The ingredients to be used would be :

  • Pasta of your choice - as required (I cooked about 500 gm)
  • Baby spinach leaves -  as required - cleaned
  • Carrot - 1, grated
  • Celery - 3-4 small chunks
  • French beans - 2-3 cut
  • Cherry tomatoes - 3-4
  • Onion - 1
  • Garlic cloves - 3
  • Red chilly flakes
  • Egg - 1 (this can be avoided if not required. It is usually added to make it creamy)
  • Milk - half cup
  • Melted butter - more than half cup
  • Cheese as required
  • All purpose flour - half cup (but I use wheat floor these days - just being health-conscious for a bit)
  • Black pepper
  • Salt
  • Fresh parsley leaves for seasoning (As I didn't have this at home, I used dried parsley leaves)

Method :
  1. Add pasta in heavily salted boiling water. Make sure it is fully immersed. Leave it for 7-8 minutes or until the pasta is cooked. Make sure it is not over-cooked and stays al dente as the Italians call it. Then drain it and keep it aside. Save 1/4 cup of water used to cook pasta as it might be required later.
  2. Pre-heat the oven for 5 minutes to 200 degrees (Celsius)
  3. Grind onion, carrot, celery, beans, garlic and red chilly flakes together.
  4. Then add the cherry tomatoes and grind the veg mixture further to make it like a paste.
  5. Heat a pan and add butter
  6. Once the butter melts, add the all-purpose flour and stir it for 2 minutes
  7. Add milk and then black pepper and salt (and dried parsley leaves if being used) while stirring until it is creamy. Set it aside.
  8. Add a little bit butter (or olive oil) in the pan and add the vegetable mixture prepared and stir it for a minute.
  9. Beat the egg and add it to the pan and mix it well.
  10. Next step is baking in the oven : Add baking sheet and then spread the pasta and pour the cream and veg mixture and mix all of them. Add the baby spinach leaves and mix it in. Add the saved water with which pasta was cooked if it is too dry. Cover it with baking sheet/aluminium foil and put it in the oven for 15-20 minutes at 200 degrees.
Note : When I cooked it for the first time, I did not use the oven. I simply cooked in the pan by keeping it covered.

Serving suggestions: 
  • Drizzle fresh parsley leaves and pine nuts while serving
  • For my lunchbox, I add some salad leaves and some salt and pepper on it to add nutritive value. Sometimes I drizzle the salad leaves with olive oil if it feels too dry.
Bon appetit!


Monday, October 19, 2015

Vegetable and couscous salad

This is my first recipe being posted in my blog. So it might be worthy to have a quick reading about my cooking style in my previous post.

So this recipe is one of my favourites. It is very easy and nutritious. Some ingredients required for a meal to serve 2-3 :

  • Couscous - 3/4 cup
  • 1 Red onion (chopped)
  • 2-3 garlic cloves
  • Some chopped vegetables that want to add - I used carrots, beans, cherry tomatoes, green capsicum
  • 1 teaspoon olive oil
  • 1 teaspoon cumin seeds 
  • 2-3 red chillies (optional)
  • Salt (optional)
Veggies and Couscous salad

 Procedure :

  1. In a hot pan, add a bit of olive oil and then cumin seeds (and red chillies if required).
  2. After few seconds, add the chopped red onions and stir for a minute
  3. Add the chopped vegetables and stir for 2-3 minutes
  4. Add couscous to the veggies and mix them well and stir for few seconds
  5. Add water so that the contents are "just" immersed in water and close the lid and leave it for 5 minutes
  6. Fluff up couscous with a fork and if you want to cook it more, add water as necessary and leave it for some more time.
Serving suggestions:

The beauty of this dish is that it can be served in two ways :
* Mediterranean style - Squeeze a bit of orange on the salad and serve.
* Indian style - Add some freshly chopped coriander and serve. This recipe reminds of that of traditional sooji or rava "upma" and can be prepared similarly although will taste a bit different.

Bon appétit !


My cooking strategy

I am a working mother with 2 year old twins. So you must imagine the fast pacing life I must be having. Most people in a similar scenario cook in bulk for the week. But I don't like the idea of consuming 5 day old food personally although it is very much tempting to do so just for the sake of saving some time for resting after the kids are asleep.
So I resort to cooking only two meals for the day and I cook mostly in the evenings- one for dinner for the night and one meal for packing lunch for the next work day. So I restrict myself to easy recipes for the workdays and leave the complex ones for the weekend. Breakfast is mostly prepared just before consuming and so I plan for only simple food in the morning which need zero planning in advance.

What I realized is that it is very hard to find recipes of quick and easy meals that are suitable for me in one place. Of course there are some books that offer to give such recipes but most often they involve more work than advertised or simply use a lot of ready-made ingredients which I don't generally prefer. I try to make the dishes simple and tasty and avoid too many artificial and ready-made stuff - to make myself clear - I am a person who prefers buying fresh fruits over frozen fruits, fresh meat and seasoning it myself over pre-seasoned meat, etc - you get what I mean? At the same time I try to balance by buying certain stuff instead of making them from scratch - for example, I buy whole grain pasta instead of trying and making one. So there is quite a bit of balancing act involved here.

I will try and post some of the recipes of quick meals I make on a day-to-day basis. I am not an expert and so there might be better ways to cook the same food I make. But my motive is to convey the recipes that worked for me and my family so you can base your cooking out of it and also work around it to make it suitable for your own taste-buds. Please remember to post it back in the comments if you think it turned out well. I am open to experiments and suggestions.

Watch this space for some simple cooking recipes...


Thursday, October 15, 2015

What I have been upto...

Looking at a lot of old photographs, I realized that I am not the same person as I was 5 years ago. I believe I am stronger now and I have never felt more alive before; Thanks to all my ups and lows in recent years which I think should be the reason for this feeling. Well I suppose there comes a time when every person in the planet has this sort of realization. Here are my lessons -

* Travelling is the best treat of life. Meeting new people with different cultural background can teach few of life's greatest lessons. I think I became a lot open-minded than before after meeting a lot of interesting people.
The 12 Apostles

* Learn to say "No". I have noticed a lot of us, especially women, try hard to align with the so-called social rules. I used to be one such person who tried so hard to satisfy a lot of people. But then I realized it is never possible to convince everyone as there is always someone who is unhappy with any decision I make.
Mind your own business
* Learn to accept everyone's flaws including my own. This is easily said than done. I am still working on this one but it gives a lot of peace when I try to accept things the way they are and move forward.

But don't kill anyone out of frustration

* Finally, eat and sleep well even if the world is falling apart.

but not at the same time

It has been a while since I have been actively updating my blog. But I hope to do some posts on cooking some easy recipes in the coming days. Watch this space!


Monday, March 2, 2015

Eastern Vs Western Parenting Styles

Recently, I got into thinking about different ways of parenting a child and how the country's culture makes a big impact in parenting choices. I came up with some important differences between parenting in India and in the Western countries. During my research on this topic, I came across a book written by a Chinese mother about how she raised her kids - Battle Hymns of the Tiger Mother. This book taught me that Chinese are not so different from the Indians when it comes to parenting. So instead of naming just India, I guess I can generalize it as the 'Eastern' parenting style. Also, I am not saying that any particular style is better than the other as both have their pros and cons. Well, not to forget that I am no expert and I am merely struggling with parenting my own kids! Also, there are exceptions in both Western and Eastern parents- especially in case of a lot of Indians/Chinese who have migrated to the West and adopted the western style.

An ideal Eastern parent is expected to be strict with their children or else is considered to be "spoiling" them. Parenting children is considered to be a lot of emotional and physical "investment" by the Asians - they emphasize academics and skip on arts and sports. They are ready to spend more time and money for their education and take extra tuition classes for tutoring their kids. They are ready to sacrifice anything to get them to good college and obtain good grades. And in most cases, many of them end up in well paid Technology/Medicine/Management jobs as well. And in the end, the child is expected to pay them back by looking after them in their old age and is indebted to them forever. Parents, especially those with sons, who come from patriarchal families rarely have a pension plan and expect to live with their son and daughter-in-law- although this is changing gradually. Eastern parents do all the thinking and make all the choices for their children. They don't respect the preferences of their kids and "override" with their own interests as they think that it is good for the children. They try to make their kids as an "idealised version" of themselves. As a result, children are curbed from thinking independently when it comes to making important choices in life.  So the children are used to taking assured path with lesser risks. But this technique works well if the child is not self-motivated - and let's face, not many children are that self motivated. But some parents don't know when to stop and keep controlling their kids even when they turn adults or get married and this causes a lot of tension in case of many families.

The Western parents tend to be placing rules for children, although many of them tend to be permissive when compared to the Eastern parents. The parents permit children to choose their own interests and pursue them as they continue to do their own as opposed to Eastern parents, especially mothers, who stop living their own life for the sake of their kids. A lot of kids are more creative than their Eastern counterparts and they choose careers not just in Technology, but in all possible fields. The parents try to treat their kids as adults and give a lot of freedom in making decisions for themselves. So even if they make wrong choices as adults, the children don't tend to listen to their parents as they are not used to being controlled. So the parents tend to just hope that their children would learn from their own mistakes. And the Western parents don't expect benefits from children like the Eastern parents and also expect them to be independent. I like this quote about how Western parents view about their children, from the book "Battle Hymns of the Tiger Mother" -

"Children don't choose their parents," he once said to me. "They don't even choose to be born. It's parents who foist life on their kids, so it's the parents' responsibility to provide for them. Kids don't owe their parents anything. Their duty will be to their own kids." 

 Well, the ideal style would be to balance between both the styles- permissive in some cases so that the child learns from making mistakes and strict in some cases so that you teach them that choosing the right path is not an option but the default. Also, parenting is a tough job - there is no single book to say what is right and what is wrong. Some things work fine for one kid which may not work for another. And it is a no-brainer that one must choose what is good for their own kid and family.


Tuesday, February 10, 2015

Rent a wife?

Stereotyping roles based on gender is not uncommon around the world. Just when we started to protest and reduce them to some extent, we have websites called Rent-A-Wife and Rent-A-Husband. The "rent a wife" website offers services like baking, cleaning, grocery shopping, "making things pretty" etc and the "rent a husband" website offers services like lawn mowing, plumbing, etc - no brownie points for guessing them right. Basically, these websites did a good job of inscribing responsibilities based on gender. Well, the problem with stereotyping is that men or women find it as an excuse or embarrassment to carry out tasks not meant to be done by them.
Secondly, renting a wife/husband reduces the worthy notion of a spouse being a human. We can rent a car or a house or a DVD- but the idea of renting a spouse just doesn't sound right. And one may ask, if the spouse can be rented to live with or go for a party for showcase. Well mate, this is not a dating or adult website- but you see, it gives that notion. Well I am sure these websites got some extra clicks this way.
Lastly, not the mention how much pressure it adds by raising bars of being a "perfect" wife or husband.

Bree Van de Kamp of Desperate Housewives, who is portrayed as the "perfect" housewife.