There are people that will tell you that Computer Science fundamentals are arcane concepts that are not practical in the real world.

I get why people like to talk this way.

CS concepts; like trees, algorithms, and recursion, aren’t nearly as fun to talk about as exciting fringe technologies.

But if you start digging into how software actually works in the real world, you’ll find that there are a ton of cases where computer science plays a significant role.

Every developer needs a programming tool belt, a set of skills that allows you to solve the various software problems that you’re faced with.

ReactJS could be a tool in your tool belt.

JavaScript or Ruby on Rails could be one too.

If you’re trying to become a developer, you should think about CS fundamentals as an additional tool. An understanding of them will help you solve problems in a smart, efficient, and useful way.

In this post, we’ll dive into 3 really important CS concepts that you’ll need in your tool belt in order to solve a lot of the problems that come your way.

Let’s get into it.

Trees

If you spend time on the internet, you’ve probably come across a comment system web application, like Disqus. Web applications like Disqus help facilitate online discussions and make them easy to follow by using a reply functionality.

How do you enable this to happen?

Computer science! That’s how.

In computer science, there is a concept known as Trees. Trees are an abstract, but incredibly useful programming structure. They’re a “recursive” data structure, which essentially just means that the definition of a tree involves… the definition of a tree.

You can think about the Trees concept like a family tree. As a person, you have two biological parents. Each of your parents probably has two biological parents too.

If you map out your family tree, you’ll see that each person is connected to multiple other people.

This organizational structure is incredibly useful for a ton of real world applications, like commenting systems.

Let’s return to the Disqus example.

If you were to design a commenting system, you’d want to have many levels of replies. A comment should have a parent comment, and a number of children, which are sub-comments.

Trees are what allow you to do this.

If you understand how to effectively use tree structures, it becomes way easier to figure out simple scenarios like this, in which you want to map the relationship of replies to initial comments.

Trees also help you with far more complicated scenarios, like writing sorting algorithms.  

Optimal Algorithms

Fortunately, Computer scientists have found optimal solutions for a lot of software problems. This means that if you understand the solutions, you won’t need to start from scratch in order to solve certain problems.

As an example, think about how you would go about looking up a specific name in a phone book. If the phone book contains a million records, the simplest solution would be to go through the entire book from start to finish. This would ensure that you’d find the specific name. However, in the worst case scenario in which the name is one of the last names in the phone book, you’d need to do nearly 1 million comparisons in order to find it. This would be an incredible waste of time.

Instead, you should rely on a different solution, one that exists because of computer science. To find the name in the phone book, you could use a smart Binary Search Algorithm, which would guarantee that you could find it in at most 20 comparisons.

At the scale of a 1 millions records, that puts the optimal solution at 50,000 times more efficient than the simplest solution. It only gets more efficient as the list scales to more records.

Pretty much every application out there uses algorithms to find information in more effective ways.

So, if you’re a developer who understands how to approach problems the way that computer scientists intended, you’ll be able to write code that is much more efficient than a developer who doesn’t understand algorithms.

Recursion

Recursion is a method of programming that comes in handy in a variety of different situations. It’s a computer science trick that’s based on a divide and conquer (D&C) mentality that breaks a complex problem into more specific subproblems of a similar type.

Let me get into what that actually means.

Recursion is all about thinking about things that are related. You can describe it by making rules of nested elements. A famous example is saying the rule:

All boats should have a lifeboat in case the boat sinks.

If you go a step further, the lifeboat itself should have a lifeboat. And that lifeboat should have one, too. Things that are recursive in nature have an endless process.

Another real world example of recursion is a Russian matryoshka doll. You know, those little dolls that are nested within another doll.

via GIPHY

By using the divide and conquer programming mentality of recursion to solve problems, you’re able to solve difficult problems with simple code.

This is something that comes up all the time for developers.

On top of that, it’s pretty common to be expected to know how to use a recursive approach to solving problems while on the technical interview, which is the only thing between you and your new job as a developer.

Trees, optimal algorithms, and recursion are 3 aspects of computer science that help developers solve everyday problems.

But not all aspects of Computer Science are applicable to everyday programming!

Despite having plenty of aspects of Computer Science that are useful in everyday type work, there are some aspects of computer science that aren’t practical in day-to-day coding.

In college, I majored in Computer Science. In the process of getting my degree, I learned some stuff that I never used and pretty much immediately forgot. I’m talking about things like:

  • Deterministic & Non-deterministic Finite Automata
  • OSI Network Layer Protocols
  • An emphasis on how databases are built, vs. actually using them
  • Calculus, Physics, and electives

There are plenty of reasons why getting a Computer Science degree can make sense.  

But it’s important to know that you don’t need a CS degree to learn the practical aspects of Computer Science fundamentals that will give you the foundation you need to become a developer.

Some coding bootcamps teach essential computer science fundamentals.

We do it at Firehose. We do it because we’ve always believed that an understanding of these foundational skills is key to landing your first developer job and setting yourself up for a long and successful career.

An understanding of things like trees, algorithms, and recursion, are an essential part of your developer tool belt. If you don’t have them, it’s easy to fall into the trap of things like:

  • Doing more work than is necessary (writing more lines of code)
  • Finding solutions that aren’t as optimal
  • Not applying well-known correct solutions to your problems

If you want to become a programmer, spend time learning the Computer Science fundamentals that matter.

It might not be the flashiest stuff. But it helps you solve real-world problems and will pay dividends as you move forward in your career as a developer.

Learn more about the Firehose approach to teaching key CS fundamentals on our curriculum page.

 

AuthorKen Mazaika

Ken Mazaika is the CTO and co-founder at Firehose. Previously, he was a tech lead at WHERE.com (acquired by PayPal) and a member of the PayPal/eBay development team in Boston.

One thought on “You Can’t Solve Real World Coding Problems Without These 3 Computer Science Fundamentals

Leave a Reply

Your email address will not be published. Required fields are marked *