Monday, 5 January 2015

Learning to code? I did it for 2 years – here’s what I learned

how does computer programming workI’ve never sworn so much in my entire life. I stared at a computer screen for hours, trying to fix a bug in my app. The cause of the error eluded me, nudging me into a cycle of angst, self-loathing, and keyboard smashing.


The cause turned out to be a typo in a file name.


There were also moments I felt invincible. Like when I wrote my first script and it ran successfully. Or when I deployed my first app to a server with the words “hello world.” Or the time I wrote my first crawler to populate a database. I felt like a god ordering little code minions to do my bidding.


Programming is a drug that made me come back for more despite the initial pain of the needle. And that sums up my two-year experience learning to code.


We made fun of engineers


Like many wannabe techies, I am captivated by the shiny world of Silicon Valley and the power that geeky moguls have.


It’s an amazing turn of events – not long ago I was part of a group that didn’t think too highly of engineers. I belonged to a female-dominated communications faculty in an engineering university. We rolled our eyes at engineers for lacking fashion sense or social skills, for being awkward around women, and for having poor grammar. Someone once remarked that I looked like an engineer – and I felt embarrassed.


This sounds stupid now, sure. But I was in college and unexposed to the real world. “Silicon Valley” meant nothing more than another distant location.


But here’s one thing about me you don’t know – I was once the president of the IT club in secondary school. I picked up HTML and flash, spent my free time playing Sim City 3000, and creating a website about the game. I always had a little bit of geek in me.


I didn’t take long to re-embrace that side of me again. The Social Network came out in my last year of university. I joined Singapore’s nascent startup scene as a tech reporter right after I graduated.


The Social Network made the tech industry cool and relatable to non-geeks.

The Social Network made the tech industry cool and relatable to non-geeks.



I was exposed to the everyone should learn to code craze that’s about to get crazier. Being a programmer has become cool, and I’d be lying if I didn’t fantasize about it.


The tables have toppled. Many of my college mates in communications school ended up joining internet companies or doing public relations for tech firms. Journalism is being disrupted by technology created by geeks we used to laugh at.


Fueling this learn-to-code movement is the fact that it’s never been easier to do so. The open source movement advanced to the point where help, resources, and documentation are just a Google search away.


The learn-to-code movement has become an industry, fueled by the fact that there’s a perpetual shortage of good engineers.


And so here we are in 2015. You may have set yourself a new year’s resolution to pick up programming. If so, this article is for you. I shared my personal history not out of narcissism (well, a little bit), but to illustrate a truism:


Your past determines your approach towards learning to code.


I picked up programming only in late 2012 – more than a year after I started my first job. That put me at a severe disadvantage if my goal was to become a career developer.


I would be competing against bright fresh grads who probably began programming when they were 12. Their salary expectations would be lower and they’d probably have less relationship commitments. I would have to change the trajectory of my life, delay meeting financial obligations, and chase after an alternate career path while facing short-term sacrifices and the lack of a guarantee that I would stick to it.


It all came down to this: I had already invested years of my life in a media industry career which was being disrupted but by no means dying. Further, I enjoyed what I was doing and wasn’t facing any quarter-life crisis. I didn’t have the financial means nor the incentive to throw my entire self into this new endeavor.


So here’s what happened: I learned to code in my free time and made sure that my hobby didn’t interfere with my day job. It’s tough sacrificing my free time, but it was the only way.


Before committing, understand your ultimate goals.


Learning to code may be entirely useless to help you reach your goals. Or it may prove indispensable.


You could be a student with only school work and social life to care about (and these are nothing compared to holding down a full-time job). Coding could open up more paths for you to, say, earn a million bucks by the time you’re 25.


Or suppose you’re a jaded young professional looking for a scenery change. You’ve accumulated enough savings to venture into something else. Programming could be your ticket to a more fruitful career.


Sure, programming might not be for CEOs of large companies with employees and family to feed. But if you’re a young executive with the goal of starting a tech company within a year, learning programming might be valuable for you to work seamlessly with developers or create your own minimal viable products.


You might find learning to code unpalatable or unnecessary. That’s fine. Or you might want to learn it for the simple reason of belonging to the cool crowd (many standup comedians actually started doing comedy because of that), or to simply figure out if coding is something you’d like to do. Or your goals could be as material as wanting to improve your financial situation.


For me, it was all of the above:














GoalResult
Yes, I wanted to be cool. Don’t judge.I’d like to think I’m cool, by virtue of the fact that I can create a working app using Ruby on Rails and utilize a variety of APIs, while keeping my day job as a writer and editor. I’ve also persevered when many others have fallen away, but I made a lot of sacrifices. That said, there are many levels of epicness I’ve yet to reach.
I wanted to challenge myself intellectually.I felt very challenged indeed.
I wanted to see if web development could become an alternate career track.Probably not. Like any career, programming involves a lot of unpleasant tasks like server migration, dealing with intruders, and so on.
I wanted to combine my interests in technology and media.Accomplished.
I wanted to use programming to make myself more productive.Probably achieved.

Of course, it’s not for me to say how I performed. That’s your discretion. But if you think I did well, read on to find out what kept me going:


Start project after project.


Aim to reach peak after peak.

Aim to reach peak after peak.



Let’s be honest, coding isn’t fun. Sure, conjuring up elegant code and fixing bugs are rewarding, but everything’s for naught if there’s no end product. It’s curry rice without the curry.


Make your programming journey sustainable by structuring it as a series of mountains to climb. Tackle project after project, each allowing you to learn new things, revise old knowledge, and bring you closer to your goals. Here are the projects I tackled, in chronological order:


  • A text game. See Learn Python the Hard Way.

  • A Ruby script for counting tags on tech blogs to see what topics were popular.

  • A Ruby script that crawls websites for information and copies them into another database.

  • Sortable tables and bar charts. I hooked up a Ruby on Rails app with D3.js, a javascript-based visualization library.

  • A Rails app that hooks up with the WordPress and Google Analytics API to programmatically generate content.

  • A Rails app built upon the Buffer API that allows me to repost popular content on social media.

  • A Rails app that populates links on a database.

  • Statsy, a Rails app that doubles as a searchable database for facts and a Google Charts-based chart maker.

Each successive project became more complicated. I started out creating scripts, which are programs that live on the language’s environment in your desktop. Then I learned Rails, a framework for creating web apps that’s built on top of the Ruby programming language. Finding projects that mean something to me made the journey more pleasant. As one programmer writes:



Programming should only ever be introduced as a means to get something real done or done faster. Hacking on something you already understand. Then there is a purpose and motivation to learn. Then programming is meaningful. It is sad [to me] to know that some people’s first contact with programming would be a dry grammar class (or some patronizing guided tour to nowhere, ”yippie, you can count!”) that they just have to sit through to learn, no biggie, like everything else they’d done in school.



Persevere and celebrate small victories.


party


The picture I painted at the beginning shows how painful getting from the start to where I am today can be. But that’s if you aim to build a functioning web app. The slope isn’t so steep at the beginning – websites like Codecademy make picking up the basics incredibly easy. Ruby especially has plenty of resources to get you started.


But based on my experience, things get tougher when you’re trying to build a full fledged web app. Why? Because there’s just so much more things to pick up. Unless you’re learning Node.js, you’re not mastering one programming language but two: one server-side language (the stuff that happens in the servers), and javascript for the client end (the magic that occurs on your browser).


In addition, you’ll need to use markup languages like HTML and CSS, which governs how your site looks and feels to the user, as well as getting a server up and running (I’d recommend beginners to try Heroku). That’s not all. Every language has a ton of libraries to master, and each API its own documentation. You also need to grasp how databases work. And don’t get me started on Git and test-driven development.


I know that feeling. I was just as overwhelmed when the scales were removed from my eyes and I saw what laid ahead of me. But having a clearer vision didn’t stop me. The trick is to start small, and build confidence to tackle bigger projects. As you go along, your learning accelerates. You’ll be surprised by how much you can absorb.


The most frustrating part about programming is when your app goes tits up and you’re pulling out hairs trying to pinpoint what went wrong. Since an app is made up of so many interlocking parts built on open source code created by tons of other people, the source of the bug can occur at any point in the pile. Learning to debug productively is an underrated skill.


This makes celebrating small victories important. Think of version one of your app as the ultimate reward – a mental feast. To get there, you’ll need to pick up the small crumbs along the way to tide you through the low moments where you feel like giving up the whole coding thing. Take my word for it, there’ll be many times you’ll feel like quitting.


If that happens, take a mental break. Revisit the problem later. Think through all the possible sources of error. Ask around for help. And when you fix the bug, throw a mini-party. Then take a deep breath and go again.


Get social support.


Learning to code shouldn’t always be a solitary activity. Consult with knowledgeable friends. They’ll teach you things not easily found on Google. Join groups in your city (list of Singapore meetups here) relevant to what you’re learning and seek help. Stack Overflow is a great place to ask questions, and you’d find that many people already face the same challenges and have received answers. Online consulting platforms like Airpair give you access to top-notch programmers for a fee (though I haven’t tried it yet).


Coding in a pair or a group is beneficial. If your goal is joining a development team, treat this as a dry run to becoming a professional coder. Each team will develop its own protocols, workflows, and toolsets, often determined by the most senior programmer on the stable. Start by working on side projects together with friends. If you’re part of a startup with a development team possessing the patience to teach newbies, volunteer to do some coding for them.


Ruby on Rails for the win.


When learning to code, you’ll have to decide which language to learn. This video comes in handy:



For me, there wasn’t much of a science behind my decision. I picked Python initially because it was frequently cited as an ideal language for beginners. Later, I switched to Ruby because a colleague of mine was familiar with it. It was a social decision (see previous point). On hindsight, it made total sense.


Aside from being well-supported, Ruby has one of the cleanest syntaxes around, making it easy to read and learn. Meanwhile, Rails has a plethora of plugins that give apps a variety of capabilities – such as user authentication, a content management system, or an admin dashboard – right out of the box. It’s so full-featured that building a Rails feels like fitting several mini-apps together, and then doing your darndest to make them fit.


So if your goal is to get to a working prototype fast with as little gut wrenching moments as possible, Ruby on Rails is the ticket. For a more learned perspective, check out this talk by Michael Cheng, a Singapore-based PHP developer who picked up Ruby on Rails recently.


Manage expectations.


Depending on your goals, reaching a position to be productive with coding may take a while. If you’re part of a startup and you’d like to contribute by committing some frontend code, learning HTML, CSS, and Git should be sufficient and can be done in weeks. If you’re an aspiring entrepreneur trying to build a web app, learning the necessary skills could take months depending on how much time you can commit to learning. So expect to see yourself digging in the dark for a while before emerging from the tunnel.


Just a couple more thoughts I’d like to share:


Programming is just a tool.


What bugs me about my journey is whether my time should’ve been spent on something else, such as learning management skills, design principles, how to do a proper mockup, or how to be a better journalist.


It’s an important question to ask before you start, though I don’t really have a good answer for myself. While I’ve been learning for two years, I might find down the line that this endeavor might not fit my goals anymore.


Suppose you’re a CEO of a startup with a limited runway. Learning programming might not be as productive for your company as picking up user experience design, user testing, data analytics, and other skills that developers may not possess. Programming, after all, is just another tool to make a successful product.


Believe in no-lose scenarios.


I’m naturally risk-averse, so one tactic I used to get started was to think of a plan B. I asked myself: what happens if I give up and fail to create a web app? I answered:


“At least I get to experience what it’s like.”

“At least I know it’s not for me.”

“At least I can empathize with developers and work better with them.”

“At least I’d learn to be detail-oriented and gain better problem-solving skills.”

“At least I get to write about my experience.”


Turns out I can have my cake and eat it too.


See more: Ten websites to learn Ruby on Rails for free


Questions? Ask them in the comments section below and I’ll try my best to answer them.


This post Learning to code? I did it for 2 years – here’s what I learned appeared first on Tech in Asia.







Learning to code? I did it for 2 years – here’s what I learned

No comments:

Post a Comment