Programming is no longer a “geeks’ domain.” In reality, it never was, but more people are now taking up coding – it’s even included in some mainstream grade-school curriculums. However, to be a well-rounded programmer, you’ll need to learn a few different languages – and be able to use them.
Fortunately, there are five questions you may ask yourself when starting to learn a new language. This article will look to answer them and set you up with a new arrow for your quiver!
1. How Do I Define Data in My Program?
While every answer here is crucial when learning the fundamentals of any programming language, defining data should be the focus of your first question. Without data, a program is as good as useless.
A good tip here is to see what the “core” is for your chosen language. For example, Java, Dart, Rust, and many more are built upon C. This means you’ll find many curly braces, semi-colons, and type definitions for variables.
As such, if you understand one language, some of that information can potentially cross over. Even so, you’ll want to find out whether your language is “strongly typed,” as you will want to understand what types are available to you and how they’re defined in your code.
2. How Can I Store Data and Work With It?
In fact, before this question, there’s another one you should ask: how do data storage commands describe each data group? For example, many languages use “arrays” and “hash tables.” However, languages such as Python use more explicit and descriptive terms: “lists” and “dictionaries.”
Once you have the nomenclature down, you can figure out how to construct your arrays and hash tables. In many languages, you use square brackets and curly braces respectively. For example, here’s a Python template for an array (or list):
my_list = ['item1', 'item2', 'item3']
Whereas to create a hash table (called a dictionary in Python), it changes to:
my_dict = {'first': 'item1', 'second': 'item2', 'third': 'item3'}
If you take a look at other languages, such as JavaScript, Swift, and others, you’ll see this format crosses over almost exactly.
3. How Can I Loop Code and Introduce Logic to My Program?
Once you can define data and store it, you’ll likely want to make sure it can run until a task is complete. For example, consider a simple number generator or a custom field checker running through a hash table of usernames and passwords.
There are two loops you’ll want to learn for your programming language:
- For loops. These loops have a defined end, usually when an iterator has finished with a range. They’re good for iterating through arrays and other storage.
- While loops. These are untamed loops that can break your program or send it indefinitely spitting out the same output. As such, they’re great for making a game run but not so great for churning through numeric data.
As you’re figuring out loops work in your programming language, it’s also worth considering how “If” statements are written. Logic is obviously an important aspect of any program, although like variables, they tend to follow the format of a parent language.
4. How Do I Create “Suites” Of Code?
At this point, you’ll be able to define and store data, loop through it, and perform logic. By now, you could create small scripts and run them from the command line. However, functions and classes will give you a way to organize your code and create reusable snippets.
These elements aren’t as consistent as others within the language. For example, JavaScript is explicit in what you’re creating:
function myFunction(p1, p2) { return p1 * p2; // The function returns the product of p1 and p2 }
Whereas Python uses def
:
def my_function (p1, p2): return p1 * p2
Object-Oriented Programming (OOP) is also something you’ll need to understand if you currently use it in your primary programming language. However, it’s not something that will always translate. In these cases, you’ll want to turn to the experts.
5. Where Will I Find Help If I’m Stuck?
By now, you’ll be able to write simple programs in whatever language you need to “grok.” You may also have carried out some research on aspects of the language you need to know. However, you may not be totally au fait on where the best help is.
Most programmers head to Stack Overflow:
This is a huge network of sites with a wide range of users. However, it’s notoriously not friendly to beginner or “inarticulate” programmers. As such, you’ll want to find forums where beginner coders are welcome to ask the “dumb” questions.
Finally, we also want to mention a top-notch resource for learning a programming language quickly: Learn X In Y Minutes.
It’s essentially the “cliff notes” and cheat sheets for practically every language in existence. It’s great to have on hand when you’re traversing a new programming language, and it’s printable!
In Summary
If mainstream education is including coding in a curriculum, it means it’s a skill worth knowing. Being a “multilingual” programmer increases your core skills and also gives you an opportunity to gain better employment.
If you are looking to learn a programming language for free, we’ve discussed this in length previously. Have you tried to learn another programming language? If so, how did you get on? Share your stories in the comments section below!
Our latest tutorials delivered straight to your inbox