Kopiering til utklippstavlen mislyktes. Prøv igjen etter å ha justert tillatelsene dine.
Kopiert til utklippstavlen.
Learning to code is a lifelong process, but these tips will start on your journey
So, you're new to coding? Whether you’re learning code for fun or as a means to an end, you’ll be full of questions about it. As someone who was new to programming once, we’ll try to offer our views on how best to learn your first programming language. We hope you have a fun time discovering how to code!
1. Learn the basic concepts of coding first.
Even before you choose a language to learn, you should grasp the basic concepts that hold up all programming languages. Don't let the new terms put you off. They are:
Variables: In simple terms, variables are the name given to methods of storing information in any program. Calling the variable retrieves the stored information.
Control structures: Control structures in a program determine which variables to use based on the existing parameters. If...then...else statements, for example, is one of the simplest control structures in many languages, that tells the program how to proceed.
Data structures: Different methods of storing and accessing data in a computer.
Syntax: The set of rules that define the grammar of a programming language.
Tools: A piece of software that can help you program faster.
Back in high school, my first brush with programming was through the mandatory C++ course I was taught. At the time, my only prior experience with programming was BASIC. I had used the GOTO statement to death drawing shapes, with no real understanding of what purpose it served or could serve.
Now Python is considered the new BASIC by many people. C++ was interesting in the initial stages because the concept of Object Oriented Programming seemed manageable. New users thought functions, arrays, and keywords like 'void' and 'public' made sense. But after some time, it was common to discover they had only learned a bunch of C++ semantics, with no understanding of what was going on underneath them.
3. Pick a language that demonstrates low-level concepts.
When you learn to program for the first time, you need to lay down the foundations first. Preliminary education should include problem-solving skills and an understanding of low-level concepts.
What is meant by low-level concepts? Well, for example, did you know that when you write functions in C++, they end up on a call stack? You may have heard of stack overflow, vaguely understood pointers, and have a sketchy knowledge of logic gates. These are low-level concepts.
Here are some opinions about what a first programming language should be.
It should teach you basic, low-level concepts like procedures and loops, decomposing problems, encapsulating data, and generally how to think like a computer. A language like Python or Smalltalk will get you started on these concepts quickly.
It shouldn't be syntactically abstract. That means the language should be easy to read and understand. It's your first language, and you want it to be as close to English as possible. Python and Smalltalk are pretty close to this ideal, and so they are easy to learn.
Languages like C++ have a complex syntax that you'll need to learn before you can begin to do anything with it.
Another advantage of a dynamic language like Python is that you can test features of the language while you program. So, if you find a bug when you launch the application you've coded, you can simply go back to your Python script, edit the concerned lines, and run the application again. In C++, you'd have to recompile the program every time you debug.
This is all a matter of opinion. Other developers may tell you your choice could be less cautious about syntax. When you choose the first language, choose one that will help you reach your coding goals. Some people have no teething troubles at all when they take their first steps into C++. They chose the language because they were up for a challenge.
Some people will tell you that it doesn't matter what language you start with, because the principles of programming are the same. Maybe it’s true, but there are levels of complexity in some languages that can become a burden if you're a first-time programmer.
4. Avoid popular languages if possible.
At the same time, don't go looking for an obscure language that doesn't have a lot of documentation. You'll only be setting yourself up to fail.
5. Choose a language based on your goals.
It’s wise to choose a language based on your reasons for learning to code. Do you want to develop a mobile app? Do you want to build websites? Pick a coding language accordingly.
6. Learn by hands-on coding, not just reading
It goes without saying that tactical learning is more effective than simply reading. Type and code programs, don't just read them. You may have understood a concept on arrays by reading a program. But without coding it yourself, you'll not be able to implement it with the correct syntax when the time comes.
7. Don't ignore the fundamentals.
We've already recommended learning the basics of programming and how computers think before you begin a language. Don't forget the fundamentals even as you jump impatiently to the fun exercises where you build things. You'll never learn a language in depth without knowing why a program does what it does.
8. Try writing code on paper.
Writing code on paper is a good way of truly learning to code. You will have no way of checking whether or not the syntax is correct, as you would if you were typing code on your computer. Instead, you'd be forced to focus more on what you write.
9. Understand the difference between language features and libraries.
This is another area where beginners quite often get confused. Learn to differentiate between the standard libraries and the language. It will help you wrap your head around the new language better. Modern programming is more about knowing how to use libraries (take a look at libraries in Java and C for an idea) than about grasping the language. Libraries can be large, while you’ll find the language itself is often quite compact. The skill in programming comes with learning how to look up and use the libraries that will help you do what you want to do.
Hopefully these tips will set you off on a more or less straightforward and enjoyable path of learning your first programming language. Just make sure you stick with the language you choose, and you’ll be able to do most things with any language.
So, what's it going to be? The beautifully elegant Smalltalk that is almost like natural speech? The powerful C++ that has gone into building games like Dark Souls and BioShock? Python, Java, HTML5, Ruby, C? The choices are many. What is yours? Hit up the comment section below.