Your Guide To Computer Science Fundamentals

Your Guide To Computer Science Fundamentals

What they are and why you need them

Many people tell you to "learn the fundamentals," but sometimes, it is difficult as a beginner to even remotely grasp what that means. And that is okay.

This article is going to show you what at least I think the most important fundamentals are.

What Are Fundamentals?

Fundamentals are concepts, and maybe even techniques, that you can apply in multiple areas and multiple programming languages. They are not tied to anything specific and are sometimes pretty theoretical.

All in all, they are the foundation you can base more specific knowledge on. All programming languages build on those fundamentals and give you a particular way to work with them.

What Exactly Are Those Fundamentals?

Here is a list of the most important ones:

  • How a computer works
  • What a programming language actually is and does
  • Logic (yes, separately)
  • Math (basics!)
  • Algorithms
  • Data Structures
  • Networking / I/O

You do not need to be a pro in all of them right at the beginning of your career, but you will still need them all sooner or later, and they are transferable.

If you know how to write algorithms in JavaScript, you also know how to write algorithms in Python. The syntax might change, and one language might offer different syntactic sugar than the other, but an algorithm is still an algorithm. We'll go over each point specifically, now.

How A Computer Works

You work with a computer, and you write instructions that tell the computer what to do.

Knowing how computers work is essential to understand what you actually do. How each instruction you write leads to some electricity flowing through your computer's circuits, that each variable you declare and assign a value to leads to something being stored within your computer's memory and later in the CPU's cache.

If you know how a computer works, you have placed the first important stone of your foundation.

What A Programming Language Actually Is And Does

When you have a basic understanding of how a computer works, you need to understand that the high-level languages most of us work with, do a lot to abstract away low-level details.

A statement that takes one line in Python or JavaScript is more code within the runtime and even more machine code. Understanding what a runtime is, helps a lot, too. Not all languages compile to machine code.

Understanding what a programming language actually is helps your overall understanding of programming itself.

Logic

Even if you never implement a single mathematical expression, you do logic or better boolean algebra all the time.

if (conditionIsTrue) {
  doThis();
} else {
  doThat();
}

This is boolean algebra and mathematical logic. And although some articles state that they can show you how to write code that never needs an if-statement, the data structures used to accomplish this still use if-statements under the hood.

The code you write usually works because you use logic to decide when to do which action.

Math

We already covered logic separately because it is so important (imho), but math itself is also necessary. I do not talk about those complex mathematical expressions that use so many symbols that they look as if no one could ever solve them. But sooner or later, you will need some of it.

You do not need to be a math pro, but an addition or a multiplication here, another division or subtraction there, or knowing how to calculate the center of your viewport can be pretty beneficial.

Computer Science is math. Knowing basic math will serve you well throughout your whole career.

Algorithms

This is your bread and butter. Most universities or courses use data structures to teach you algorithms, but everything you implement is an algorithm. Even if your function only changes the color of a button, it is an algorithm.

Learning how to solve a problem so that a computer can understand and do something based on the statements and expressions you provide is learning algorithms. Learning those together with data structures is advantageous because it touches a lot of algorithmic fundamentals. Iteratively solving a problem, or using recursion, or applying divide & conquer, is easily touched at least once while learning data structures or search and sort algorithms.

Algorithms are your most important tool. Every line of code you write is part of an algorithm.

Data Structures

You need them. Not all of them, but many. Knowing what arrays, lists, sets, hashtables, heaps, and trees (once again non-exhaustive) are and what traits they have, does only benefit your day-to-day work.

For some interviews, you even need to know them in and out because of companies testing for knowledge of them. I do not tend to agree with this practice but view it as a necessary evil.

Nevertheless, knowing at least what they can do for you can only help you write efficient code. If you know that you only want unique values, why should you filter an array repeatedly if a set already does this for you? That is less work for you, and a few potential bugs prevented.

Data structures are your second most important tool. They abstract a lot of complexity away when handling data.

Networking / I/O

We live in a distributed (and global) world, and so do most applications you create. Your frontend talks to a server and gathers data or starts some background processing, or your API talks to another API.

All this traffic goes through a network. Having at least some basic knowledge about networking and network I/O helps you understand that all of this comes at a cost. Your JSON string needs to get serialized first, put into an HTTP message, then travel down to your network interface, through your local network, then reach your point of internet access, travel through routers...and this goes on and on.

If you ask yourself why you need this, knowing this might help you understand the following scenario:

  1. One request is sent to a remote API
  2. The same request is sent to the same remote API again, 2 seconds later
  3. The second request returns a response
  4. The first request returns a response a second later.

All this does not need to have anything to do with the server, but with the routing of your request, although in reality, it will be more like a few milliseconds delay than seconds. Knowing the basics of networking can help you understand such a scenario.

You also need to cover disk I/O, at least a little. Knowing that sequential file access is pretty fast because the OS and disk are optimized for this, and random access can be pretty slow might help you to implement something that uses exactly this to its advantage.

Networking and I/O become important as soon as you leave your local machine and use networks or the internet. All this creates another layer of complexity. If you understand it, your life becomes way easier.

Conclusion

Every single point I covered above is something you can apply in any language. You can learn it while learning a specific language, but you will never have to relearn it for another one.

You might use different functions/libraries/frameworks to accomplish the same in different languages. However, an algorithm is still an algorithm, and a data structure is still a data structure. A set has the same traits in all languages, as well as a map. The network does not change when you switch from JavaScript to Python or C, C++, or whatever the language is.

And one last time: You do not need to know all this before you start with a language. You can learn it on the fly while learning a language, but it should be your goal to get comfortable in all of this at some point. You will need it.

Once you are comfortable in all of this, it becomes so much easier to switch languages because you only have to learn a new syntax and standard library.

Show Your Support

If you found this article interesting or helpful, leave a like, and follow me for more like this. It would mean the world to me!

If you would love to read even more content, feel free to visit me on Twitter.