Beginners Guide to Programming

Alex Hyett - Oct 18 '22 - - Dev Community

A lot of my articles are aimed at intermediate to advanced developers, but as part of my creative sabbatical I am working on creating content for those just starting out.

So in this post I will be covering some of the many questions that beginner programmers have as well as the fundamentals you need to know to get started.

What is programming?

If you are accidentally stumbled on this article, you might be wondering what programming is. We live in an age of technology and if you are in the modern world chances are you can’t go even a few minutes without interacting with it.

Programming is the act (or art) of telling computers what to do when you interact with them. We do this by writing code which is instructions that the computer can understand.

Apart from the most basic of devices, everything has some level of code written for it. Even devices like your washing machine is likely to have some code to control the cycles and what happens when you click the buttons on the device.

Everything from apps on your phone to the Sat Nav in your car is relies on some writing code for it.

Why programming is important?

Every day new devices are being released, and new apps come out. Even jobs that were traditionally manual such as postal services rely heavily on technology.

In the future, we are only going to use technology more and more. In the same way that being tech-savvy is becoming a requirement in today’s world, so will a basic understanding of programming.

Children in primary schools are now being taught the basics of programming. If the next generation thinks writing code is as easy as doing times tables, then if you don’t know how to code, you are going to get left behind.

Are programming jobs in demand?

Software development is probably one of the few jobs that demand outstrips supply. Even with children learning how to code and more people become self-taught, the demand for good software developers is not slowing down.

I have never worked at a company where we had enough software developers. Even when the economy is bad and the country is in a recession, it is still possible to get a job as a software developer.

Developers often keep up to date with new programming languages and frameworks to stay ahead. Even the developers who don’t do this can earn a premium by knowing an old programming languages that no one is learning any more.

Will programming all be automated in the future?

Over the last 50 years, we have seen many jobs disappear due to automation. We are getting better at producing robots that can do tasks quicker and more accurately than a human can.

All of these robots, however, need code written for them to work. 
Given that, it is very unlikely that we are going to see programming disappear as a profession for a very long time. If it does disappear, it will be one of the last jobs that will go.

GitHub Copilot has started using AI to help developers write code. As the name suggests, though, it is just a copilot. Developers are still needed to tell copilot what they require and make sure everything works correctly.

How much money can I earn as a programmer?

Many people don’t realise how much developers make. A few hear about the extremely high salaries that developers working for Facebook or Google earn and assume they are outliers.

In some cases, they are, but the salaries for software developers are among the highest around.

Yes, salaries for the big tech companies in San Francisco is in the range of $100k to $400k depending on experience. Many of them earn another 5 to 7 figures in stock on top.

It isn’t just San Francisco that has high salaries. In most major cities you can expect $50k to $200k depending on experience and the industry you are in.

Even in the UK, the salaries can go up to $170k (£150k) for developers with over 10 years experience.

Being a salaried employee isn’t the only way that you can earn money as a developer. Here are other ways you can make money with your technical skills:

  • Work as a Contract Developer – $350 to $1,000 per day
  • Work as a Freelance Developer – $50 to $150 per hour
  • Write technical articles – $50 to $1,000 per article (see Who Pays Technical Writers)
  • Build a Mobile App – $0 to ∞, through in-app purchases and adverts
  • Start a developer blog – $0 to ∞, with adverts, sponsorships, and affiliate links
  • Start a YouTube channel – $0 to ∞, with adverts, sponsorships, and affiliate links
  • Start a Podcast – $0 to ∞, with sponsorships
  • Write a Newsletter – $0 to ∞, either paid using Substack or with sponsorships and affiliate links.

The first 3 can give you an almost guaranteed income, but also take up a lot of time as well.

The last few take a lot of effort to begin with, but can earn you a passive income once things take off (apart from the podcast and newsletter, which only earn when you publish).

Can programming be self-taught?

You don’t need a degree to become a software developer. It can help to get you your first job if you join a graduate program, but it isn’t a necessity.

You don’t even need to go to an expensive bootcamp, you can learn a lot for free on YouTube and with how to articles.

If you are interested in getting started, I am covering everything you need to know to go from beginner to senior software developer on my YouTube channel.

What programming language is best to start with?

There are hundreds of different programming languages, so it can seem a bit overwhelming at first.

For those just beginning, the best language to start with is Python. The syntax is a lot simpler compared to other languages and there are so many libraries for it which means you can do almost anything with it.

Python also has great support for the filesystem, which makes it perfect for automating mundane tasks that you do on a day-to-day basis.

The Fundamentals of Programming

So many internet gurus are saying you need to master data structures and algorithms, SOLID, O notation and binary trees.

All of that is important, but if you haven’t mastered the basics, then you are going to struggle to make any of that stick. I am a firm believer in working from first principles and understanding from the ground up how everything works.

So if you are brand new to programming, these are the 6 things you need to master first before moving on to something new.

Variables

A variable in programming is used to store values which your program is going to use.

For example, say you are writing a program to calculate someone’s age from their date of birth.

import datetime

dateOfBirth = datetime.datetime(1990, 9, 20)
today = datetime.datetime.now()

age = today.year - dateOfBirth.year - ((today.month, today.day) < (dateOfBirth.month, dateOfBirth.day))

print(age)
Enter fullscreen mode Exit fullscreen mode

The date of birth in this case would be stored as a variable, so the value can be changed without you needing to change the code itself.

Variables are also used to make your code clearer to the reader. In this example, I have today’s date as a variable to make it clear what that line of code is doing.

Data types

All programming languages have a set number of data types that are supported. These are the types of values that can be stored in a variable.

The most common types of data types are:

  • Integers , which are just whole numbers, like 4
  • Decimals and Floats , which are fractional numbers, like 3.14
  • Strings , which are used to store text, “hello”
  • Characters , which are used for just a single letter, ‘a’
  • Boolean , which are used for storing whether a value is true or false.

There are many more data types, and you can even create your own in most programming languages, but these 5 are enough to get started with.

Depending on the programming language you are using, a variable’s datatype might be fixed the moment you create it or “declare it” to use the correct terminology, or in some languages it can be changed.

Python and Javascript both let you change the datatype of variables throughout your application.

A variable could start off as an integer and later change to string. Once you get to write bigger and more complicated applications, this can become a pain as it can often cause hard to find bugs in your code.

This is why commercial applications tend to be written in strongly typed languages such as TypeScript, C# or Java.

IF Statements

Unless your application is very basic, it is going to need to do different things depending on what the inputs are.

This is where IF statements come in. They allow you to add logic to your application depending on the value of your variables.

Let’s carry on with our age example from earlier. Say you want to work out if someone is old enough to watch an 18 rated film.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .