What I would like to have known when I started coding

9 minute read

PROGRAMMING BASICS

Once at a high school, I decided to demonstrate to students, why they should use R instead of Excel for their psychology statistics, and got some of them intrigued. So when I planned my first lesson, oblivious to what experience and approach I can expect, I started to wonder. What is it that I would like to have known when I started to code in my third year at university. Is there something beyond the pure coding knowledge that I would like to have heard and been reminded of during those awful first four years of getting used to SPSS, R, C# and eventually php, Ruby, python and other languages I delved into? These are some of those thoughts.

PROGRAMMING IS NOT ABOUT LEARNING THE WORDS!

It might all seem overwhelming in the beginning. There are so many languages there, all slightly different, all cryptic. But programming is less about the language itself, as it is about approaching a problem in a structured way. It is like becoming a freshman at a wizard school.

You think its all about those fancy words and swings of a wand, but your teachers never do that. They teach you how precisely say the spell, but they never bother spelling it out loud themselves. Programming like magic is eventually about underlying concepts, about understanding the problem from a computer point of view and redefining it so that the machine understands it. That is why some programming schools actually start with whiteboards or games like scratch, they don’t bother with real languages until further on.

But for you as a beginner, it will probably be easier to focus on the structure and the language itself; in the same way those young wizards do. Focus on the code and try to replicate it PRECISELY. To the last quote, every space and tab, every uppercase letter, every single syllable. You might not even realise what you are doing until later. For me this realisation came when I picked up a second coding language. Suddenly, I noticed that both of those languages (in my case R and php), are hugely similar in many ways. They use different “spells”, but the core of it remained.

In other words, do not worry about learning all the words (functions, classes etc.), just copy paste. Do not feel overwhelmed by the amount of information the internet will through at you, it will shrink. Eventually, all of that vast knowledge will become hugely superficial, so just keep it in mind and don’t get discouraged that you still don’t remember the spell for entering a new variable into array :)

COMPUTERS ARE STUPID!!!

What you tell you computer to do something, it will do it. Perfectly. It will do the thing in the same manner every single time. If you get different result (like a crash for example :)), it is your mistake.

In the beginning, slight mistakes like double quotes (“string”) instead of single quotes (‘string’) will trip you up. They are common. That is why it is important to replicate the code so precisely. Some languages care about how many empty space you put where. Some care about formatting of tabs, some don’t. The best rule is, just replicate what you see. Copy paste the example and see if it makes the same mistake. If not, you have some trailing space in your code :)

More problematic are issues that relate to different versions of your system, different versions of programming language or variable input that you modify yourself. You will eventually learn how to best approach these issues, to dissect the problem and figure out, what is causing it. It will come with experience and time.

EVERYBODY GOOGLES!

Some people will make you believe that if you need to look stuff up, you are not good programmer. This is not true. Even the best translators google and search for things as well. They do it every time they are a bit unsure about the best approach or they haven’t really got used to translate this particular type of text. Being fluent in Czech does not mean you know how to best translate or write a Czech washing-machine manual (as those translations clearly show).

Learning HOW to search for answers should be one of your priorities to do at a beginning. Do not extensively try to figure out a problem that somebody else solved. It might be a good practice, but only if you have time. Otherwise, just try to search for it.

First time you will google it because you have no idea what to do. Second time you will search for it because you forgot the answer. Third time, you will search for it in your own code to see, how You solved it before. And the fifth time, you will remember and solve it yourself.

HELP IS NOT ALWAYS HELPFUL.

Lots of programming courses will teach you that the language and the packages or libraries you use come with nice helpful manuals and you should use them every time you don’t know how to proceed. Well, needless to say that at the beginning this made me questioning my abilities even more. Simply because I didn’t understand the helpful manuals at all. I didn’t understand the code, I didn’t understand the help and I felt like quitting.

BUT!

It is common in many fields, that manuals are not written by the same people who designed the product, be it washing machine, statistical software or a boardgame. The creators understand the product so deeply, that they just can’t write good help for people who are new to it. But as it is a case in many programming languages and libraries/packages, coders usually write the help as well. Luckily the manuals got better in later years, as more people got into the field and they had time to write and provide more concise instructions, but I am sure we are not quite there yet. Yes, there isn’t a university level requirement for coding anymore. Yes, often no previous experience is needed to get into programming statistics in Python or R or build iOS app, but there are exceptions.

I still think that many of the R base helps are not helpful at all. At least for beginners. Also, my experiences with helpful people on the internet varied a lot. Some were incredibly supportive, some only made fun of me that I didn’t understand the basic concepts. I quit two Coursera R courses because of that. I didn’t understand the problem and the forums were just like: “You ned to read the problem several times and then read the manual. It is really simple.” I did read the manual several times and stared at the problem for four hours and still didn’t understand it. So I quit the course, feeling like a failure. It happens.

When I recently played Talos Principle, there were some quizzes in the game that I just couldn’t solve. And the help on the forums was very much like - “yeah, it took me 5 minutes to solve that one, it’s really tough.” I was in that room for an hour!! Almost none of the previous puzzles took me less than 5 minutes. If I was younger, this would be a killer. I’d just drop it feeling this was above me. But I am adultier and I know one thing.

People LIE! They lie and diminish other people to make themselves feel good. Or they are just geniuses, but it doesn’t matter. Other people’s skills should not lower your enjoyment or accomplishments. You don’t need to be the best in coding! You just need to be good at the level you need and where you feel comfortable :)

Point being, if you don’t understand the provided help, it might be that just the help was given by somebody inconsiderate, rude or the help is just badly written. Don’t let it distract you and try to find a better one. The best one is always a considerate friend :)

EVERYBODY COPIES!

In programming, do not be ashamed of copy paste. Why do You think programmers even put copy-paste into operating systems and so easily accessible, eh? :) Although you might think of it as cheating or stealing somebody else ideas, it is fine. In most cases, the piece of code you are copying isn’t some amazing breakthrough anyway, so go ahead and use it!

Later you will realise that copied code usually means you repeat yourself a lot and you will get bored and try to figure out a better ways (because there are :)). But when starting, copy away.

EVERYBODY MAKES MISTAKES!!! EVERYBODY WILL GET FRUSTRATED!

I spent hundreds of hours being frustrated when I started programming. I think the biggest reason for gender disparity around machines is that men might have slightly higher tenacity and frustration levels. Men just “don’t care that much if something fails”. You really need to practice to NOT care, as much as you possibly can. Errors are actually good pointers in how you can improve your code. Errorless code that you produced on a first try is most usually WRONG somewhere :)

You should approach beginnings in the same fashion. You will do stupid mistakes. You will fail again and again on the most simplistic tasks. But stick with it. Do you remember how many times your teacher had to explain use of past participle in English? How many times you had to spell the word beginning to remember it had two Ns inside? How long it took you to learn how to turn on a snowboard or how you felt the first time holding chopsticks? You just need to stick with it. Be proud of any accomplishments and learn and learn :)

IT WILL GET BETTER!

Coding is very much like starting to write short stories in first months at Learning to write course. If you have never written anything, you will try and fail. The text will be awful. Nobody will like it, it doesn’t do anything useful for anybody. So you take a look at other people’s work. You copy what they do well. You write a second short story, and it gets a D+. You are getting somewhere :)

You write and write. In the beginning, you just copy what works. You are like a trained monkey, doing the monkey stuff. It is fine! Be a monkey, monkeys are cute. Your stories will get better. Your stories will eventually spark interest. They will work for you and for others.

Many times, you will feel frustrated, that your short story is rubbish. It inspires nobody, it was supposed to be a funny love story and ended as a slash horror. If is fine. Next one will be better.

In few months to years, you will move to bigger projects. You will start to write novels. You will suddenly realise, how some of the smaller pieces you wrote actually work. Why that stuff you never did is suddenly important and you will start doing that. You never needed to make chapters in previous work? You never needed to separate stuff into clear paragraphs? You will get better, the code will get better and with it, the vast world of programming will open the world for you :)

Coding is just like that. Instead of short stories, you write short scripts and function. You write them awfully and inefficiently. You never comment, you have awful coding habits. But you get tired of this. Just reading all that code around you will push you to do it better. To be on par. You start challenging yourself. You will move from data analysis in R to programming games in C#. The projects will get bigger and you will get better habits. You will be amazing. In the end :)

Bon Voyage.

Leave a Comment