It’s never to late to learn how to code
By: Darren Broemmer
Tags: Coding, Ruby on Rails, Ruby, Training Courses, Bitcoin

It’s never to late to learn how to code

If learning to code seems like a daunting task, I am here to tell you that yes, you can code. Coding is like giving someone instructions. Half the battle is actually knowing what you want to do. If you understand the problem at hand, then the remaining work is translating the instructions into a language the computer understands.

Programming languages such as Ruby are much closer to English that you probably realize. Consider the following instructions you might give to your stock broker:

For each of my stocks, if the current price is below the threshold we agreed to, then buy 100 shares and let me know.

Now the same instructions, but written in the programming language Ruby:

my_stocks.each do |stock|

if stock.get_current_price < stock.buy_threshold

stock.buy(100) # shares

tell_me “We bought a 100 shares of #{stock.name}”

end

end

If you have never seen Ruby code before, I bet you still understand what is going on here. Sure, there are differences between the two examples. However, it’s fairly clear we are talking about the same task.

Spoken language offers many variations on how to express things. While programming languages do offer some flexibility, we need to be more precise when giving the computer instructions. However, we can think of it as a controlled subset of English.

Consider the possibilities

You can easily learn how to write code like this. Automate basic tasks, create games, and analyze data, just to name a few.

I have been programming since I was a kid. There are few disciplines where you can build things in a matter of minutes, and it can be extremely rewarding. Full disclaimer, it can be frustrating at times also when you struggle to get your program to work. The same is true for a number of pursuits such as golf and jigsaw puzzles, but they all offer an adrenaline rush when it all comes together. Writing code exercises the brain and unleashes your creativity.

Most technical training starts from the perspective of the machine. It leads with technical constructs and expects you to change your perspective. I like the approach of starting from your vantage point. Take the mindset of giving instructions to someone else, just like in the stock broker example above.

What is the best coding language to learn?

Many people start coding by learning HTML and CSS. This is a fine approach which allows them to quickly create basic web pages. It is easily visible and tangible. However, you have much less power and capability with this language, and therefore less opportunity to learn and explore.

HTML is limited to the creation of web pages. You won’t be able to do much else with it.

It is also a declarative language. This means you specify what you want, not how it should be done. It is up to the web browser to decide how to display it.

Consider a scenario where you are in the kitchen cooking and you ask a family member to set the dinner table. You could use one of two approaches.

Describe the picture of how you want the table setup. This could include which plates to use, the number of place settings, and what utensils should be used. You are not saying how to do it or in what order, rather just that at the end, this is how you want it to be. You provide a sequential set of instructions. First, get all of the china plates out of the cabinet and bring them to the table, etc. In this approach, you prescribe exactly how to do it. You specify the instructions and order in what to perform them.

In this scenario, a declarative approach is probably better. Your family member probably already knows where the dishes are located in the cabinets and the general idea of how to set the tables. You just need to provide the specifics.

However when learning to code, there are so many other things you can learn and create.

For this reason, I highly recommend learning Ruby to get started. Ruby is a general purpose programming language that provides much more flexibility. Ruby allows you to specify both the what and the how, enabling you to write almost anything. It’s also very easy to get started.

Ruby has an amazing community

Yukihiro Matsumoto, also known as “Matz”, created the Ruby language. Ruby grew in popularity quickly in Japan, and then spread to the rest of the world. Matz is a nice guy, and so the community is also nice. The saying is:

MINASWAN, or “Matz Is Nice And So We Are Nice.”

Matz is quoted as saying:

I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of the Ruby language.

Ruby is a valuable skill to have

Ruby is consistently in Top 10 languages on GitHub.

The average starting salary of a Ruby software developer is $76,930

Ruby is used by many high-tech companies. Twitter started by using Ruby-on-Rails, a very powerful framework to create web applications using Ruby. Although they have migrated portions of their code to other languages, many companies get started quickly by using Ruby.

Other companies using Ruby include Airbnb, GitHub, and FiveRR.

Ruby is a true object oriented language. Everything is an object. It has many built-in features and is a beautiful language to write code. You can use it on the server side or the front end for web applications. There is a vast collection of Ruby Gems, or reusable libraries that developers have written and shared with the community.

Ruby is also extremely popular for scripting and DevOps.

Computers require more precision than humans

Consider you are taking a hot dish out of the oven. You say to your friend, “Please get the trivet from the drawer and put it on the table.” If your friend doesn’t know what a trivet is, they may ask. A computer will simply stop at that point because it doesn’t know how to proceed. You will get a message informing you that it didn’t understand what the word trivet was, but it’s up to you to change the term or define it.

Programming languages today simply don’t have all the context that we as humans do. But at least they do tell us what they don’t understand. So we just need to be a bit more precise.

Ruby allows you to get started quickly though. Developers start using either primitives in the language or other higher-level code written on top of those primitives. This allows us to write code that is closer to English than machine-level instructions.

Ruby code to get the price of Bitcoin

Can you follow this code? Note: it uses helper functions defined here.

Image from Yes, You Can Code training by the author

The names may look funny because they have underscores between the words. This allows the computer to more easily understand it is a single name, such as a name of an instruction or a reference to something to remember. It is less ambiguous. It may look funny at first, but you quickly get used to it

The first instruction in the code gets data from a blockchain info website. It gives us a lot of information though, including the price in different currencies. The next instruction then extracts the 15-minute price in U.S. Dollars. Finally, the information is no good unless we have access to it, so we display it to the screen.

Pretty simple, right?

It’s never too late to learn. Ruby is a great language to start.

Start learning now how to code using Ruby in the Yes, You Can Code training class.