9 Things Every Programmer Should Know

Learn about some of the most important terms in programming — terms that every programmer should know.

Neil Smith
JavaScript in Plain English

--

Photo by Lukas from Pexels

You might be new to programming or you might have been programming for some time and still be confused with some of the jargon and terms used in software development.

In this article, I’ll share 9 things I think every programmer should know. This isn’t just for software developers but will be useful for anyone working in the software development industry.

We will go over things like:

How do you make changes to code? How do apps communicate and how do you get data from and save data to a database? How do you keep your app responsive? What is a framework? What is the Cloud? Where do apps run? How do you use other people’s code? What are dependencies? How do you automate tests and other checks on your code?

1. Git

Git is what’s used to backup your code and to save changes to your code. It's a type of version control software. It allows you to easily undo changes if you make a mistake and go back to any point in the history of your project.

It's very useful when you have multiple people working on making changes to the same code at the same time and can automatically combine those changes. Sometimes two people will make different changes to the same line of code. If you try to combine and merge these changes, Git will tell you there is a conflict. You can then decide whose changes you want to keep.

The code is stored in a repository and the repository can be saved locally or online. One of the most common places to store it is on the website Github. Git isn’t the only version control software, but it is the most commonly used. It doesn’t have to be used just for programming, it can be used for anything.

2. HTTP Requests And APIs

API stands for Application Programming Interface and basically just means how an app communicates with other apps and transfers data between them. HTTP is one of the most common ways of transferring data in apps, you make requests to the database to get data from it using a ‘GET Request’ or add data to it using a ‘POST request’.

Usually, there is a built-in function you can call that will create the HTTP request for you. You just pass in the data and the URL of where to send it to and whether it's a GET or POST request. The data is usually transferred in JSON format but can be sent in other formats as well. You might do something like this.

this.http.get(url)this.http.post(url, data)

You can also use HTTP requests to load up local files on your computer and store the result in a variable. You just replace the URL with the path to the file.

this.http.get(filepath)

3. Asynchronous Programming

Normally when code runs it executes each step one by one and waits for the previous step to finish before going onto the next step. Sometimes though something may take a long time to load or retrieve data from somewhere else. This would end up blocking anything else from running and make the app totally unresponsive. There may be some part of the app that needs this data but the rest of the app doesn’t and there’s no point in waiting around doing nothing.

To get around this you can let the app continue executing the rest of the code and make a promise to do something with the data once you get it. This way the user can still interact with the app and click around and you can display a loading spinner or something else in place of the thing you are waiting for.

You can set a variable e.g. loadingData to true just before you start loading the data and then set it back to false when it's finished and use this to determine when to show the loading spinner. You can specify what to do if it successfully loads the data and what to do if there is a problem and it fails to load the data. You might see something like this.

this.loadingData = true
this.http.get(url).subscribe(
(data) => {
// Do something with the data once finished loading it
this.loadingData = false
},
(error) => {
// Print out the error message if it fails to load
console.log(error)
this.loadingData = false
}
)

HTTP requests and loading files up from your computer are really slow tasks where you need to do this to ensure the app is responsive for the user.

4. Languages Vs Frameworks

A Language (e.g. JavaScript) is the particular language you write code in. A Framework (e.g. Angular, React Native) is a particular way of building an app in that language. There are many different ways you can build an app using the same language. A Framework defines some rules on how to put together your app.

For example, in Angular web apps, you must split up your app into components and services. Components are the things that are actually shown in the UI. Services are used to store data and commonly used functions. Components get data from the services and display it in the UI.

You don’t have to use a framework, but they are there to help you get going making your own app and handles many things for you so that you don’t even need to know about them and can focus on what's unique about your app.

5. Cloud

The cloud basically refers to running code on someone else’s computer somewhere else online instead of running your app locally on your own computer. Things like AWS and Azure allow you to pay to run and rent a wide range of software on their own computers.

You can run your whole app on their servers or just pay to add some additional functionality to your app and it can be a great way to set up an app quickly without having to set up everything yourself from scratch. You then don’t have to worry about things like making sure your app can handle many users and that it stays up and running all the time.

6. Ports

Ports are where apps actually run on your computer. There are usually 1000s of ports available on a computer allowing it to run many different apps at the same time. You can’t run more than one app on any given port, but you can have multiple copies of the same app running on different ports. The first few ports of your computer are saved for important critical apps that your computer needs to even run.

When you run an app locally it runs on a port of your computer. It should say which port it runs on when you start it up. There will be a settings file where you can change this.

Say you start a web app that starts on port 8080. You can access it by opening up a web browser and going to ‘https://127.0.0.1:8080/’ or ‘https://localhost:8080/’.

When you access a website online in your browser you are actually redirected to a particular port on a computer somewhere else that’s running that app. To handle many users trying to access the same app at the same time there will be many copies of the app running and you will be redirected to one of the least busy apps.

7. Package Managers

Package managers are software tools that you can use to install extra software and extra libraries of code to use in your app. There are many different package managers, different ones for each programming language. To install a library you usually just have to type something into the command terminal.

One of the most popular package managers used in web apps is Node Package Manager or NPM. You can install any package listed on the official NPM website https://www.npmjs.com/. To install a package you just have to type

npm install <package-name>

Into the command terminal. It's very similar for package managers of other languages. Once you’ve installed it you can then just import it into your file.

8. Dependencies

The dependencies of your app is just the list of other people’s code that you use in your app. There will be a file somewhere within your app with a list of all the packages or libraries of code that are used in your project and which versions. For example, in Angular web apps, there will be a file called package.json. In this example, you can see version 9 of Angular is used and you can also see some other NPM packages like core-js.

Further down there is also a list of packages used just in development when working on the app. These are things like software for writing tests and looking after the formatting of the code.

In the package.json you don’t have to specify an exact version. The caret symbol ^ before the numbers means to use this version or any version above this. When you use npm install it will automatically choose what exact versions of all the packages to use based on their compatibility with each other and then create another file, package-lock.json, with the exact versions that are used in your project. You can just specify a specific version in the package.json file by leaving out the caret symbol.

9. Pipelines

Pipelines are used to automatically perform a series of actions on your code. This is normally used to automatically run tests and other code checks before anyone merges in the changes they have made into the main branch.

There’s usually a file with a name ending in .yaml with the list of tasks that are done. As an example, here’s part of an Azure pipeline file. Inside is a list of steps to do. First, it installs the app, then it checks the formatting, and then runs some tests.

Summary

Git — How you backup and save changes you make to your code and makes it easier for many people to work on making changes to the same code at the same time.

HTTP Requests — How you transfer data between apps and how you save data to and get data from a database.

Asynchronous Programming — You make a promise to do something with some data once it's finished loading. In the meantime, you let other code run.

Languages Vs Frameworks — Languages define the rules for how to write code and Frameworks define a way of building an app in that language.

Cloud — Pay to run software on someone else’s computer. It could be their own software they provide or you run your own code on their computer.

Ports — Where apps run on computers.

Package Managers — Used to install extra code packages made by other people.

Dependencies — All the different code packages used in your project. There is a list of packages used in the released app and packages only used in development.

Pipelines — Used to automatically run tests and other checks on your code before you merge it in.

More content at plainenglish.io

--

--