Abstraction vs. Algorithm: Differences?

Here’s everything about the differences between abstraction and algorithm:

An algorithm is a list of logical steps that you can follow to solve a problem.

An abstraction includes all of the things you have to figure out before you could construct the algorithm.

Abstraction is gathering data, defining terms, and figuring out relationships, while algorithm is where you actually crunch numbers.

So if you want to learn all about how abstraction and algorithm differ from each other, then this article is for you.

Let’s jump right into it!

Abstraction vs. Algorithm: Differences? (Everything to Know)

What Is an Algorithm?

Working with flow chart of logical steps for computer software

To compare abstractions and algorithms, we’re going to get into decently high-level scientific concepts.

There’s going to be some deep thought involved with this one, but before we can really dive in, I think it will help to narrow the discussion a little.

Abstracts and algorithms show up in math, science, philosophy, and pretty much any place that can involve problem-solving.

While there are a few universal ideas across all of these applications, each field tends to look at algorithms and abstractions a little bit differently.

To avoid confusion, I’m going to focus on the computer science take.

Computer science has probably developed these ideas more than any other field in the last couple of decades (although that is a very arguable take), and these concepts are fundamental in the computer science space.

Also, computers make the needs and applications of algorithms and abstractions a little easier to understand (at least in my opinion), so that’s going to be the focus.

You can still take these ideas and apply them outside of computer science, but if you have some familiarity with them, and things seem a little different in the explanations you read, this choice of focus is probably why.

With all of that said, let’s talk about what an algorithm is.

In simplest terms, an algorithm is the set of instructions you follow to solve a problem.

Notice that I said “you” and not a computer.

Computers definitely use algorithms, but before an algorithm is added to a computer program, it is usually figured out in a general sense.

As a programmer, you should be able to follow the algorithm yourself and still get the right result.

The algorithm is how you reduce the solution to a problem to a reliable, repeatable set of logical steps.

It’s the recipe for success, somewhat literally.

When you follow a cooking recipe, you’re actually following an algorithm.

In computer science, the algorithm is defining the order of steps a computer needs to take to complete a task, but I really want to emphasize that algorithms exist outside of computer programs, even in computer science.

What Is an Abstraction?

Programmers brainstorming at an IT company

If algorithms still aren’t perfectly clear yet, I’m going to take you through some examples that should help.

Before that, let’s go ahead and define an abstraction.

If you’re familiar with the word “abstract” then you might expect an abstraction to be a weird concept.

You’re right.

It’s a term that is used to talk about how we define things in computer science.

Think of it this way.

You’re going to write a computer program that helps someone figure out what to eat for dinner.

In order to succeed, you’re going to have to figure out how to define a bunch of things in a way that a computer can understand.

What is food?

What are ingredients?

How do you write a program that can choose one dinner recipe over another or one restaurant over another?

Those questions are all answered through abstraction.

Abstraction isn’t a concrete thing that you can follow like a recipe.

Instead, it’s the process (sometimes a very undefined process) of conceptualizing things in a way that can lead to an algorithm.

Abstraction is where you figure out what information is needed, how that information can be arranged, and how to represent that information in computer terms.

If you really think about it, that’s a lot.

Abstraction is a huge concept, and it’s not something that will truly reduce down to the few words I’m dedicating to it in this article.

It’s a broad concept that you really have to take some time to pin down effectively.

Fortunately, we don’t have to spend a few years majoring in computer science to really get it.

I can point out some of the most concrete differences between abstraction and algorithms and take you through a couple of examples.

By the time we’re done, you’ll get it.

What Are the Major Differences Between Algorithm and Abstraction? (3 Things)

Team leader working and guiding members with project

There are a lot of ways to phrase this, but the main difference you’ll see comes up again and again.

Abstraction is where you kind of figure out everything that you will need to build an algorithm while the algorithm is the logical process that actually solves the problem.

The two go hand-in-hand, but as we go through some examples, you can see the clear delineation that exists between abstraction and algorithm.

#1 Definitions

Smart business lady  working on a new coding project

One way to look at abstractions is through a narrower lens.

When you build a computer program, you’re mostly focused on the algorithm.

You’re trying to figure out the steps the computer needs to take in order to arrive at the right solution.

It’s very logical and, at least conceptually, straightforward.

But there’s a huge wrinkle in the process.

Algorithms usually involve variables.

These are the things that can be different each time you run the program.

Even though the steps don’t change, the information being processed might.

Consider software that helps you figure out your taxes.

You can use the same algorithm as millions of other users.

The software has clear steps that figure out what you owe or what is owed to you, and it’s very reliable.

The only real difference between you using the software and someone else is the numbers that you type in.

How much money did you make?

How did you make it?

Have you paid any taxes so far?

You answer those questions, often with numbers, and then the algorithm can handle the rest.

Abstraction is the process the programmers used to figure out how to define everything.

When you use the program, the computer understands what tax deduction is.

But it only understands that because the programmers were able to define it.

That was abstraction.

Figuring out what variables needed to be in the program and how to make them make sense to the computer.

Any time you use a program and put information into it, you’re dealing with abstraction.

You’re not practicing abstraction; instead, you’re interacting with a variable that originally had to be figured out through abstraction.

#2 Calculations

Computer monitor showing code and calculations for a software

Let’s look at this from another direction.

Let’s say that you want a computer program that can calculate something specific for you.

Maybe you’re a healthcare researcher and you want to try to put some hard numbers on how effective a new drug is during a trial.

The algorithm is once again very clear.

It’s just the list of steps the computer has to follow to plug data into the formulas in order to spit out the numbers you need.

The thing is, this particular type of calculation requires a whole lot more data than the tax software example from before.

In this case, the computer needs to bring in huge data sheets from the trial (we’re assuming it was a big study for this example).

You don’t want to manually enter all of that data every time you try to run the program.

Instead, you want to automate the use of the data, and it might even be nice if the program can automatically import updated data if and when that is necessary.

We’re back to abstraction.

Another aspect of abstraction is figuring out how to put numbers or information into a computer program.

You’re going to use abstraction to figure out how to digitize the data from the trial.

You’re going to use abstraction again to think about the best way for the computer to import that data and run it through the program.

#3 The Math Example

Young female programmer thinking about the steps and variables of the project

Hopefully, these ideas are taking shape.

Algorithms are always just the list of steps the computer needs to follow.

Abstractions are more complicated and broader, but we’ve seen a few specific applications.

This next example is all about math, and it should really hammer down what an abstraction is and how and why it is different from an algorithm.

Let’s say that you’re charged with creating an app that will help a local delivery service optimize its driving routes.

In order to do this, you will need to figure out how to get deliveries to their destinations while also optimizing fuel efficiency.

This is not a simple problem, and your solution has to be dynamic.

It has to take into account changing traffic conditions, order volumes, and plenty of other variables.

Abstraction is a huge phase of app development in this case.

During abstraction, you’re going to try to get good data on the fuel efficiency of the vehicles involved.

You’re also going to source as much data as you can on order volume, average delivery distances, possible routes, and plenty of other things that you think about along the way.

On top of that, you’re going to take all of that information and try to come up with a mathematical formula that puts it all together.

That way, when the app is done, you can plug in a few details, and the formula will tell you the best route.

All of that is abstraction.

The algorithm comes in later.

Once the variables are defined, the needed data is available, and the mathematical formula is already written, you will come up with an algorithm that tells the computer how to use the math formula to spit out an answer. 

Abstraction is how you conceptualize things.

Algorithms are how you automate solutions.

Let’s rephrase all of this one more time to really drive it home, and we’re going to do it with an idea that isn’t strictly computer science.

If you remember back in math class, you would sometimes have word problems.

You would read the word problem and pull some numbers or variables out of it and eventually settle on a formula.

That’s the abstraction process.

The algorithm part of solving a word problem is when you plug numbers into the formula, follow the rules of math, and get a final answer.