Monday, 16 October 2017

Take care of your code even if you think it is healthy

When Marc Andreessen wrote "Software is eating the world", what he actually meant was that technology is transforming industries through software that "finally works and can be widely delivered at a global scale". However, the side effect of this is that we are seeing more and more systems fail due to software errors, and in more complicated ways. For example, in 2014 thousands of callers couldn't reach 911 operators because the software that was supposed to generate unique identifiers reached a predefined threshold. No one really knew what would happen when this threshold was reached nor was the system designed to warn about this. The FCC concluded this as a 'preventable coding error', which to some extent puts the blame directly on the developers.

A project manager would argue that there should be several levels of testing and quality control that should have detected this problem much before it was encountered in the field. Not really!! Lets go back to era before the advent of micro-processors. Most systems at this time were electro-physical, which meant it had a limited number of configurations, and it was possible to enumerate and test all possible combinations. But with software, unless there is a formal proof of correctness it is very unlikely we can guarantee bug free code with any amounts of testing.

In spite of this, we continue to successfully create complex software products. From my personal experience, I think this success can be attributed to "taking ownership". In simple terms, all this means is developers should not assume that some kind of process will detect their mistakes. Although this sounds intuitive, unfortunately this is not how most commercial software products and services are developed nowadays. Not all companies can build their own software they require and as a result, they are typically 'outsourced'. In this model, a group of developers spend anything between a few months to a year collecting the requirements, designing and writing code. This piece of software is usually verified and certified by a testing team, which in some cases could be the clients themselves. The problem with this approach is that the primary goal is to get the software out and certified, which may not encourage developers to think about longer term implications.

In contrast, in companies where software products are built and shipped directly to customers, developers are expected to have a greater sense of ownership. When I started working for Novell, I met developers who had worked on the same product for over a decade. While I found it hard to believe, these developers took care of the code they wrote and maintained as if it was their child. This created a culture of zero tolerance for bugs and near instantaneous turn around for customer issues. So even if bugs due to coding errors do occur, developers have more accountability.

However, it is very unlikely to expect every company to hire engineers to build it's own software, nor can we expect the outsourcing model to change any time soon. But the more I hear of software failures as a result of coding errors, I cannot stop thinking back at my experience with these two types development paradigms.

Coming back to the title of this post. We never neglect our kids just because they are doing well. We strive to keep them healthy and sound. Well, this is what a sense of ownership brings to your code too.

Saturday, 22 October 2016

Is your research interesting?

"No research is interesting and all research is uninteresting until the person explaining it (in writing or speech) can make it interesting".

Having said that, a few would argue that to some extent it depends on the audience. This would be similar to the "beauty lies in the eye of the beholder" argument. But I don't fully agree with it because I have seen several cases where seemingly unappealing research is made to appear novel, groundbreaking and interesting. Venues like 3MT and TED Talks have many examples of this.

Well, I guess the real question should be - "Is your research interesting to others?" But there is another part of this question that might be equally important - "Is your research interesting to you?". If you go around and ask a bunch of grad students, I am pretty sure many would answer this with a big NO. I personally agree with that too, but making your research interesting to you is probably the first step in making it interesting to others. Almost all grad students go through this cycle of love and hate for their research but deep down they will do anything for it, they want their research to get recognized (or published) and they tirelessly work on it hoping that one day it will love them back. I am a bit confused now, am I talking about research or raising kids?

Tuesday, 6 September 2016

Why get a PhD?

Well, this is not a question that I should be asking myself but rather a question that others often ask me. So, this post is to bring some clarity into those minds.

Let's first talk about what the goal of a PhD is. Irrespective of which PhD program you are enrolled in, the university, or the country you are in, they all share a single common goal of preparing each student towards becoming an 'independent researcher'. Of course some programs are more demanding than others, and many phd graduates may not continue to do 'research' during their career. But people often forget this specific goal of a PhD and try to relate it in terms of money, career growth, happiness and what not.

So, what is research? A definition pulled straight from Wikipedia says - "creative work undertaken on a systematic basis in order to increase the stock of knowledge, including knowledge of humans, culture and society, and the use of this stock of knowledge to devise new applications". 

While love for research can help you get motivated to enroll in a PhD, it is not enough to let you stick around and graduate.  Historically, at least in the US, a PhD was a path to an academic job and this served as a tangible payoff for years of hard work (read as nightouts). However, that is no longer the case as the stats show that only a very small fraction of PhDs end up taking a career in academia

So, what is it that keeps us all going, in other words, why do we still want to get a PhD. I think I have found the answer through my own experience as a graduate student of three years. I have to say that there is no other profession where you get to learn as you do being a PhD student. Over the years I have found that my PhD program is preparing me to not only become a researcher but also an entrepreneur, writer, speaker, listener, creative thinker, critique, marketer (surprisingly a big one), manager, engineer, developer, designer, analyst and an active team member. And above all, not to sound too cliched, it has prepared me to be resilient to whatever that is thrown at me. 

Of course the disclaimer - Neither have I graduated nor I am anywhere near to graduating, so, my experience could be better or worse a couple of years down the line. But at the end of the day, the two things that matter to me at this point are - learning and the experience of learning. And that is exactly what I expect to get out of my PhD. The best part however, are summer internships, which you can do quite a few during a PhD and they are fun, a refreshing break from academic research, and I have always seem to have had a productive time.

*** Few weeks after I posted this I came across this nice TED Talk  by Nadia Jaber a PhD graduate from Stony Brook - https://www.youtube.com/watch?v=rHItLGBPsJ8
The talk is about the prospects of a career outside academia for phd students. Although the later part of the talk is some kind of a promotion for her private organization, there is a quote i really liked:
 "A PhD is not a one way ticket to academia, but it's really more like a passport that can take you anywhere you want to go. You just have to choose your destination and pack your bags before you leave."  
This immediately struck a chord with me, and very similar to what I have been thinking about my PhD. I do agree that the speaker, however, was referring mostly to PhDs in the life sciences discipline, whereas most PhDs in CS and related disciplines have a lot more options in the industry. But, personally, I think irrespective of the discipline, all PhD grads go through similar feelings of anxiety and desperation. Rather than fight those feelings, it is important we acknowledge them, know that it is a part of what we signed up for and we will eventually come out of it stronger.



Of all the bikes, I got this one!

So, when I started my internship at MSR, I was told that Microsoft will pay me for a bike and other accessories. So, that got me excited as I have always loved to ride a bike, well who wouldn't. Anyway, but little did I realize that the US market was flooded with thousands of different kinds of bikes. Back when I was a kid things were simple, most of use just rode a single speed, and a few rich kids would ride a "geared" one. So, I started a mini internet research on bikes and came across an incredibly useful, versatile but often looked down upon bike called the - Folding Bike.

For those who have never heard of them - they are bikes that often fold in half and most have 16-20 inch wheels. When people think of folding bikes, the first thing that comes to their mind is a clown riding one of these bikes.



But this is 2016 and folding bikes are a lot cooler and pretty much ride like full sized bikes,

  

However, folding bikes are generally a bit more expensive than full sized bikes for the same specs and quality. But the tipping point for me was the need to take my bike inside a bus, up a flight of stairs (or an elevator) and store it in a hotel room. So, I got one of these,


The picture above is a Dahon Vitesse D3HG, it is a 20-inch 3 speed internal gear hub bike and a coaster brake (so absolutely zero maintenance). It folds up small enough to stowe it under the seat of a bus, and even with just 3 gears i did not have any problem with climbing steep hills (even in Seattle) and reaching a respectable top speed of 18.5mph.

I would say by all means this is the perfect urban commuter. So, having used it for a few months now, I thought I will list some of the pros of owning it,

  1. No locks = No thieves: I think the biggest benefit of owning a folding bike is to be able to take it with you anywhere, i mean literally 'anywhere' -  even inside a toilet. This was especially handy when I had to get groceries or  store it in my hotel room every day. But make sure your folding bike "rolls when folded", not all models are able to do that.
  2. Bus racks full - no problem: Just to harp on its portability a bit, I found taking my bike inside the bus a real boon. In Seattle, all buses have a rack in the front for 2-3 bikes. But these racks are mostly full especially during peak hours in summer. What is the use of a multi-modal transport (bike+bus) when you have to wait three times longer just to find a bus with an empty rack? So, the folding bike was perfect for this and besides the lack of derailleur gears meant no threat of damage when stowing it under the seat of a bus.
  3. Start like a rocket: I read quite a bit about the acceleration and torque that small wheels can provide. It just doesn't make sense that you can race faster than a road bike. I found myself going well past all road bikes every time starting from a traffic light stop, although they pass me after a few hundred meters. Small wheels are good at accelerating from dead stop but cannot sustain the momentum longer like their bigger wheel counterparts. This is especially useful riding in a city and with the internal gear hub I did not have to worry about changing to a low gear before stopping. 
  4. Maneuverability: The small wheels are definitely much easier to maneuver and I found it particularly useful going past pedestrians riding on sidewalks, and going on and off from pavement to sidewalks. The small wheels are also less intimidating for pedestrians when you have to ride on sidewalks, which is by the way legal in Seattle.
  5. No assembly: Unlike full sized bikes, folding bikes come 'fully' assembled. While most full sized bikes do come nearly completely assembled, they often need fitting in the tire, handle bars and saddle, among other things. Although, even with folding bikes you might need to true your wheel and adjust brakes and derailleurs. However,  with a coaster brake and internal hub gears, i could take my bike for a ride right out of the box. More experienced bikers might find this naive and I agree, once you get the hang of fixing things yourself, life gets a lot easier and better.
  6. Flies with you or Ship it away with ease: Just as it did not require any assembly, it does not require any disassembly as well in case you want to ship it. A few folding bikes can actually fit in a carry on bag  (esp. the brompton) which makes it convenient for people who travel frequently. Since my stay in Seattle was a short one, I had to ship it back and I have to admit, it was a real piece of cake. I actually carried the box a few blocks to a fedex center. Besides it costs about 30% less than shipping full sized bikes.
  7. Flat tire? Just call an Uber: My biggest worry of riding a bike is the horror of being stranded in the middle of no where with a flat tire. Of course as you gain more experience you can learn how to fix a flat tire, and other maintenance. But that means you also have to carry tools all the time. With a folding bike, you just call an uber (or Lyft or whatever) and load it in the trunk and ride home. The same goes with taking your bike to a bike shop. You neither have to buy a car nor a bike rack. 
  8. Bike Fitting! What is that?: Folding bikes are one size fits all, and most are highly adjustable to be able to fit anyone's body proportion.
Well, folding bikes are not without their problems. In my experience riding my Dahon I found these problems,
  • The biggest gripe is the ride quality. The smaller wheels means you have to be extra careful going over bumps. Although, there are expensive 2 inch tires (Big Apples) that claim smoother rides, I am yet to try them out. 
  • Lack of momentum is also a big problem especially on longer rides. What this means is you can get off to a quick start with the small wheels but sustaining speeds over 15mph requires significantly more effort than a full-sized bike.
  • They are also expensive and a decent one can cost over $400 and good ones  go from $800 upwards to 2k. The cheaper ones are bulky, dont fold up well and dont have the right gearing. 
  • Also as far as I know you cannot easily attach child carriers to folding bikes. I tried finding one for my one year old daughter but it looks like only trailers are recommended with folding bikes. Although a few rear carriers can fit folding bikes, it often compromises maneuverability and balance. I found the front mounted carriers safer and comfortable. But that is only available with Bromptons (and is super expensive).
  • My folding bike needed frequent (every 2 weeks) tightening of the frame and handle bar hinges. This, although is a two minute job can be annoying in the beginning because you could end up over tightening. Also, as a result of these hinges, the frame may not feel as sturdy especially when riding steep hills.
  • Ironically, most folding bikes are actually heavier than similar specced full sized bikes. This is partly because the frame of folding bikes are made sturdier to withstand the stress caused by the folding hinge.

Overall I think a folding bike can never replace a full sized bike (unless you get Brompton or other expensive ones), but they are certainly ideal for quick errands, short commutes (< 5 miles) and multi-modal commutes in cities.

Thursday, 17 March 2016

3MT Experience

Its been a couple of years since I wrote something here. Last time I quipped about how I should write often and not only when there is something "eventful". Well, there have been several eventful things in the last two years and I did not write anything about them either. So, no excuses this time for not writing. I just got to make it a point to write something, which may or may not be interesting to you.

Speaking of interesting, there is one thing that is got to be interesting to almost anyone and that is a nice 3 Minute Thesis talk or a 3MT talk. This is a competition for Grad students to tell explain their thesis or research statement in under 3 minutes. It should also be explained such that even a lay person should be able to understand. So, absolutely no jargons, technical terms and definitely no mathematical equations. Yet, the idea is to not dumb down your research or trivialize it. Here is a good  example - https://www.youtube.com/watch?v=SI8XOGubJyY

So, I competed in one of the preliminary rounds at CMU, although I did not make it to the finals, it was a good experience. First, the preparation for the talk itself was a great exercise to sort of see where my research stands and what its implications were. Second, trying to explain it in extremely lay terms was super challenging, for example I could not use words, which were otherwise considered commonplace in my domain such as open-source, Github, Bug reports, etc. So with all this challenges, I spent about 4 days preparing for the talk and after two practice talks and a couple of revisions later I was here presenting in front of the judges. Here is a short transcript of my talk, if you read it through quickly it should take less than 2 minutes. Btw, you are allowed to have one static slide, following is a snapshot of my slide followed by the content of the talk. Enjoy!




Imagine you are a car manufacturer and the different components that you require to build your car  are available for free and in unlimited quantities. And  not just that, they also  come in hundreds of different shapes, sizes, and colors  for you to choose from. So, Would you then design and build your own components or just use one that is already available for free?

This is the exactly what building a software product these days looks like.  For example, a software product such as a word processor may use several freely available components such as a spell checker or a component to say, format text. However, lets say there is a strange problem in the spell checker that causes the word processor to shutdown after every hundred spell checks in after every hundred spell checks. So now to resolve this problem the members of this word processor  have to coordinate with the members of the spell checker. And the costs they might incur in the process are called coordination costs.

So now, the question is should even we care about these coordination costs? The answer is we don’t know yet.  Because a) we do not know   how to measure these costs, b) we dont know how wide spread these costs are and c) we dont know what factors drive these costs. and so my research aims to answer these three questions.

So, In the first part of my study i looked at discussions in online forums among members of a particular software product.

I found that about 20% of problems that appeared in these discussions were  coordination problems,  which were significantly higher than what we had previously thought of. I also found that the time taken to resolve these problems and the number of people involved in a set of discussions were good measures of the coordination costs incurred in this process. So In the second part, I scaled my study to a large number of discussions from different software products and found that the coordination problems were significantly expensive  than other types of problems because they take about 26% longer to resolve, and require about 30% more members.

So in the third part of my study I plan to identify the specific factors that increase or decrease these coordination costs and build models to quantify the effect of each factor.

Finally, I would like to show that the implications of my research go beyond software development, such as in healthcare where certain components of prosthetics can be replaced by simply downloading a design of the component from a website and building them at home using a 3D printer. However, prosthetic owners could incur similar coordination costs from using these components. Therefore, I plan to show that my research can also be used to study coordination costs in these other types of settings.

Sunday, 12 January 2014

Unit conversions for human calculators

In my last post I quipped about how difficult it was to get used to get used to the WMUs (Weird Measurement Units) here in the US. Well, as the winter sets in, as so does the curiosity to check the weather every time I step out. Back in my country and in UK, temperatures are reported in Degree Celsius, however, every one here seems to speak the Farenheit language. Most apps and online weather channels do provide both formats, but it gets tricky when you are talking to someone or listening to the radio on a bus. The other day, temperature read 5 degree Farenheit, but no one mentions the F at the end of the number and for someone like me it really gets difficult to realize how cold the weather is without actually converting to Celsius. In this case it was a shivering 15 degree below freezing.

So, I wanted a quick and easy way to make these conversions, not having to pull up a calculator every time. Here it goes, this is an approximate conversion and has an 'acceptable' error. The actual from F to C is (F-32)*5/9. My approximation is simple, subtract 30 from F and divide the result by 2 to get the Celsius value. In other words, just do (F-30)/2 to get C. The trick works because you are increasing both numerator and the denominator to make the approximation. Lets take a few examples and see what the error would look like. For a temperature of 70F, the actual conversion would give 21.1 C, whereas this quick method will give 20 C, which is fairly close to get a sense of what the weather is like. The error is higher for lower values but still within reasonable limits. For example for 5F the actual conversion gives -15 C whereas the approximation yields -12.5 C. The reason why I call this approximation technique acceptable is for two reasons, one, we do not need an accurate values of temperature to know how the weather is like, we don't see much difference in the way we will dress up if the weather was say 12 or 15 degree Celsius. Second the range of temperature readings across all weather conditions is fairly small, at worst from -30 F to 110 F.

It does not stop there, for me to make sense of most things, I needed to employ such techniques to other types of measurements. The most prominent one was to weigh stuff in pounds instead of kilograms. I did not take this too seriously since I would always just assume that one kg is almost twice as heavy as one pound. However, this naive approach does not always work very well, it works fine for stuff like groceries, but its highly error prone for something like weighing yourself or knowing how much you have been lifting at the gym in lifting weights. For example if someone weighed 154 pounds then according to my naive approach that person should weigh 77 Kilograms but the correct conversion would give about 70 Kilograms. This is a huge difference if I have to interpret how much someone weighs.

So to overcome this here is a simple technique. The error is because we are over estimating and need a negative correction. So after we divide the value in pounds by 2, we subtract the resulting value by one tenth of the resulting value. So in the above example, we first divide 154 by 2 which gives 77 and then subtract 7.7 (approximate to 8) from 77 which gives 69. This has been a useful technique especially when lifting weights in the gym. Since all my life I have been used to seeing plates and dumbbells in kilograms, it made me difficult to estimate how much weight I could lift.

Things are much better when it comes to the most common measuring unit in grocery stores, what I call the 'omnipresent ounce'. The correct conversion of ounce to grams is my multiplying the value with 28.3, which is almost impossible for a human calculator. Hence, I have the following approximation. Multiply the value in ounce by 30 and subtract the resulting value G by one tenth (T) of the resulting value. To getter a better approximation, add half of the computed one tenth (T/2) to G. Instead of the two step process, you could just subtract by one twentieth of G. For example if we have to convert 5 ounces in grams, the correct conversion gives 142 grams. To convert this using the above technique first, multiply 5 by 30 which gives 150. We next have to find one twentieth of 150, to do this, we first compute one tenth of 150 which is 15. One twentieth is half of this computed value which gives 7.5. Now subtract 7.5 from 150 which gives 142.5, very close to the actual value. The approximation really works extremely well since in practice the maximum of value of an item in ounces may never exceed say 64 ounces. This is where the significance of measuring in ounce becomes relevant, because it is extremely convenient to use ounce for items that are less than a pound and not more than a few pounds. Every pound has exactly 16 ounces and therefore makes it convenient to use ounce to get a fine grained measure without having to use real numbers.

There are a few more like Gallons to liters and miles to kilometers, while these conversions may not have as much significance in everyday use, nevertheless, they are also fairly straightforward to make approximate calculations. A gallon can be easily converted to liters by just multiplying by 4, and one mile is approximately one and a half times a kilometer. I have personally not see the need to make these conversions since it is very easy to get accustomed to these units that the ones mentioned above.

I anticipated this to be a very short blog, but it has turned out to be, well, not so short and hopefully not so boring. It makes me wonder, why is it that no one has blogged about this, since I did observe fair bit of cultural difference in the way people communicated in their own language of measurement.