Computer Science

What Is Abstraction in Computer Science? [And Why Does it Matter?]

What Is Abstraction in Computer Science? [And Why Does it Matter?]
The levels of abstraction are useful because they allow people to work on systems without needing a granular understanding of those systems. Image from Pexels
Christa Terry profile
Christa Terry January 30, 2021

Abstraction is a challenging comp sci concept that leaves many people scratching their heads. We dug into exactly what it is and why it's so hard to understand.

Noodle Courses

Article continues here

The question 'What is computer science?'can lead you down a rabbit hole of further queries. Comp sci is a complex discipline because it is made up of fields and subfields that can be broken down into elemental concepts expressed using mathematics. Consequently, mastering computer science takes years, and even experts disagree on how to define fundamental concepts.

Take abstraction in computer science. It's often described as the creation of well-defined interfaces to hide the inner workings of computer programs from users. According to the BBC, however, it's the process of identifying the general characteristics needed to solve a problem while filtering out unnecessary information. The Valuable Dev writes that abstractions "simplify a process or artifact, by providing what you really need, and hiding the useless details you don't care about."

Confused? You're not alone. Abstraction in computer science is such a baffling concept in part because there are multiple accepted definitions. It's a catch-all term that can be applied in different ways in multiple contexts, making the concept of abstraction itself an abstraction. That means the best way to understand abstraction—a concept you'll encounter if you decide to study computer science—is to look at the different ways it's used.

In this article, we dig into the question 'What is abstraction in computer science?' by covering:

  • What is computer science?
  • What is abstraction?
  • What are levels (or layers) of abstraction?
  • What is data abstraction?
  • What is control flow abstraction?
  • Examples of abstraction in computer science
  • Computer science degrees
  • How hard is computer science?
  • Why computer science is important
  • Top master's in computer science programs
  • Top online master's in computer science programs

What is computer science?

This is a surprisingly tough question to answer. Computer science is an interdisciplinary field in constant flux because our understanding of technology and its applications is evolving. Everything from hardware engineering and network architecture to cyber security and algorithm design is part of computer science, as are artificial intelligence, computational biology, and quantum computing.

Some assert computer science is an academic discipline that blends scientific inquiry, engineering, mathematics, and technology. Others say that it's largely practical, important mainly for its potential to change the world. Both opinions are valid. Distinguishing between computer scientists and people who work in computer science is easy. Drawing a hard line between what is and isn't computer science is more difficult because the definition of computer science changes depending on whom you ask. However, it's always broad.

Computer science definition

Purists define applied computer science as the study of computational processes and machines, and theoretical computer science as the study of computational thinking itself. The problem with the purist's definition is computer science is also a practical discipline. Some computer science professionals are researchers, but most aren't. In common usage, computer science is an umbrella term encompassing not only the study of computers and computing but also their practical applications.

What is abstraction?

Abstraction is everywhere you look in computer science, but it means different things in different contexts.

One way to think of abstraction is as synonymous with generalization. You take something and separate the idea from its implementation. If, for instance, you wanted to create a program to multiply five times six, you wouldn't build an application to only multiply those two numbers. Instead, you'd create a program capable of multiplying any two numbers. To put it another way, abstraction is a way of thinking about a function's specific use as separate from its more generalized purpose. Thinking this way lets you create flexible, scalable, and adaptable functions and programs.

Another way to think of abstraction is in terms of what you (or users) need to know or see. In "Introduction to Computation and Programming Using Python," John Guttag writes that the "essence of abstraction is preserving information that is relevant in a given context, and forgetting information that is irrelevant in that context." Software developers use subroutines or monads—both of which are functional abstractions. Database users routinely encounter view-level abstractions that simplify their interactions with the database. An operating system is an abstraction of the code underneath.

Abstraction is also used to create functions to camouflage most of the mechanisms driving the function. That doesn't mean the process of abstraction is the same as encapsulation or information hiding (i.e., simply putting the implementation details of a function behind an interface). What makes abstraction useful in this context is that it allows developers to create functions that can be updated or improved without disrupting the application and be used in other places. In object-oriented programming, abstraction helps reduce risk in software development.

What are levels (or layers) of abstraction?

Levels of abstraction are common in computer science, with each layer representing a different model of the same processes. The lecture notes of the University of California - Berkeley's CS 61A course (circa 2010) lays out the hierarchy of abstraction in computer science like so:

  • Application programs
  • High-level language
  • Low-level language
  • Machine language
  • Architecture
  • Circuit elements
  • Transistors
  • Solid-state physics
  • Quantum mechanics

One way to think about each level of abstraction is that higher levels (where you'll find applications and user interfaces) are designed with people and their thought processes in mind, while lower levels represent the way computers work. Each layer builds on the next, so levels can exist without the ones above but not without the ones below. There are no transistors without solid-state physics, but programming languages exist whether or not you use them to build software systems.

The levels of abstraction are useful because they allow people to work on systems without needing a granular understanding of those systems. You can, for example, create perfectly functional software without knowing the first thing about how logic gates work.

What is data abstraction?

In programming, it's a good idea to not only separate data from functionality, but also reduce the complexity of data. Data abstraction is the process of creating simple abstract data types, or classes, to hide unnecessary details. Simplification makes different-but-related data types with multiple attributes easier to access and manage, and gives different systems a common language for talking about an object even if they act on that object in very different ways.

What is control flow abstraction?

Control flow is a way of describing the order in which function calls are executed. Code runs in the order it's written unless a programmer introduces control structures like conditionals or loops to change the order of execution. Control flow abstraction involves applying the principles of abstraction to a set of operations. The program fragment is designed around a function rather than its implementation in a particular application, so it's available for reuse. Subroutines are a good example of control flow abstraction in action.

Examples of abstraction in computer science

First, let's look at an example of abstraction that's not part of computer science. Numbers are abstractions most of us are entirely comfortable with. Even young children understand how numbers can succinctly represent elements of everyday experiences. If you ask a friend, "How many pizza slices are left?" and they answer "Four," they've conveyed the relevant information without involving any background detail. But 'four' can also refer to the time of day or the number of apples on the table or the atomic number of beryllium. That's abstraction in real life.

In computer science, you might have a sort algorithm that works on linear data structures (e.g., lists). You can sort array-backed lists, linked lists, or other lists. Your list might be made up of five items or five hundred. The code isn't tied to specific use cases, but to the idea of 'sorting'. Put simply, you don't have to code one sort algorithm for five-item lists and another for five hundred-item lists because you've tied functionality to an abstraction.

APIs are a type of abstraction you might be familiar with. An API is an intermediary that allows applications to communicate but abstracts the details of what is being communicated and how—simplifying the process of application-to-application communication and providing a level of security.

Still following? Then you probably have the kind of aptitude for computational thinking associated with success in computer science degree programs and comp sci careers.

Computer science degrees

Professionals in computer science typically have one of three degrees: a Bachelor of Science in Computer Science (BSCS), a Master of Science in Computer Science (MSCS), or a PhD in Computer Science.

Full-time and part-time comp sci programs at the bachelor's level prepare students for all kinds of tech-focused roles. Core coursework usually touches on topics like:

  • Algorithms
  • Calculus
  • Computer architecture
  • Computer engineering
  • Data structures
  • Linear algebra
  • Logic
  • Programming
  • Software development
  • Statistics and probability

There are two types of computer science master's degree programs. The first is the MSCS for non-CS majors. On-campus and online computer science programs for non-CS majors cover the same ground as bachelor's programs (e.g., programming, database administration, and software engineering fundamentals). The second is for students with an academic or professional background in comp sci. These programs skip over basic concepts in favor of advanced material and are more likely to have specialization tracks that take a deep dive into one area of applied or theoretical computer science.

Computer science doctorate programs are typically project- or research-focused and built around independent study guided by each student's area of interest. The education PhD candidates receive is designed to teach them how to apply the fundamentals of scientific inquiry to computing, not new coding skills or computational theories. Do you need a doctorate? It depends. Earning a doctoral-level computer science degree is only really necessary if your goal is to go into research or academia. On the other hand, some pretty high-profile tech companies (e.g., Google) are known for hiring PhDs.

How hard is computer science?

Top computer science degree programs have classes designed to weed out all but the most dedicated students, but aptitude may be just as important as intelligence and dedication. Many people enroll in comp sci programs because they like programming or building computers only to discover computer science is essentially a branch of mathematics at many schools.

"CS isn't about being good with computers; it's basically solving math-like problems from scratch," writes one commenter in a Reddit thread about whether comp sci is hard.

Another added that "to be successful at it, you need to be able to think in a very logical way, and also be able to break complex problems down into smaller parts. There are some people that just aren't naturally good at that."

If you don't have an aptitude for logic and mathematics, pursuing a degree in comp sci (versus software engineering or computer engineering) will test the limits of your intellect and patience.

Unless you plan to pursue a career in theoretical computer science, however, your experience in the real world will be very different. Computer science jobs can be more fun and less stressful than the average comp sci degree program.

Why computer science is important

Comp sci is more than just the study of computers and computation. That definition is a useful abstraction—see what we did there?—but it doesn't begin to describe the scope of the impact this discipline has on our lives. We buy everything from theater tickets to thumbtacks online. Our television viewing habits are influenced by algorithms. We let computers control our homes, and we drive cars built by robots. Business is conducted over vast global networks. The financial sector operates using 1s and 0s instead of dollars and cents.

Applied and theoretical computer science is a major driver of innovation in myriad industries, and technology is increasingly a part of everyday life. This has led to a huge uptick in demand for computer scientists and other people with tech skills, and the need for developers, analysts, administrators, and architects is only going to grow.

Top master's in computer science programs

U.S. News and World Report maintains a list of the best colleges and universities for computer science at the graduate level. The following schools are home to some of the top MSCS programs in the United States:

Top online master's in computer science programs

The best online master's in computer science programs do a lot to replicate the on-campus experience. The coursework is the same, and the same professors teach classes. The computer science department and alumni groups host virtual events so students can connect with industry leaders and one another. And distance learners receive the same level of career support as students who took classes on campus.

These schools are home to some of the top online and hybrid computer science master's programs:

Hopefully, you're feeling a little more confident after reading up on computer science in general, abstraction in particular, and what earning a degree in comp sci entails. You still have some research to do if you're thinking about enrolling in a BSCS or MSCS program, however. The good news is once you choose a specialty area and a school, chances are good you'll have a long and lucrative career ahead of you. Computer science professionals are in demand, and there are thousands of well-paying computer science jobs waiting to be filled by people who are comfortable with concepts like abstraction.

Questions or feedback? Email


Noodle Courses