Design for People

As a software engineer one has to make design decisions. I always ask my fellow engineers to keep the people factor in mind. The decision should follow the principle of least astonishment(POLA). To explain the POLA I am going to take a real world example. It is easy to remember real world examples better.

In the recent times I have accumulated lot of mobile devices. Out of them I am going to take only the following 3 devices

  • Nexus 7
  • Samsung Galaxy s3
  • Apple ipad

I myself and my family members use them interchangeably. One of the major use case is to adjust the volume. After using these devices I know that the volume button is somewhere in the side. I try to use the muscle memory, search for it and adjust the volume. But the experience differ between the devices. I will list them in the order of worst to best.

  • Nexus 7 – This the worst one among all the three. The volume and power button are placed on the right hand side. I tend to push the power button instead of the volume button and then press the power button again and get back to volume control. For a human being its hard to remember the exact location of the button unless otherwise one is using the same device for a long time.
  • Samsung Galaxy 3 – In GS3 the volume buttons are on the left hand side and the power button is on the right hand side. Even though this looks better, again correctly remembering the type of button and left/right side is hard. I tend to do the same thing here too. I press the volume button and course correct later.
  • Apple ipad – Here the volume buttons are placed on the right hand side. The power button is placed on the top. There are couple of advantages here.
    • In the above 2 cases I actually cross checked the devices for correctness of my post. In case of ipad it was not needed. I can remember top & sides. But its not easy to remember whats on left & right.
    • I always end up pressing the volume button and never enter an alternate operation by mistake.
    • This provides the best experience for me.

Now the third case of ipad satisfies the principle of least astonishment. In the other 2 cases I intend to do something, but end up doing something else and then after a moment of surprise I course correct. Now if you are an engineer make sure the design decisions follow the principle of least astonishment. It definitely saves lot of time for your fellow engineer/human being.

To give an example from the software side guess what the following object represents

var d = new Date(2011,1,23);

Any one would make a guess that it represents 23 January 2011. But if you are programming in JavaScript then it represents 23 February 2011. While the date and year start from 1, the month start from 0. When I was programming in JavaScript the question I had was hours,minutes,seconds all start from 0. That is natural. But why does month start from a 0? That was my moment of surprise.

Hope you consider the people first when making the design decisions.

Learning Microsoft Azure

Introduction

Cloud computing is growing day by day. More and more business are adopting it. Being a software engineer one has to learn the recent technologies and be relevant in the days to come. So I decided to spend some time and learn Microsoft’s azure cloud computing. In this post I am going to list down the list of road blocks and how to cross that without violating the corporate security regulations

Pay per use

Learning cloud computing involves money. A valid credit card is needed. Once a credit card is registered azure makes a test transaction of $1. Then the subscription is setup.

Azure provides a one month free trial with $150 credit. But this is too short a time to try and learn the azure offerings. Initial set of months I did pay from my own pocket and learned the azure services. The bill was not huge but it is a pain.

MSDN Subscription

As a part of our regular software upgrade I received a visual studio 2012 with MSDN subscription. MSDN subscription is a programmers treasure box. There are so many things that are available as a part of the subscription. One among them is the $50 azure credit every month. If one is careful a lot can be learned with this small credit each month. Now I don’t spend my hard earned money but use this credit. Thanks to those folks at Microsoft and our procurement 🙂

Access Azure from Powershell

Azure has 2 management portals. They provide a nice UI for every management task.

And like me if you hate UI and like the command line then there are 2 offerings from Azure

  • Powershell cmdlets
  • Node.js based cross platform command line tools

Being a windows user and having power shell readily available, I installed the powershell cmdlets. But because of our proxy authentication I couldn’t access the azure service from these cmdlets. After some search I found a solution. Including the following line in powershell profile, makes powershell talk to the azure REST api through our proxy.

[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials

Programming for Azure

Azure SDK provides 2 emulators. So before deploying the program to Azure one can locally build and test with these emulators.

  • Azure compute emulator
  • Azure storage emulator

And at times when I had to access the azure service from a local program through our proxy authentication then the following trick similar to the powershell one works. Add the following block to the app.config

  <system.net>
    <defaultProxy useDefaultCredentials="true" />
  </system.net>

SSH is blocked

To feel the power of windows azure finally I reached the point when I had to create and use the virtual machines. Here again our proxy blocks both RDP & SSH for the security reasons. Without these protocols I cannot do anything with the virtual machines. I thought of solving this problem using the cloud itself and found a nice solution. After some searching around I found the awesome “shell in a box”  from google code. This exposes a shell through a web interface. It also supports https. Now this is how I have made my setup.

  • I have one small VM (Basic/A0) with shell in a box running at 443 (It is speaking https for security reason). This has to be setup onetime from outside office.
  • I start this machine using powershell and ssh into it using a browser.
  • From that VM I ssh into any other machine if needed. (yes the whole world is just a ssh away)
  • Once I am done I shut down this machine using powershell.

Keep an eye on the $$$

Last and important point is the money that is involved in learning cloud computing. Always do the following without fail or else all the free credit will be burnt soon and one has to wait for a month to continue the exciting journey.

  • Always keep a tab on the azure credit.
  • Based on the utilization it will be green or red.
  • Green means no need to worry. But in case if its red then the money in the subscription will not last for the entire month.
  • Always shutdown the VM/service instances that are not needed immediately (not at the end of the day).
  • If there is a need to preserve the IP keep the cloud service running and shutdown only the VM.
  • For some services like websites, database etc there is a free tier available. Use them instead of the paid tier.
  • Some services like redis cache are way too costly. Be careful with them.
  • And my rule of thumb is compute is always costlier than the storage.

I am still exploring the technologies. I hope this helps someone who wants to learn cloud computing…

–Ferose