You want to learn your first programming language. You read about it a little bit and you decide which programming language to learn. Then you read that big book full of syntax or you watch these programming videos and … nothing. When you open your IDE you can only stare on that blinking cursor, your mind is blank and you don’t know what to do. I’ll tell you why this happens and what to do about it.

This post is not for everyone. It is intended for aspiring programmers who have trouble learning their first programming language.

Why you need to read (or watch videos)

First step is to get information, wheter you get it from book, video or other person doesn’t matter that much. After all you couldn’t write a word if you didn’t know letters, would you? Simply, you need to know your language syntax. While this step is absolutely necessary, you really shouldn’t try to learn it at single run. It would be better for you to learn a few instruction and practice it. Don’t let that thick programming book scare you.

Getting knowledge (information) is not enough. You may know something, but you haven’t tried it, you haven’t seen it in different circumstance, you haven’t done it yourself. You need more than that, as a software developer you need to understand commands available in your chosen language as well as certain consequences.

Repetition by copying is not enough

Have you ever heard the phrase “monkey see, monkey do”? It means to imitate someone or something by copying, but not really understanding what’s going on. Its not enough, you need to seek understanding. You’ll not learn much by mindless retyping. Have you ever found yourselft in situation in which you didn’t really know how program works after retyping piece of code from book or a video?

Understanding and experimentation is crucial. Try to understand what is going on, why is this instruction needed, what does it do. Try to break things, experiment and change code to see what will happen. If you’re writing “hello world!” then try to find a way to make it out “hello {your_name}”. If you’re writing a game then make try to make your character jump higher or better yet make it double jump.

Algorithms, logic, data structures

Programming in my opinion requires certain way of thinking, you can often observe someone new to programming who know some language instructions, but cannot really make anything out of it. That’s because such a person lacks the skill of thinking in algorithms, which is essence is: how to make it happen using the instructions I know. You need to be able to establish a kind of logical flow of your app, when this then do this, else do that, but always do this 10 times etc. Aspiring programmers need to be able to “tell” how to get from one place to another step by step.

Let’s look at an example. Suppose that we’re about to write program which would print out what day was yesterday, what day is today and what day will be tomorrow. How could we approach it? The first step would be to find a way to get today’s date. Then we need to find a way to print it out. Then we need to find a way to get yesterday’s date and also print it out. Same with tomorrow. But then again, how could we print all dates in current month? How can we reduce it? Can we create a loop which would go over all dates and print it inside it?

The next important thing are data structures, particullary arrays and lists. It’s because those are most basic and most commonly used data structures, you need to learn how to process bulk data and get used to thinking in sets. If your app deals with employees and payrolls, then think how you could increase their salary (all of them) instead how to do it one by one.

Practice

It should be clear by now, that what you really need is a practice. But you need to have a right kind of practice. Do not retype mindlessly, if this is your first language you’d do better by learning in small chunks and experimenting with it instead of watching “How to make a game in X?” video course or reading whole “Big book of C#” book.

Try to make small simple applications and play with your code. Once you have some experience using basic syntax try something with data structures. Once you have that try to something more complicated, but still start small. Soon you’ll need (most likely) to get to know some kind of framework. If you build websites it could be Laravel, ASP.NET Core, Ruby on Rails, express (node.js), for games it could by Unity3D, Cocos2d, CryEngine, for mobile Xamarin or React and so on. This is a huge step, frameworks have a lot of functionality so I’d adive you to learn in small steps instead of trying to make one big app. You could try making a simple web page, then add a form to it, then save data to database, then display a list of saved data. If you want to make games then perhaps you could try to display sprite (image) or 3d objects, then you could try to add controls to move it. For mobile, you could try the same way as I described with web app.

A sample guide for learning basics of new language

I’ll show you a simple guide, which you can use. You should see it more like a template than just a single project. Try to apply this level of thinking and analysis to every task.

You’re given a task to create console application (game). Computer picks a number between 1 and 100, and you give user 10 chances to guess that number. If number inputted by user is smaller then print “More”, if number inputted by user is greater then print “Less”. If user guessed then number then print “Winner” and the program ends, if user didn’t guess the numer for the 10th time print “You lost”.

  1. It all starts with a number selected by computer. How can we get random number between 1 and 100? Find a way to get random number and store it in a variable.
  2. How can we get keyboard input from a user? How can we process that input as a number? Find a way to get that keyboard input, parse it as a number and store it a variable.
  3. Now, how can we make it check wheter then number inputted by user is lesser, greater or equal than the number picked by computer?
  4. How can we make it output text as soon as one of those cases happen (number is lesser, greater or equal)?
  5. There is a requirement that user has 10 chances. We need to allow user to input answer, then check wheter it’s good or not, multiple times. How can make it without retyping it again (maybe one day we’ll give a user 100 or 1000 tries)?
  6. Now we have a loop, but what happens if user guesses answer in second try? We don’t want it to ask for an answer again. Find a way to exit once user gets correct answer.
  7. BONUS step: find a way to modify it e.g. make user guess a number from range 1 to 1000, then -100 to 100, give him/her more or less chances, every time users guess print how many chances are left.