Tuesday, September 22, 2015

An idea for Grofers

I just got an order delivered from Grofers. It was the second time that I used the service and I already know what I like about it the most. It makes me feel less guilty.

No, I am not the fat, lazy husband that they depict in their ads, feeling guilty about not contributing to the household work. I am an individual who is conscious about the excessive use (or should I say abuse) of plastic bags in our daily lives.

I generally try to avoid using plastic bags as much as I can and am mindful of when I end up asking the shop for one. Most of the time, it when buying groceries that I end up asking for a plastic bag. I have thought about why this happens and it mostly happens because most of my grocery shopping is unplanned spur of the moment thing, which is why I am not always carrying my own bag when I end up at the local kirana store and end up asking for one.

With Grofers, the spur of the moment shopping happens on the app rather than going to the store. And they deliver the goods in nice environment friendly bags. So when the bread and eggs they delivered today did not come in a plastic bag, I was happy. The one use case, the spur of the moment grocery shopping, where I invariably ended up using plastic bags, now had an alternative user experience where I could get what I wanted within a reasonable time without having to use plastic bags. I used the term user experience because from a design perspective buying from an app should be as friction less as buying from a grocery store.

However, as I emptied the environment friendly Grofers bags, I realized that I already had the couple of bags stowed away from the last time that I ordered and that I really did not need the bags from the second order. It made me wonder, why does Grofer not take back the bags and recycle/re use them. I mean the delivery guy is right there and I could have handed it to him. Environment friendly is not simply less plastics but also recycle and reuse. Perhaps, Grofers could hand out reward points to customers who return bags and thus encourage environment friendly behavior.


Monday, September 7, 2015

A Developer Switches from Windows to LAMP Part 3: Project Dagobah

The best way to learn any new language/platform/library etc. is to get your hands dirty playing with it. Build something useful , not merely a todo list, but something similar which has a utility, yet does not have a large scope in terms of use cases. But do it end to end: i.e. don't just have a working version on your development machine, deploy it to a server and make it readily available to the whole world. 

In April, from among the many ideas that I had, I chose to build a tool which would help you number your tweet storms. Even this phrase "number your tweet storms" is a result of multiple revisions. I did not even know what a tweet storm was back in April! Of course, there was a massive and a much needed break from mid April through May as I went back home for my sister's wedding and then went on a trek to the Himalayas. So I really started work on this in mid June after I was back in Bangalore. I will write in more detail about how I went about developing it, but right now I want to announce the first release of TweetSmart. As of today, it is only a web application. But very soon I hope to have built it into a chrome extension as well as an android app. 

This post, however, was not meant just for the announcement of the release of the app. It is meant to be a high level recap of my experience developing and deploying my first app on Linux, or to be more specific, Ubuntu. 

I originally envisioned TweetSmart as only a Chrome extension. Thus I started with Getting Started with Chrome Extension Development. Building a simple Hello World extension was easy. But I now wanted to build the TweetSmart compose box and that meant a a lot of javascript code. An immediate choice I had to make was to choose a javascript framework such as Angularjs, Emberjs etc. to build this. Having a bit of experience with Angularjs I was inclined to choose Ember but had heard a lot of good things about React. I decided to spend sometime familiarizing myself with React and understand its benefits. In the process I learnt about Flux as well. The uni-directional data flow in Flux architecture made sense to me. I also read many posts by people who were astonished by how much cleaner their code was due to using React and Flux. So I decided to proceed with Flux+React and not get bogged down by trying to make the perfect choice of framework. 

Till now, the choice of Flux+React has nothing to do with developing on Linux. I could very well have developed this extension on a Windows machine while using React+Flux. However, the first place that the difference becomes apparent is the choice of the IDE. On Windows, I would be using Visual Studio. On Ubuntu, I had started to learn Vim and thought the terminal and vim are going to be all that I need to code. However, a very important aim while coding is to be fast - i.e. use tools and extensions for productivity. E.g. you can significantly reduce the number of keystrokes in Visual Studio by using code-snippets for common code constructs such as if-else, function(){} etc. I am sure expert vim users would know a way to do that in Vim, but as a newbie, it was taking me time. 

As it is important to ship the MVP as soon as possible,  I looked at options where the learning curve was slightly less. Interestingly, Microsoft had just come out with Code, a new code editor for all platforms, but since it was pretty new on the block I looked at other options - Atom from Github and Brackets from Adobe. Both of them are very similar but it seemed Brackets had a more active plugin development community with much more plugins, which made me select Brackets. 

I felt at home with Brackets and quickly started adding code snippets which I would use frequently, such as rcc for React.createClass. I also installed plugins such as Emmet and Beautify to speed up coding. However, as I later realized, since I was using React, the Emmet plugin did not prove to be very useful there.

Next, I wanted to set up a local web server and chose Apache over nginx for some random reason I don't even remember. However later on, as I was building an API using expressjs, I had to use node behind an nginx server and thus I ended up using nginx and removed apache. I did this on my local system as well as my production server, a micro ubuntu instance running on AWS. It was a nice change from using the Inetmgr to configure the IIS, though not without issues. 

As I realized that to integrate with twitter I would have to build my own api, the question of which framework/language to use came up. The options in my mind were ruby with sinatra and python with flask. But I had a conversation with a friend who suggested to go with node and expressjs. And I happy that I did. 

So that is a high level recap of some of the decisions that were made when using ubuntu/linux. These might seem very trivial to many, but for a person who has been coding using the IIS, Windows, ASP.NET and Visual Studio, these were new choices which took a bit of time to research and arrive at a decision. 

I am definitely now more at home using ubuntu, desktop as well as server. I have much more confidence that I can quickly get up to speed with a team working on a variant of the LAMP stack.  I can only get better from here. 

Upwards and onwards. 


When learning something new

As a developer with some experience, many questions come up in my mind when learning something new. e.g. How do I write tests and automate builds? What are the shortcuts I can use to speed up my development? What are some expert level tricks that I can learn to churn out code faster?

However, it is important to realize that all of these things cannot be learnt in the first attempt itself. The goal should be to get the MVP out and not worry too much about learning everything there is to learn about the new platform/technology. That is because often, such information is not compiled and presented in one spot but is present at various blog posts, stackoverflow questions, google group threads etc. and one cannot expect to learn many of the tricks of the trade right at the beginning. It takes time and practise to become a master.

However, by not shipping the MVP a disappointing sense of lack of accomplishment/results starts to set in. This is very dangerous as this sometimes leads one to abandon the pursuit one had undertaken. And all the mighty tricks that one tried to learn on the way become useless and eventually forgotten, as one discovers when trying to take another shot at the failed project.

So, the right balance between learning and shipping has to be kept. Of course, I am assuming that one is working hard and that lack of progress in learning or shipping is not because of lack of hard work. But if you are in a dilemma, always err on the side of shipping. The motivation and sense of accomplishment that one gets after shipping can help speed up the process of learning as well.