Some thoughts on learning to code

It's called a (programming) language for a reason. It's a language.

Most of us grow up in a one/two language household - and that first one is considered your native tongue. It serves as a reference for all other languages you learn.

You "Mr./Mrs. I-can-speak" are back in the crib learning to speak all over again. Babies first words are short like "mama" or "cars".

Coders first words are often "Hello, world".

Learning your first programming language

These idea's are what helped me to stay on track eventually learn some deeper concepts in coding.

The first language is the hardest

In the first laguage, you are learning not only syntax, but concepts and vocabulary too. You are learning to speak. You are developing style, and learning idioms. Its normal to feel like its a lot - because learning to speak is a lot.

First languge: new: vocabulary, concepts, syntax, style, idioms

Second languge: some new vocabulary, concepts, syntax, style, idioms

Third languge: less new vocabulary, concepts, syntax, honing own style

Then you realize "hey - all they these languages are sort of alike..."

The first language you go deep on will be like a native language to you. To advance in any programming language, you must study and understand the deeper concepts. No one cares if you can say "hello world" in 5 different languages. What they will ask is "what's your native tongue? (what language can you converse in)" If you cannot converse in any language, you don't know any. "He can't talk, he just babbles..".

I learned basic scripting (babbling) in Bash, but Perl was a deep-dive for me in so many ways its now my native language. As study C now, there are a lot of concepts to be learned. I always thought of Perl as "a C interpreter" and while C has a simple syntax, the concepts are deep and challenging to learn, in a good way.

The second and subsequent languages are easier to learn.

By the point of the second language, you can relate it back to your native language, and not all the concepts are new. That is until you want to advance, at which point learning the concept in two different languages at the same time can actually help. Two ways to express the same concept is quite freeing. I learned OOP writing in both Perl and PHP at the same time.

How I learned

Get a good book and a laptop

I bought and started reading Learning Perl, however nothing was sticking. I then found a laptop that was cheap and had good battery life for $20 and I started to study Perl with a vengance in 2009. It was a P166 laptop w/64mb RAM (Debian, CTWM) and 3 hours battery life. Half the fun was getting apache and mysql running with 64MB RAM.

Learning Perl is well written and teaches the basics and it was a good foundation. After that, Perldoc and the Perltut's were my documentation for continued learning.

Immersion

An OCD level of focus is helpful. Read all you can, take in all you can. Think of a problem you'd like to solve in that language (C/Perl/PHP/Ruby, etc) and start coding it. Buy used books at Goodwill or Amazon. Download and read the documention available for the language you are studying.

Don't fight the language

Like any GOOD language - smart people wrestled over the best way to express something and this is the result. Dont' fight with "why are they using * for pointers?" or "why does perl use $ @ % for different variables? PHP does not and C uses none.." Just accept it as the way to communicate that concept/idea. Try to get in the authors head.

Write lots of code, and refactor it as you learn

You will not learn to program in class. It will show you enough to go off and start practicing. You will learn to program on your own - like on a Thursday evening at 10pm when something clicks. If you do not practice outside of class - do not expect to get much. Anything you do get will most likely fade as the brain learns by using. Code is learned by emitting it from your mind, wrestling over the concepts and how to codingly express yourself.

Make it a part of who you are and what you do

Think in code, how would you represent a grocery trip as a complex data structure?

Published on