Learning how to code

1 December 2016

Background

At some point after starting my first job, I'd made up my mind that I wanted to eventually become an internet entrepreneur. And to do that, I realized I needed to develop a variety of skills such as Marketing, Product Management, Software Development, Sales, etc.

And I found my lack of programming skills to be highly unsettling. Knowing how to code is, in my opinion, amongst the most important skillsets to have when it comes to starting a tech company.

Sure, you could hire engineers to develop your product. But that's playing the game of entrepreneurship on difficult mode. Because now you need capital and technical recruitment skills and the ability to attract an engineer to work with you at an early stage - all of which are hard. It was clear to me that building a company would be drastically harder if I couldn't develop the product myself.

It was around this time I read a post by Derek Sivers where he says this:

He taught me that “the standard pace is for chumps” — that the system is designed so anyone can keep up. If you’re more driven than most people, you can do way more than anyone expects. And this principle applies to all of life, not just school.

So I quit my job in CouponDunia in 2016 after telling the Sameer Parwani (the CEO of CouponDunia at that time) that I was clear on what was next for me.

Building Twittermation

I decided to build an app called Twittermation which was a social media automation tool. The app's premise was simple. It allowed users to grow their Twitter audience and engagement by:

  1. Automatically following other Twitter users that are likely to follow them back
  2. Then unfollowing users who don't follow-back within a specified time frame so that the follower:following ratio remains decent.

It had roughly ~1000 Twitter users use it at the point I decided to shutter it.

Technologies used for Twittermation: jQuery, Handlebar. Backend mostly in Node.js with some PHP. Redis for caching, Resque for async job processing, Postgres. Deployed on AWS.

What building Twittermation taught me

The 9 months were life changing for me. I'd locked myself up in my bedroom and did nothing but eat, sleep and code.

I learnt how to ask good questions on Stack Overflow. Learnt to look at the same problem from multiple angles. Learnt how to go deep into the source code of a library and debug from there. Learnt that you can "print statement" your way out of most bugs. I learnt to use every available resource to me to help me get over a block. I watched countless youtube videos, read a ton of articles on various software development topics, learn about threads and processes. Learnt the hard way about memory leaks. Learnt how I need to keep my ec2 instance's port open when first spinning it up - which doesn't happen by default.

Sometimes you are stuck in a total rut and you have some of your darkest moments. And it's not one of those problems where you can easily phrase a Stack Overflow question and hope someone more experienced will help you get unstuck. At times, I was so stuck and clueless that I didn't even know how to begin to articulate my question. Which added to the frustration. There was so much context I had to share to someone I wanted to approach for help. And I also began to run out of people to seek help from. How much help could I possibly continue to take from the same 4 developers I knew from CouponDunia times. I even considered paying for help. But it was too expensive given that I was running on my meagre savings.

And in such helpless moments, I found it best to nap for 2 hours, wake up and try all over again and see if there are angles I missed out.

Eventually though, I'd get myself unstuck out of almost every situation. Sometimes because some very kind stranger would bail me out on Stack Overflow. But most times I'd just eventually figure it out.

A pattern I noticed after having solving such issues was that I'd find myself thinking - "Wow, how did I just spend 20 hours stuck on this when it should have been quite obvious what the issue was from the start"

Things that helped me stay motivated:

  1. Stakes were high because I left a good job to do this. And I was low on low cash reserves. I told a select group of people details about my plans. This made me accountable. I couldn't give up halfway or my credibility would go down the drain. I did not want to be the guy who could not finish what he started. Plus it would make it much header for me to look for my next job if I couldn't demonstrate what I achieved in my break.
  2. Know why you are doing this. Have you been successfully indoctrinated by peers in your industry proclaiming engineers as king? "software is eating the world" etc. And therefore you developed an inferiority complex? Well for me, on one hand, learning how to code was my stepping stone to Entrepreneurship. But on a deeper level, I feared being mediocre. I wanted to step up my game.
  3. Have a specific plan. Spend the first few days coming up with an idea of what to build. In my case I wanted to learn programming in the context of web development. The idea for the app doesn't have to something never-seen-before or with a huge business potential. It has to be simple and most importantly, contribute to your goal: to learn.
  4. Writing out specifications. I made detailed specifications for the app. From front end. My previous boss once gave me feedback I have a tendency to keep everything in my head and that I should write down specifications for every smallest thing. Good advice. Writing your thoughts down gives clarity of what you want to achieve.
  5. Choose a language that is mature and has a good community. Python, Ruby or Javascript. It will be much easier to find answers to the questions you have. After consideration, I went with javascript because I could use it for client and server-side programming + A lot of startups, (at the time at least?), used node.js in their stack.
  6. I also picked Twittermation as the idea because the Twitter APIs were known to be easy to work with.

Advice to others learning how to code without a formal software engineering education

  • [Adding this point in 2023, 7 years after I first wrote this article] I didnt have access to this back in 2016. But you definitely want to get access to gpt-4 and ask it questions when you are stuck.
  • Be structured about how you go about your learning process. Have a google doc outlining a plan for yourself. Make your own curriculum. And follow it.
  • Start with much smaller goals. An example of a smaller goal would be something like this "When i visit sidgopi.com, i want the page to have display 1 line saying 'welcome to my website: you last visited 2 days, 2 hours ago'". For a beginner, this itself would take several days. Buying the domain name, updating DNS records, setting up your server, running an app inside the server, storing and reading from cookies, and so on.
  • Learn command line basics. There are 30 or so commands like cd, pwd, ls, mv, rm, and so on where you memorize them and your learning experience will be a lot less frustrating. A lot of my early days were spent breaking my head while configuring and navigating through remote servers via the command line.
  • A good way to start learning about front end development is to poke around in the dev console while browsing your favourite sites. Modify the CSS properties and see how it changes. Look into greasemonkey, bookmarklets, etc to modify scripts to see how things work.
  • As you get more comfortable, copy all the js,css,html files onto your local machine. Run your local copy on the browser. Now you can edit more of the js, css, html files
  • Especially when you are a beginner and you get stuck on things which you know are seemlingly simple, you feel completely useless and think you should give up and go back to living your non-engineer life. Don't give up and soldier on.
  • When you hit rock bottom morale, close your laptop and go for a walk. Watch a scene from Narcos. Draw inspiration from Pablito's never say die attitude. You are usually closer to the solution than you think you are.
  • AWS give you a free 1 year trial period where you can set use a good number of their low config services for free. I used it for the EC2 instances.
  • Go in with the right mindset. When youre a non-engineer, you inspect the cookies file in your browser and you see a whole bunch of garbled text like this <asdiuj43923n9dn34ygn394jr98jxcj9>. Do not get intimidated by it. These things, (like how a server sets cookies on a user's browser) are mostly handled automatically by something called a framework. As a programmer these days, you are mostly abstracted away from a lot of the complexities. All you really need to know is the general concept, just trust that implementing it will be relatively easy.
  • Put a lot of comments in your code. It will feel obvious why youre doing what you're doing at the point of doing it, but few days/weeks down the road when you come back to it, your comments could help ease the context switch.

Learn these concepts

Read up on what these terms mean before you jump-in to actual hands on coding. I took a somewhat breadth first approach. Before I could write a single line of code, I could explain what a cookie is or what the significance of the JS/CSS/HTML trifecta is. Consider the list below a starter, you need to know somewhere around ~100 concepts before you move onto actually writing meaningful code.

  • Level 1: Choose a scripting language {PHP, Python, Javscript, Ruby}. Using what you choose, learn conditional loops, etc. Learn about nesting. Pass the fizzbuzz<link> test, so on. Take introductory programming courses in platforms like Coursera, Treehouse, etc.
  • Level 2: Learn HTML, how an html file is organized. go through this list of 30 CSS you must know. http://www.everyuseful.com/programming/102-the-30-css-selectors-you-must-memorize
  • Level 3: High level data structures: arrays, lists, dictionaries, etc. How do you create functions? How do you create classes? How to instantiate an object of a class,
  • Level 4: URL, http, api, json, cookies, headers, in memory, persistent memory, sql, nosql
  • Level 5: how to debug, what is a stack trace, static vs dynamic languages, MVC architecture, using front-end frame works vs not using, modular vs monolithic programming, Command line scripting, What is ssh and how to ssh into your ec2 instance. Implementing asynchronous background task queues using Redis.
  • Level 6: What exactly is data? What language does the machine understand? How does what you write in javascript get interpreted by the machine? By machine what do we refer to? Why is silicon valley called silicon valley? What is a server? What is a network? What does an ISP do? How exactly is data passed from one computer to another? Through wireless signals? Through physical cables? What are datacentres? Difference between having physical servers in your room vs using a cloud hosting provider. What is a CDN?
  • Level 7: What is Continuous Deployment, unit testing, integration testing, source control, load balancing, db master-slave replication, sharding, (and the whole set of ideas related to scalability and distributed computing)