DEV Community

Cover image for Learn How to Code: the absolute beginner's guide
Amanda Fawcett for Educative

Posted on • Originally published at educative.io

Learn How to Code: the absolute beginner's guide

Computer programming is one of the most sought after careers today. In fact, software engineering is one of the most in-demand positions across multiple industries.

Learning programming may seem like a huge task. There’s a lot to cover if you’re starting from zero, and some learners get overwhelmed because they don’t know where to start. That’s why today, we want to discuss step-by-step, term-by-term, how you can start learning programming from scratch and have fun doing it!

Here is what we will cover today:

  • Part 1: Programming 101
  • Part 2: What do I need to learn to be a programmer?
  • Part 3: Coding vocabulary and lingo
  • Part 4: A step-by-step guide to learning programming
  • Part 5: Resources for getting started

Part 1: Programming 101

Alt Text

What is programming?

Before we can introduce you to some key concepts, we need to make sure we understand what programming really is.

A computer is a hardware machine that can store and process information. The language of a computer is Binary, a complex set of ones and zeroes. Programming is essentially the larger-scale process of developing a complex machine program that acts according to our wishes. Programming is the basic communication between human input and machine output. It is the way that a computer knows how and when to process data.

So, what is coding, then?

Think of coding as a translator between English (or a different human language) and the computer’s binary. Coding involves the actual syntax and structure by which we write commands. A computer can then take those commands, translate it into binary, and do what is written. Coding involves writing commands in a language that a computer can understand. Coding is the initial step in communication with a computer.

What is hardware? What is software?

In order for a computer to work, it requires both hardware and software. Software is a collection of instructions and programs that are downloaded to a computer. These enable a user to interact with the computer. The apps on an iPad or Microsoft Word are examples of software. Hardware, on the other hand, is the physical device that stores, delivers, and executes that software. The physical iPad or monitor would be an example of hardware.

A hardware engineer is responsible for manufacturing and designing devices that interact with software. They will usually have a background in Electrical and Computer Engineering. A software engineer, on the other hand, develops and codes software programs for those devices. They will usually have a background in Software Engineering or Computer Science.

What is front-end? What is back-end?

Within the world of software development, there are two common camps that programmers fall into that utilize different tools, skills, and end-goals: front-end and back-end development.

Front-end development focuses on what the user will actually see on their screen. This involves the design, application debugging, and coding for user experience. This job is all about the feel, look, and design of a program or website.

Back-end development focuses on everything that makes the front-end possible. This job is all about how a site or application works, how quickly it functions, and how it communicates with databases (where data is stored). Many programmers are more generalists on both sides. They are called full-stack developers.


Part 2: What do I need to learn to be a programmer?

Alt Text

Now that you have your bearings on the world of programming, let’s discuss what you will actually need to learn to become a programmer. We will start with the fundamentals of programming on the whole.

In this section, we will discuss the following need-to-know concepts to become a programmer:

  • Programming languages
  • Coding syntax, vocabulary, and lingo
  • Data structures and algorithms

Programming languages

As we discussed earlier, a programmer writes code that a computer can understand and translate into binary. Just as we use different human languages to communicate, we also use programming languages to communicate with a computer. A programming language is a formal set of notations and rules that function similarly to a human language. They generate instructions and implement algorithms based on the predetermined rules of that language. A computer can then produce an output from that text.

Let’s introduce some of the most important programming languages that you should be aware of as a beginner.

The need-to-know programming languages

There are tons of programming languages, and they each serve different purposes, styles, and specializations. Many programming languages build off of previous ones, and some are developed for particular careers. For example, some languages are better for game development, while others are used for complex robotics.

In order to get you started, let’s get familiar with the ten most popular programming languages out there. Keep in mind that there are many more, and these lists are notoriously subjective!

If you want to get started with any of these languages from scratch, check out Educative’ free beginner’s courses on a variety of programming languages.

  1. Java: this is one of the older, more established programming languages. It is used in universities and large-scale businesses. Java is known for being cross-platform compatible. As programmers say, with Java you can “write once, run everywhere”.

  2. Python: this is a very user-friendly language preferred by many beginners. The syntax is simple and clear, so many newbies get started on Python. It is commonly used for machine learning, amongst many other uses.

  3. Ruby: similar to Python, this language is known for being beginner-friendly. It’s easy to read, and it was built on the notion that programming should be fun. Over the years, developers have expressed a consistent love for Ruby.

  4. JavaScript: this is a text-based language for web development. It must be run through a browser and an HTML document (the basic language of the internet). JavaScript is foundational to all websites.

  5. C: this is one of the original programming languages, so it’s like the parent language. C is known for being hard to learn, but it works great for high-performance applications.

  6. C++: this language is based on C and adds new features to the old language. It’s also an older one and is known for having a bit of a learning curve. Many universities still teach C++. Some developers say it makes learning other languages far easier.

  7. C#: this language, created by Microsoft, is based on C and C++ to make really robust things, like large websites. It is still a very sought-after language, especially for those who have a preference for Windows.

  8. PHP: this is a scripting language that uses HTML to make websites, but it’s taken off for a lot of other uses. It’s well-loved by programmers and web developers for its broad range usage and simplicity.

  9. Swift: this language, developed by Apple, is great for iOS and Mac OS apps. It’s designed similarly to Python and Ruby; it is simple and easy to learn. There is a general push to get more Swift programmers in the field.

  10. Objective-C: this is an older language that is being slowly replaced by Swift, but it is an important language for the history of software development. It is especially useful for creating applications on Mac OS X and iPhone iOS.

Imperative vs. Declarative Paradigms

As we mentioned, programming languages have different styles. In fact, every programming language operates according to a paradigm. A paradigm is basically the way that a computer will logically approach a problem. It is the style of that language. There are many different paradigms out there, and they all fall under two branches: imperative and declarative.

Alt Text

Image Source: DevTechnica

For imperative programming, you tell the compiler what you want to happen to your code. You give it all the steps, and it “listens” to your imperative commands. You give the instructions, not the desired outcome.

For declarative programming, you will write code that describes what you want to happen, but you don’t explain how to get that result. You give the outcome you want, not the instructions to get there.

As a beginner, there are really only two paradigms that you need to know about: Object-Oriented and Functional.

  • Object-Oriented programming is an imperative paradigm that largely dominates the field. In this paradigm, everything is treated like an object, a thing you can interact with or alter.

  • Functional programming is a declarative paradigm that thinks about data through sets of tasks, which we call functions.

Compiled vs. Interpreted Languages

A programming language isn’t the only tool necessary for communicating with a computer. After all, the computer "thinks" in binary. Compilers and interpreters take human-readable code and translate it to computer-readable code. A compiled language means that the machine directly translates the program that you input. These tend to be faster and more efficient but require an extra “build” step. An interpreted language, however, requires another program to read and execute the code, sort of like a middle-man. These are generally more portable and require less effort to change the code later.


Basics of coding syntax

Alt Text

Now that you're familiar with programming languages, let’s take a deeper look at how you write them. We will go over the key concepts and vocab terms to get you familiar with coding syntax.

Note: for these examples, we will be using Python for its readability, so keep in mind that other languages will look different!


Hello World

When you learn a new programming language, it is a long-standing tradition to write a program that outputs the phrase (called a string) Hello World!. In Python, there is a function that allows us to output a string. A function is like a task or command. Take a look at a few different languages below! If you want to test it out yourself, go to my original post for embedded coding environments.

Note: In many languages, you can use the # to make notes. The compiler will ignore anything after the number sign.

# Python syntax
print "Hello World!" 

Enter fullscreen mode Exit fullscreen mode
 # Ruby syntax
puts "Hello World!"
Enter fullscreen mode Exit fullscreen mode
# Java syntax
class HelloWorld {    
    public static void main( String args[] ) {
        System.out.println( "Hello World!" );
    }
} 
Enter fullscreen mode Exit fullscreen mode

Keywords

Just like any human language, a programming language has words with reserved meaning. That's how any language conveys meaning! Keywords are reserved words that have pre-determined meanings and uses. Each programming language has its own set of keywords, though there is a lot of cross-over. Python 3.7 has 33 keywords.

The keyword def, for example, defines a function (a task), and the keyword return runs that function and returns the result. Take a look below and try it out yourself once you understand how it works.

def my_function(): # defining our function
    return 2+3 # asking to return the operation 2 + 3

print (my_function()) # asking to print the answer
Enter fullscreen mode Exit fullscreen mode

Output: 5


Identifiers

Identifiers are similar to keywords, but these are the names that the programmer would create to label different entities in their program. We use these to differentiate one entity from another. To create an identifier, you must follow the syntactic rules as outlined by the programming language of your choice. For example, in Python, identifiers must follow these rules:

  • Identifiers can be a combination of lowercase letters, uppercase letters, digits (0-9), or an underscore
  • Keywords cannot be used as identifiers
  • Identifiers cannot include any special characters like !, @, &, $, %, etc.
  • They cannot begin with a digit

Note: Python is a case-sensitive language. This means that capitals matter. Variable has a different meaning than variable. This is not the case for all languages


Variables

Variables allow you to store information that can be accessed over and over again. These are similar to variables in algebra. But in programming, we name our variables according to the syntax of that language. Naming a variable is called declaring a variable. These are useful for any data or value that you want to use more than once. Take a look below and test it out for yourself.

name = "Amanda" # declaring the name
age = 23 # declaring the age

print (name) # asking to print name and age
print (age)
Enter fullscreen mode Exit fullscreen mode

Output:
Amanda
23


Data Types

As we have learned, programming is all about data processing, and each language has different kinds of data. Data types are like classifications that tell the compiler or interpreter how to use a piece of information. Let’s take a look at four commonly used data types to get a better sense of how they work.

Integers

Integers are numbers without decimals, just like in algebra. In fact, they can be used to do algebra in your programs. Integers can be stored in variables so we can use them over and over again.

number_of_bagels = 10 - 2
print(number_of_bagels)
Enter fullscreen mode Exit fullscreen mode

Output: 8

Lists
Lists allow us to store multiple variables in one group. This way, we can perform actions and functions to an entire list of data.

favorite_authors = ["Austen","Gladwell","Wilde","James"]
Enter fullscreen mode Exit fullscreen mode

Boolean
Boolean is basically a yes or no response. They will return either True or False. These can serve tons of different purposes, like comparing the equality of two numbers or variables.

print(10 > 20) 
print (10 > 5)
Enter fullscreen mode Exit fullscreen mode

Output:
False
True

Strings
Strings are commonly pieces of text in programming languages, such as our Hello World! statement They are written with quotation marks.

print ("Let's learn programming!")

Enter fullscreen mode Exit fullscreen mode

Operators

Operators are symbols that perform mathematical functions to your data. There are different categories of operators. The most important operators for you at this stage are the following:

Arithmetic (for simple arithmetic)

a + b = 30
Enter fullscreen mode Exit fullscreen mode

Assignment (to assign value)

c = a + b 
Enter fullscreen mode Exit fullscreen mode

Relational (for comparison, returning boolean values)

40 > 30
abc == abc
Enter fullscreen mode Exit fullscreen mode

Logical (to return boolean from a boolean input)

(2 < 3) and (2 < 5)
Enter fullscreen mode Exit fullscreen mode

Conditionals

Conditionals allow us to perform certain actions depending on a condition. We use booleans to determine if data meets certain requirements, and then define what the program should do if that requirement is or is not met. In other words, we want to tell the computer, “if this thing is true, do this other thing”. Take a look.

animal = "dog"

if animal == "dog":
    print ("Woof")
Enter fullscreen mode Exit fullscreen mode

Output: Woof


Functions

Functions are like actions or commands. These blocks of code only run when they are called, and you can set parameters into a function to return specific data. Functions must be defined using a keyword def. Once you define your function, you can use it to implement actions. The following function takes two numbers and repeats them a requested number of times.

def rep_cat(x, y):
    return str(x) * 8 + str(y) * 5 
    # asking to return a string with 8 x's and 5 y's

print (rep_cat(7, 2)) # defining x as 7 and y as 2
Enter fullscreen mode Exit fullscreen mode

Output: 7777777722222


Loops

With a loop, you can run the same block of code over and over again, for example, with a list to check the values. In Python, the most common loop is the for loop. The for loop basically states “for every item in the list, do this thing”. The loop will end once it completes its predetermined length if one is specified.

python_students = ["Ben", "Patel", "Asma"]

for students in python_students:
    print("Hi" +  students + "!")
Enter fullscreen mode Exit fullscreen mode

Output:
Hi Ben!
Hi Patel!
Hi Asma!

Now that you have a sense of some foundational coding vocabulary and syntax, let’s go one step deeper to learn about another important aspect of programming.


Data structures and algorithms

Alt Text

Data structures and algorithms are a key part of programming. Let’s briefly introduce these concepts and explain why they’re important. For now, it's far more important that you devote your time and energy to your programming language, but we want to familiarize you with these concepts as you learn, as they are foundational.

Data Structures

As we know, computers store and process large amounts of data, so the way we organize that data makes it easier to use and access information. Data structures are the way that we arrange data in a computer’s memory. Data structures use logic to organize information according to two concerns: firstly, how should we store data, and secondly, what actions will we perform on that data?

Being familiar with data structures makes you a more informed and efficient programmer, and your work will be far more optimized for whatever project you’re working on. Broadly speaking, data structures fall into two categories: linear and hierarchical structures.

  • Linear structures organize data in a linked fashion, where each element is attached to the one before and after it.
  • Hierarchical structures organize data like a multi-level pyramid or tree. As you can imagine, these data structures have very different uses.

Algorithms

Think of algorithms as a step-by-step process to solve a problem. They are sets of rules that are followed by your program to complete certain operations or calculations. Think of this as a recipe. An algorithm outlines a set of rules (the recipe) to get an expected output (the dish). Inputs are fed into the algorithm, and it implements various functions (tasks) to obtain that expected output. You can either use pre-existing algorithms or write your own.

Algorithms and data structures work together to serve different purposes for your programs. For example, since algorithms can be used to search or sort data, the way you organize your data will impact how quickly your algorithm can work.


Part 3: Coding Vocabulary and Lingo

Alt Text

We have our basic syntax down, and we understand how data and algorithms work on a basic level. Let’s move away from the nitty-gritty of programming and think a bit more broadly about the lingo and terminology you need to know to be a successful programmer and interact in the field. Let’s discuss the top ten terms that you will certainly encounter as you continue your journey.

Bug

A bug generally describes an unexpected error or mistake in your software or hardware. These can be malfunctions, defects, glitches, and the like. Bugs can cause an entire computer system to crash if they aren’t addressed properly. A lot of programming involves testing for and solving bugs. That process is called debugging.

Text editor

Text editors are where you write your code. They are like notepads on your computer where you can type a program and create files. There are many different types of text editors, as some are better for certain languages. There are common features that they all share, such as copy/paste capabilities, color coding syntax, find and replace features, and more. We will discuss text editors later on.

IDE

An IDE (integrated development environment) is a more robust text editor that includes many other features on top of a text editor “notepad”. These applications include a compiler, runtime environment, and debugger, so they are far larger than a text editor.

Source code

Source code is your program’s code. It is the human-readable instructions that you write as a programmer. This is the data that is then compiled and turned into binary machine code. All of the examples we provided above in Python are source code.

Open-source

The world of programming is filled with open-source content. This is basically software with a license stating that the source code can be used, modified, or changed by any coder. Open-source content and code are freely available and can be freely distributed. Most programming languages are open-source, so anyone can learn and build with them.

Refactoring

Refactoring is the process of changing a software system in a way that doesn’t change the actual behavior or output of the code. This is done to improve or optimize internal structure, for example, by simplifying certain blocks of code or adding a feature.

Runtime

Runtime, as the name implies, is the amount of time it takes a program to run on a computer. It is when the computer is executing the machine code. If something occurs “at runtime” (a phrase you will likely hear), it occurs as soon as the program begins. This is often where bugs will be discovered or abnormalities will become apparent.

Libraries

Libraries are open-source collections of prewritten code that a programmer can add to their program for certain functionalities. These are generally collections of functions and algorithms. Different languages have different libraries, and these are sometimes huge factors for choosing certain languages for a project. For example, a well-known Machine Learning (ML) library is written in Python, so ML engineers will often do their work in that language.

Frameworks

If a library is something you add to your code, a framework is something you put your code into. Think of this as a preset way to organize code. It is a reusable architecture that defines how certain entities will interact. Some programmers use these terms differently. In general, think of frameworks as the foundational platform, and libraries as the add-ons.

Tech stack

Programming includes a lot of different tools, from text editors to languages, to frameworks, and on. A tech stack is the specific combination of tools used to create web and mobile applications. As we talked about earlier, there is the front-end and back-end, so a tech stack will differ for each. Various companies use different tech stacks depending on their needs and goals. A common tech stack is called LAMP, which stands for:

  • Linux: server operating system
  • Apache: web server software
  • MySQL: database
  • PHP: programming language

Part 4: A step-by-step guide to learning programming

Alt Text

Now you have all the basics down, and you are familiar with the need-to-know terms. Keep in mind that more will come up as you learn, and that’s okay; Software development is packed full of abbreviations and lingo, so be patient. Take a look at our resource list for some go-to sites to help you out.

So, how does one actually learn programming? Let’s break it down step-by-step.

1. Pick a career goal

Your learning experience will be much easier if you have a clear goal in mind. This way, you get started with the right technologies. Try looking into different careers for software developers and seeing what strikes you. Once you have a sense of the kind of work you want to do, you can choose the right tech.


2. Choose a programming language

Beginners generally start with the languages Java, C, C++, Python, or Ruby, because they are so well documented or user-friendly. Some programmers recommend starting with C++ because it will make learning other languages much easier later on. Some programmers claim Python is the perfect language for beginners because it is easiest to make projects right away.

It’s all quite subjective, at the end of the day. Consider your priorities as you choose a language. Is it a high paying job? Do you just want to have fun? Consider what factors matter to you most.

For detailed research on programing language usage, check out StackOverflow's results here.

Alt Text

Image Source: Full Stack Academy


3. Choose the best learning platform for you

You can learn programming in a lot of different ways. The most common are at a university, through a Bootcamp, or through online courses and textbooks. There are obvious pros and cons to each learning experience. The choice depends on your learning style and priorities.

If you are a hands-on learner, for example, YouTube videos or textbooks will not be an effective strategy. On the other hand, if you’re not great at staying motivated, online classes may not be a good method. It all comes down to you.

A fancy university degree is by no means necessary to become a top-notch programmer. Educative, for example, offers hundreds of industry-standard courses on topics of all experience levels, created by real developers. On top of that, all of their “Learn a Programming Language from Scratch” courses are completely free.


4. Get the right text editor

You will need a text editor to get started practicing. This is where you actually write your code. There is no one tool to rule them all when it comes to text editors. Even well-seasoned programmers don’t just rely on one text editor or IDE.

You should absolutely do your own research on which editor is best for you, but to get you started, let’s outline a few of the most popular ones for beginners.

  • Brackets: this text editor is focused mostly on web development, so you can use it to code in JavaScript, CSS, and HTML (the languages of web dev)

  • Notepad++: this is one of the fastest, most lightweight text editors, known for being very basic and, therefore, excellent for absolute beginners. It supports multiple languages so you can try a few out.

  • ATOM: this open-source text editor is designed for JavScript, HTML, and CSS, so it’s a great choice if you want to learn web development.

  • Visual Studio Code: this editor was developed by Microsoft and comes with a lot of useful features. It can be used to code in Java, JavaScript, and C++. There are also extensions for other languages, like Python.

  • Sublime Text: this editor is much more stripped back to make learning easy. There are fewer fancy features to streamline the learning curve. Similarly, there are extensions for most programming languages.


5. Master your programming language

Now you can get started mastering the skills. The key at this stage is to get lots of hands-on practice and ask questions.

As you learn, try different platforms to figure things out. Take an online course to get lots of hands-on practice, and use a YouTube video to visualize an abstract concept. Try to focus on the problem-solving aspect of what you’re doing. If you can train yourself to think computationally, it will be much easier to master your language quickly.

Another way to master your language is to gamify your learning. You can learn through challenges, puzzles, and competitions. Some programmers swear by these as effective learning platforms. This will help solidify abstract concepts in a memorable way. Check out the resource list for more info.


6. Start making something

Once you get familiar with your programming language, it’s a good idea to jump right into a project. Here is why I recommend that you learn by making something:

  • It solidifies your knowledge. If there are gaps in your knowledge, you might not know until you try to run an incomplete program.

  • It will give you confidence. There is something satisfying about completing a project that you made with your hands. Chase that feeling.

  • You’ll build your portfolio. This is good for your career. Starting that process now and you'll have a robust portfolio in no time!

  • You’ll track your progress. If you’re actually making stuff, you’ll see all that you’ve learned. You in the future, now a master programmer, will look back at your early projects with a lot of pride!


7. Engage with the online community

One of the best things about learning programming is the amount of free support. Developers have only been able to learn because they have shared their knowledge, ideas, and experiences freely.

Find the community for your programming language and dive deeply into it. This can be through reading blogs, writing blogs, going to meetups, and so much more. Your learning will be far easier and more enjoyable. See the resource list for more info on online communities.


8. Keep exploring

Programming is a lifelong journey, and there is always more to learn, even after you master Java. There will never be a moment where you know everything, and that’s exactly how it should be! Programmers always need to reskill to stay relevant, so get ready for a fun journey of learning and exploring.


Part 5: Wrapping up and resources

Alt Text

Alright, that was a lot, so let’s summarize what we just learned. To learn programming, you should…

Learn the lingo and vocab

Pick a career goal

Pick a programming language and learn it hands-on

Get a text editor

Ask questions

Make a cool project

That’s it! It’s really not that hard to get started with programming, so don’t let it overwhelm you. Your knowledge will naturally build if you continue to seek understanding. The online community is always there to help! Let’s dive into some resources you can use as you learn.

Resources for beginners

Articles

Online Courses

Blogs and Forums

  • GitHub / StackOverflow: Open-access forums and discussion boards where a global community of programmers and developers share code, answer questions, and give feedback on projects.

  • Meetup: A search engine for local events that you can browse by category. Find events and learn alongside others.

  • Geeks for Geeks: a blog for all kinds of programmers to discuss anything from coding questions to interviews.

  • Dev.to: This is an open-access forum and resource for developers of all skill levels to get help, ask questions, and solve problems. Search communities by language or careers.

Online Dictionaries

  • EdPresso: Educative’s online dictionary for quick answers to common questions organized. These are organized by tags and have useful visualizations to help you learn quickly.

  • Whatis.com: a free, online dictionary for terms relating to coding and web development.

  • Foldoc: a free online dictionary for programming abbreviations and jargon

Coding Practice and Games

  • Codepen: A platform to build and test code

  • CodingGame: learn how to code through a video game that teaches you hot programming topics in 25+ languages.

  • CodeCombat: learn Python of JavaScript by working through a series of dungeons.

  • RubyWarrior: this is a great place for absolute beginners of Ruby to master the skills while navigating a game as a pixel knight.

Top comments (1)

Collapse
 
niha1222 profile image
NIHA| Areon

🚀 Calling all developers! Areon Network Hackathon is live and kicking. Register at hackathon.areon.network to compete for a share of the incredible $500,000 prize pool. Show off your coding brilliance! 💻💰 #AreonHackathon #DevCommunity