DEV Community

Thinkster for Thinkster

Posted on • Updated on

Do You Need to Know Data Structures & Algorithms to Be A Good Programmer?

One question a lot of people continue to struggle with as they start to advance their careers as developers is the question of the importance of Data Structures & Algorithms.

Do you need to know what a hash is and how to implement it?

Do you need to know how to do a quicksort?

Well, after 22 years of professional programming without having a CS degree, I can definitively say that the answer is a clear and unambiguous Yes and No.

Let me take a quick aside and define "data structures and algorithms". If you already know this, skip this paragraph. "Data Structure" is the study of various programming data structures (duh) and what they do, how they work, the tasks they're fast at, the tasks they're slow at, and their various features. "Algorithms" refers to the study of the program fragments that solve low-level problems like searching and sorting through any of the above data structures, and which algorithms are most performant in different circumstances. There's a large body of academic studies and amazing books about these subjects.

Now, here's the problem with the above question: In 22 years, I've never implemented a linked list in any program I've written. But I constantly choose whether to use an object or an array to hold some data or state. And that choice matters. Both objects and arrays can represent collections of data in JavaScript, but knowing when and how to use each is pretty important.

Most of my knowledge of data structures and algorithms has been slowly built up as I have written code over my career, combined with some occasional academic reading. I pretty quickly learned binary search. Understanding that has helped me in several cases, but I don't think I've ever implemented a binary search on my own. Most of what I know about data structures & algorithms, I learned without knowing that I was actually learning data structures and algorithms.

I personally find the topic an interesting and engrossing subject. But I also find that most of the time, any academic study I've done is not as directly useful as learning a new library or technology. Generally, learning this stuff has a sort of "passive" benefit on your development. The nice thing is, this knowledge crosses frameworks, techniques, and languages. Anything you learn will benefit you regardless of what you are currently writing.

So, back to the original question: Do you need to know them to be a good programmer?

You will definitely benefit from making a concerted effort to learn them, but that's something that can be slowly mixed into your career. And learning other development topics, like current best practices, new languages and development paradigms, current tools and techniques… all of these will benefit you as well. So you shouldn't ignore these other things just to become an absolute expert on red-black trees.

Happy coding!

Signup for my newsletter at here.
Visit Us: | Facebook: @gothinkster | Twitter: @gothinkster

Top comments (3)

acroynon profile image
Adam Roynon

I totally agree with you here, you don't need to understand the underlying complexities of many data structures or how to implement them from scratch to be a great developer.
You do need to understand how to use the more common/basic data structures and when to use each (e.g. an array vs an object).
But, learning the complexities of data structures, and how to implement them, can make you a "better developer". Just like learning a vanilla language can help you understand what a framework/library is doing under the hood and therefore help you use that framework/library more effectively.

pclundaahl profile image
Patrick Charles-Lundaahl

I think perhaps the key here is that it's useful to know the interface for things (e.g., you should probably know what stacks and queues are and how to use them), but I think the vast majority of devs will never need to write an implementation for either.

bradtaniguchi profile image

Yes you do need to know data structures and algorithms, but that doesn't mean you need to directly learn these subjects.
Learning data structures and algorithms by indirect means can be done by just being a good programmer. Knowing how to manage data effectively in code is just as important as knowing how to manage data effectively outside of code.

The core concepts are taught as such because they are basically everywhere. It might be hard to get a grasp of "why is this important" without knowing a real use-case context, so going from "learn code" to learning data structures helps a lot.

The one thing that directly learning data structures and algorithms gives you that you wont get otherwise is being able to identify and label a given topic within a shared context is important. You might know how to write mergesort, but knowing its called mergesort allows you to interact with anyone with that with that shared context, IE other developers. Otherwise you will have a tougher time communicating with others who do know the "official" name, or end up getting confused haha.