Arbitrary Reasons

Very often I see people with some arbitrary conceptions. May it be the language war, or adaption to a new technology. It does make me wonder why people behave this way. I have been trying to figure this out for quite some time now, and, thus far, I have been able to make some observations based on the interactions I have had.

The farmville theory

There was a time when people were crazy about farmville, my facebook inbox was literally filled with farmville requests. It was so bad that I had to eventually block all the notifications from that application. However, this incident sparked an interest on why people are so crazy about farmville. One theory is, farmville could be sending notification without user’s knowledge. Other theory and the more interesting one, is people want to show off their progress in farmville to their friends.

Dissecting this situation led me to two conclusions. First, people feel just because they spend time in some activity, it must be important. As a consequence, when someone puts money in farmville (an arbitrary in-app purchase), the feeling of importance boosts up. Second, self satisfaction is not enough. As humans are community creatures, they need appreciation from peers.

False pattern recognition

This one turns out to be one of the classic mistakes people make. Our brains are wired up to make sense out of incomplete and partial data. Pattern recognition is a two way sword, it is the prime reason why humans are at top in foodchain, but false pattern recognition always takes us to a de-tour from facts and real world truth.

This ultimately leads to flawed reasoning. This situation could be related to certain situations in technical world, such as yo! raising a funding of $1M. Nothing personal in this case, but it is funny when folks come up with arbitrary reasons to support their work.

I am a big of the awesome series cosmos. I would like to quote three rules it puts forth in the very first episode.

  1. Test ideas by experiment, take the ones that pass, reject the ones that don’t
  2. Take the evidence wherever it leads, and
  3. Question everything.

I feel reasoning should be based on tangible evidence. By following above rules, there is a high chance you might end with good reasoning!


Blogger to Octopress

Recently I shifted my blog from blogger to octopress. In this post I’ll try and cover the reasons for this shift, and the process followed.

Blogger world

It is ridiculously easy to set up your blog with blogger. Just a few clicks and your blog is up and running. Blogger also allows you to set up a custom domain without much hastle. And ofcourse with google backing it up, blogger has awesome support for SEO and analytics through google analytics.

Running into problems with blogger

Blogger is simple and fun to get started with, but whenever you want do something out of the line, like embed a piece of code in your blog, it becomes insanely difficult. Many of the folks who write blogs started from blogger and then moved on to more sophisticated platforms such as wordpress. For me, blogger was working fine but there were some really annoying issues. These are the primary ones:

  1. No markdown support
  2. Getting code in your blog could be ugly
  3. WYSIWG editor is a big fat lie
  4. Very limited templates - I had to write CSS for almost everything!
  5. Doesn’t have an hacker workflow - sublime, git, markdown, cli

Once I was fed up with blogger, I started searching for the next blogging platform. Wordpress was the first choice. With the wide variety of plugins and themes wordpress is really tempting, I even found a plugin for writing blogs in markdown with wordpress. Then I downloaded basic installtion of wordpress, and got it running with local wamp. Now the next big question was of deployment. I could setup an account on wordpress.com, but thats not something I wanted. Dependency on mysql for a blogging platform seemed far-fetched to me. Also, I ran into various issues while deploying wordpress to heroku: heroku supports only PostgreSQL. It’s a bit tricky to get wordpress up and running. I also tried DocPad, ghost and hexo. But couldn’t really relate to any of them.

Octopress

While working on github pages for one my open source projects, I wondered how github creates these pages from markdown ? I immediately started looking if they have put it open source. I realized github pages are powered by jekyll. jekyll is nice, but you need a layer of abstraction on top of this to be productive. Then after a bit of googling, I stubled upon octopress. Which runs on jekyll and is very easy to use. More importantly, it supports the workflow I was looking for!

Getting started with octopress

Octopress requires ruby for compiling your site into static HTML pages. I’m not ruby wizard, words like rake, nokogiri give me an headache. Octopress install page is fairly simple, and easy to understand. One should follow all those instructions piously. I’m serious, don’t miss out a single one, else you’ll be doomed with callstacks of ruby!

Gotcha: I installed ruby 2.0 x64 edition, on the site it says 1.9.3 or greater. But octopress just blew up when I tried compiling it on ruby 2.0. So a word of advice, stick with 1.9.3, don’t try to get fancy if you don’t know ruby.

Porting old blogs to octopress

First, you need to export the blogger information, it should give you an xml file. You should find this option in settings tab on the left side. this gist has the code for converting that ugly xml to octopress friendly blog files.

Gotcha: This gist requires a ruby gem nokogiri (ruby-gems is the package manager for ruby). To install nokogiri you have to run

gem install nokogiri
//If this doesn't work in your case try
rb gem install nokogiri --pre

I’m not sure what it does, but this worked for me!

Deploying to github pages and adding a custom domain

One of sweetest feature of octopress is no run time dependency. End output is just plain HTML, CSS, JS and could be deployed on any static file server. Github pages provide an excellent option, I already had a github account so I followed steps from this link.

Gotcha: Deploying to username.github.io will mess up your project pages. Deploy to gh-pages branch of a seperate repo in case you are using github pages.

Setting up a custom domain was easy once I figured out what to do. I deployed octopress to a seperate repository. So I had to add a CNAME file with my domain name in it, e.g

CNAME
chinmaymk.com

Then I had to edit the DNS entry for @ to 204.232.175.78 from my godaddy account. Note: It could take upto 48 hours to activate, in my case it kicked off within a couple of hours.

Adding disquss comments

Octopress does not have native support for comments, to get comments in your blog you have to setup an account with disquss. It will ask you a couple of questions such as what’s your domain name and site name etc. Finish those and in _config.yml add your disquss_short_name. Run rake generate and disquss comments should enabled.

Gotcha: There’s a flag in every post named comments: you have to set it to true.

And that was it! after a whole night dedicated to get this working, I finally had octopress up and running.


Api First Development

Change is the only constant.

In today’s world, the word “computation” is being used in systems other than computers more frequently. “Internet of things” is coming along nicely. This imposes some changes in traditional concept of software.

In the evolution of web application, MVC pattern was definitely a milestone. It allowed software engineers to successfully de-couple business logic from UI dependencies and it has been the defacto of writing good, robust web applications. However, with the pace of changes happening today we, as software engineers, need to re-think this model.

What’s MVC anyway ?

MVC stands for model-view-controller, as the names suggest, model represents business objects in you application. View is the HTML used to interact with your application and Controller is the glue that holds these two together. If we take a bird’s eye look at this architectural pattern. We can easily think of view-layer as a client interface, which wraps up business logic and computation provided by your application.

It’s not just one view now!

Today, with increasing popularity of smart-phones and BYOD, end users prefer doing their computation from mobile devices - tables, smart-phones etc. Now, to enable users use your application via multiple platforms. It is not sufficient to design application in traditional MVC pattern. Ofcourse you can use responsive web design to share one view between many clients, but it doesn’t have that native look and feel, more importantly speed that native apps bring in picture.

HTML5 is the thing of ‘future’!

HTML5 might seem promising, but it’s just not there yet. Due to poor support for JavaScript heavy applications, using HTML5/client side MVC will make your application insanely slow on some devices. Second option is to make native mobile apps and call APIs from it. So ultimately we’ll end up re-implementing some of the logic.

Enter API first

In order to solve this problem, first we need to take the view-layer out from the picture and just focus on the business logic of application. Next think about what operations user can perform with your application, could be data manipulations, or some other form of computation. Wrap this operation in a URL and you have an API! So what changed in this approach ? We focused on the logic first and not the view, doing so we de-coupled our web application one step further. Now any view can be plugged in or out very easily.

Best practices to follow

Understanding REST principles is of utmost importance when designing APIs. There are some common considerations while following API first development. Here’s a list of few

  1. Keep API structure meaningful
  2. Keep APIs stateless
  3. Use HTTP verbs to fullest
  4. Document your APIs - its really important!

Conclusion

API first development allows you to highly reuse the code, helps you implement SOA, and boost overall time required for development.

Further reading


a Thousand Thoughts


The expression “a thousand thoughts running in my head” is very common to hear. We even experience it often when under extreme stress, may it be exams, an important meeting or any other crucial event in life. Eyes start jumbling, vision sometimes becomes blur, and typically before finishing the first thought, the next one pops up!

Now comes the interesting question, can we make sense out of it ? I believe we can. We can relate this situation to the concept of multi threading. Brain is a phenomenal organ, the processing capacity of brain is just unmatched. But considering pattern of thoughts that emerge, one can think of this situation as in when processor is computing multiple threads simultaneously. So how does the processor make sense out of all these threads ? answer would be “by maintaining states!”

So how one can maintain states of his thoughts ? Personally, I prefer following these steps:

1. Get a writing tool
Let it be rough pen and paper, notes application in smart phone or a whiteboard with markers! Its very important to achieve this first step as soon as possible. Cause brain is not going to stop! So get yourself something to write to on.

2. Starting jotting down high level ideas
The best way to identify high level ideas is by trying to remember everything flashed in your mind in last 5-10 minutes. Anything that pops up within first 40-50 seconds are the ones you’re looking for! Remember: every minute is crucial. These high level thoughts will be headlines. Leave nice and large blank space below each of these.

3. Take a look at each one of them individually and try to figure out details!
Once high level thoughts are sorted out, it’s time to think about details, think about examples, possible implications, and any other detail you might feel important. Remember: don’t forget to note down these! You can abbreviate heavily if you want. Just make sure you would understand it later.

4. Try to link the them
There’s a high probability that the thoughts will be interrelated, by one or the other way. Once all the details are in front of you, they will help take better decisions. 

5. Identify action items
Once you have performed all the steps above, think in terms of identifying short term action items for you. By identifying action items, you can plan better!
Thinking is not enough, one must act
In my experience, some of the coolest ideas have come up while I was under stress, and the question how do I make sense out of it was pending since many days. Finally, I’ve come up with a solution that works in my case, and not only following this process gives me pleasure of being productive it also helps reduce the stress! See if helps you too!

Where the Puck Is Going to Be ?


Since the dawn of mankind, the question: now what ?,  has been troubling us a lot. So you have finished a task, achieved a milestone, accomplished a goal, now what ? Do you stop there or thrive for more ?

This question relates to progress of software projects in a much more philosophical way. If we consider the typical software development life cycle, it always starts with a finite set of problems. Starting from todo list applications to complex solutions, the beginning is always from a finite set of problems which goes on evolving as you develop. And at each step, creator of software has to take a moment and think where all of this is going ? It is safe to assume that processes like agile, iterative and incremental software development have emerged from the same phenomena. To give software creators more room in order to analyse how software is taking shape.


An awesome quote by Wayne Gretzky: I skate to where the puck is going to be, not where it has been. In software world, this quote tells us how to comprehend the question of now what. For example, you just came up with a great idea, but someone else has already implemented it! what do you do ? do you stop there ? or try to figure out how to make it better ? If you’re thinking in this direction, you’re already on right track! Figuring out how to make the world a better place to live in, always leads to something interesting.


Its insanely important to keep asking for the next big thing, the next mind blowing feature you’re going to deliver, in this exact process lies the root of innovation. Lot of folks talk about innovation, but none of them tell you the crux of it! Innovation isn’t necessarily something out of the box or something you’ve never seen before, but a simple twist in our mundane life. Innovation is a lifestyle, not a goal, it’s a mindset one has to live in.


Software and innovation have to be intertwined together. While writing software, developer always has to keep thinking about how to make his solution more appealing, more enchanted. The magic touch his solution is going provide to this world. And all of this comes from the question we started with, now what ?