It’s 4 pm on a Saturday, and I’m ready to learn how to code tonight.
Here’s the journey of my attempt.
Knowing how to code nowadays is equivalent to knowing how to operate a computer 30 years ago. With the explosion of digital tech, more and more jobs require a degree of code literacy.
(Translations: I see developers and programmers drowning in cash, and I’m jealous AF).
Now, while I’m not a Computer Science graduate, I’d be lying if I cannot code at all. Ten years ago, when I was in middle school, I bought this “Basic C++ Programming Language Book” and learn quite a bit. Nowadays, I know a liiitle bit about Python and SQL, and maybe a bit better on HTML, since I need the latter to build and sew my blog and several other websites. However, it’s not like the real coding ability that I can comfortably put in my resume, even with “beginner” label attached.
Tonight, it’s about to change. Hopefully.
Tonight, I’m going try to learn how to code from zero, in a new programming language I never try: Ruby.
So, why Ruby, you might ask?
The answer is a bit personal. For business and entrepreneurship advice, I really look up to Jason Fried and DHH, the duo that founded Basecamp, the enterprise collaboration tool. I read their (company) blog, Signal vs Noise, like a monk trying to learn the wisdom of the gurus.
I quickly found out that Basecamp is written using Ruby – and so are some of my favorite apps, such as Cookpad and Airbnb. Not only that, DHH himself is also founding Ruby on Rails, a web framework designed to jumpstart making web applications in Ruby.
The selling point of this language (lies in its simplicity and productivity. Specifically, this is a language designed for a human programmer – striving to make coding feels natural.
Now, I need some guidance on how to learn this language. At first, I was thinking of using Rails, but their website warns to have a prior Ruby experience before diving in. However, I came across “Learning Ruby The Hard Way” in-depth guide, written by Zed, a serial writer on learning how to code the hard way.
This is perfect because I don’t have a solid enough foundation, to begin with. Reminder: I’m supposed to be a geologist. So I need to start from absolute zero and learn the very fundamental principles of coding. Quick tutorials and tryouts wouldn’t cut it. No copypasting either. Zed says I have to type every single line.
So here’s the deal: It’s a few minutes past 4 pm on Saturday right now, and I plan to follow-along the guide until around bedtime – with breaks, of course. As of right now, I don’t know what I’m expecting. I haven’t even installed the software, yet. I’ll do some checkpoints with you guys to see how it goes.
And coding… starts.
Installing the software and first three exercises.
I’m about 40 minutes in, and so far so good. I’ve installed the programming language, refresh my memories around Unix basic commands (pwd, ls, cd), and even write my first ever Ruby program! Yay, baby steps!
A little confession: I have to disobey the instruction to install Ruby 2.2 or 2.1. Those versions have been at EOL (End of Life), so I take a chance to install the latest one. Hopefully, this doesn’t backfire…
The first two exercises, which talks about using pound character as comment line, is something that I knew because of the tweakings I did in cpanel or css. On the third exercise though, I learn something mind-blowing:
Turns out there is a math operation I didn’t know: %
So you can do 10%3 and the answer is 1. So the percent (or modulus) give the remaining of the division. So, in our case, when you divide 10 by 3, you have 3 x 3 + 1, which 1 becomes the answer of the operations.
Wow, pretty amazing. I wonder if this is something normal in the US education system? This is the first time I hear about this.
Two hours in: strings, variables, prints
I’m taking the learning slowly, with the focus on training my brain to learn the logic of coding in general and the language in particular. So far, at 6.30 pm which is about 2 hours in (minus bathroom breaks, grabbing snacks and iced tea, hugging hubby, and writing check-ins here), I’ve been on Exercise 6.
The great thing is, I don’t feel weirded out at all by how this thing works. It feels natural and logical. Writing the comments are not my favorite part, though, especially when I have to explain something that should be obvious.
But, Zed says I have to comment every line, so I did.
I also learned a few new terms. String means something you put out for the user, i.e. the human using your program. Print is where you specifically put that string. In Ruby, that means putting commands like “print” or “puts”. Variable is the name of a pre-defined value or calculations.
Also, Ruby enthusiast is called Rubyist. I guess I’m one now?
Oh, by the way, dinner time!
4 hours in: ASCII table
At this point, I’ve grabbed a notebook and start listing the new commands and sequences that I learned. An important piece that I learned is the escape sequences. for instance, if we put /b inside a string, it will backspace or delete one character before.
Cool, but why does this exist? Why not just delete it?
Turns out these codes dates back in the 1970s when computers are first built to slowly but surely takes over typewriters. As cited in the Wikipedia page, the backspace is a button that was “originally pushed the typewriter carriage one position backward.”
In fact, when we push the backspace button in our keyboard today, it generates ASCII code 08 that gives the command /b or to delete a character before.
The more you know.
5 hours in: talking to a computer
We begin to use arguments to our program. I have also written a few simple lines that ask for user input, like this one that tries to mimic a conversation between the user and the program.
At the end of exercise 14, Zed tasks me to play a game called Zork. Turns out it’s an adventure game based on texts. Never knew this existed. I played in here, and it was quite intriguing actually, although it’s quite difficult to navigate. No sound, no graphic, just stories.
I’m halfway through exercise 15 when the clock hits around 10 pm. I decided to call it a day, do some housework and getting ready to sleep. I will write my review tomorrow morning.
Conclusion and the day after
Surprisingly, it’s Sunday morning and I’m sitting here at my dining table with a cup of hot lemon water and… another Ruby exercise. Something huge happened: I woke up excited, wanting to dive into the exercises again! Never expected that learning coding will be this fun!
At first, I thought learning coding will be boring and repetitive. Turns out, it’s similar to playing a game: you create or do something and get to see what is the feedback.
What I like about coding, as far as I know, is the instantaneous feedback loop. Right after executing the program, I immediately know whether what I write is good or not.
Also, in coding, details matter. Small mistakes like forgetting to put a period after a sentence inside a string will make the resulting program looks sloppy. Now, I understand why Zed says at the beginning of the guide:
The one skill that separates bad programmers from good programmers is attention to detail. In fact, it’s what separates the good from the bad in any profession. (Zed Shaw, 2015)
So, can you actually learn to code overnight?
If the goal is to dip your toe into the world of coding, then yes – you will learn a bunch by investing an evening. Today, my knowledge about coding, parameters, strings, and commands are hella more than yesterday at 4 pm.
I really like the guide that Zed made. He can sound a bit stern sometimes and insists us to figure it out on our own, but back to the title – this is about learning the hard way. Which is actually easier, since we’re not spoonfed and actually has to form our own understanding on the language structure.
Also, if you decide to follow the same guide, Stacey from Stacey Learns Code has documented her follow-along journey using the same guide. It’s like learning with a friend.
I also suspect that the ideal time to spend on this guide for beginners with no computer science background like me would be around 1-2 weeks, the latter when you only can spare a few hours on weekdays.
I’d like to try to finish the guide and see where this lessons will take me. Can I make a web app at the end? We’ll see in the follow-up post.
Thank you for reading! Comment below if you, too, are learning how to code or want to start!