Rookies at Work, Part 1: The best way to learn code⦠write code!
Et voilĆ : My series dedicated to computer literacy is ready to take off. In my first blog post on this topic, āIām On My Way to Computer Literacy: Care to join me?ā I asked readers which name they like most ā āFumble & Pride,ā āItās Not Rocket Scienceā or āRookies at Work.ā I received positive feedback on the third title (which is my favorite, too). Letās hear a big round of applause for the winner ā āRookies at Workā! (I started designing a logo for it, which Iāll present in a later post.)
That first-of-a-series blog sparked a conversation (thatās what blogging should do) with a small group of experienced developers at Twitter. Among them was a young Polish team from Netguru, who even offered me an internship under two conditions: 1) I must learn some basics of the Ruby programming language and, 2) Iām expected to work for free. (Seriously, I think it would be fun with these guys. Instead of going on holiday and wasting time at the seashore, Iād be...)
To help me get started, they provided two sources: tryruby.org and railsforzombies.org. I now have some initial Ruby takeaways to share.
First, Ruby feels different. The creators of both sites say itās the āprogramming language of Generation Nintendo.ā Itās fun, witty, unpretentious and comes with a geeky sense of humor I like a lot. Although I didnāt dig too deep into it, I immediately sensed Ruby is a completely different habitat than Microsoft.NET Framework, which Iām mainly focused on.
Learn through imitation and repetition.
Understanding comes with time.
Unless youāre an Einstein (which Iām definitely not), you simply wonāt understand the concept of a programming language when youāre an absolute beginner. āWhat is a class?ā āWhat is a method?ā āWait a minute⦠what about strings?ā As a newbie, youāre entering a land of confusion. You have to use rounded and square brackets (which are rarely used when writing emails, presentations and such), and type in strange command lines that look as if they were invented by aliens ā poem_lines.to_a.reverse⦠Yes, itās called coding.
Take my advice: Donāt even try to understand it. There are loads of friendly people out there providing tutorials, blogs and books. Confusion is inevitable in the beginning ā no matter how much you stretch your imagination and try to grasp the concept of a given programming language ā unless you follow my ridiculously simple, but highly effective advice:
Take coding courses without thinking and trying to understand.
Youāve probably seen a movie where the captain of a huge airplane with hundreds on board suffers a heart attack or similar fate. All of a sudden, the cockpit is orphaned. A brave passenger with zero flight experience steps forward and lands the plane safely, simply by following commands from the ground crew. Thatās how I learn coding and I recommend you test my method. Hereās why: You get a lot of satisfaction from accomplishing a task, regardless of how you do it ā even if you just type what the course instructions tell you, line by line.
But letās get back to the movie analogy. If the ground crew starts explaining the basics of thermodynamics to the newly minted captain, all the passengers would be doomed, because as a beginner, you canāt understand thermodynamics in only a few minutes (again, assuming youāre no Einstein). By simply following commands without thinking about them, all the passengers have a chance at survival.
āPress the green button! What do you see on the screen now?ā
āA āWHEELS READY TO GET OUTā message.ā
āGreat! Now grab the control stick and press the blue button on the leftā¦ā
After a shaky but safe landing, the rookie pilot receives applause from the rescued passengers and wins the heart of the beautiful stewardess. Thatās how life should be!
Now, letās assume our hero is faced with the same situation over and over again. Each time he boards a plane, something dreadful happens to the captain and he must land the aircraft and save the passengers. Over time, heāll start to understand the tasks heās asked to perform by the ground crew. āHmm, when I pull the control stick too much, the plane rises and goes faster, instead of slowing down.ā One day, he reads about thermodynamics and starts to understand flying based on his vast practical experience.
Itās no different with learning programming languages. It might sound a bit foolish, but walk through as many tutorials as you can by mindlessly retyping the code provided. The more you type, the more familiar you become with the language and, over time, start to understand what youāre doing. Thatās how we all learn most thingsā whether walking, talking, interacting with others or riding a bicycle. Did your mom or dad teach you how to ride a bike by explaining the laws of physics? Hell, no! You were asked to hold the steering rod with your hands and pedal with your feet. And although you didnāt understand what you where doing, after a while, you learned how to bicycle. Remember how proud you were?
As adults, we assume we can understand something in theory before we start exploring the subject in practice (if at all). What a waste of time! Thatās the best way to become a Jack-of-all-trades, master of none.
The biggest challenge?
Hack! Mistyping code.
Another challenge ā even greater than understanding a programming language ā is the typing itself. As I said, when writing code for the first time, you use tokens you can barely find on the keyboard, such as {} or [] or ||. Even if you just type in the code from the lesson youāre working on without trying to understand it (as I advise you to do), youāll mistype code. How to overcome this obstacle? By typing as much code as possible. The more you type and become familiar with the strange vocabulary of a programming language, the fewer mistakes you make and eventually begin to get it. āWait a sec⦠shouldnāt I end every line with a semicolon? Thatās it! Thatās why Iām getting an error message.ā Itās as simple as that. Not rocket science at all.
P.S.: IĀ hope youāre not discouraged to join my journey towards computer literacy. For me, itās pure fun. I believe youāll experience first-time coding in a similar way ā if you donāt try to understand, but instead put your trust in the power of imitation and repetition. Over time, it will get you to the point of comprehension. Enjoy!