DEV Community

Cover image for ⚡ Why Engineers need to master Data Structures and Algorithms ?

⚡ Why Engineers need to master Data Structures and Algorithms ?

Saeed Ahmad on December 10, 2019

You people may have heard some people saying that “There’s no need to learn DS and Algos” or “They are just waste of time” and similar things. A...
Collapse
 
jessekphillips profile image
Jesse Phillips • Edited

I think you got close. Git is a directed acyclic graph (DAG). I'm not up on all the intricate properties of this type of graph. Having worked with graphs is likely why I manipulate git more easily.

I do not think DS and A help decide a singleton is the right choice (it is not).

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
jessekphillips profile image
Jesse Phillips

I think a better way describe that is that a repo may contain multiple graphs.

Merkel could be applied to a tree or DAG. Git isn't a tree so...

DAG vs. tree using Git?

48

I've often read that Git uses the directed acyclic graph (DAG) data structure, with each commit as a node, and things like branches and tags as pointers to nodes.

But when I try to visualize my commit history using tools like gitk, it looks more like a tree than a…

</p>



Thread Thread
 
mrsaeeddev profile image
Saeed Ahmad

Noo. I meant that knowledge of DSA, Design Patterns and other CS concepts can collectively help a person being a better Engineer.

Thread Thread
 
jessekphillips profile image
Jesse Phillips • Edited

I agree but do not agree with the example of the singleton pattern.

I understand git is not an example, but also think the extent you know DSA may only need to be very basic to gain value.

Thread Thread
 
mrsaeeddev profile image
Saeed Ahmad

Yeah other things are equally important.

Thread Thread
 
kelerchian profile image
Alan

DS and A does help. DS and A involves understanding how entities relate and interact in runtime.

To make an architectural decision such as "whether you should use singleton or not", you need DS and A.

Thread Thread
 
jessekphillips profile image
Jesse Phillips

Help me with this connection, in my experience singleton is only usable for tooling which lives outside the application. Logging is an example, it has no relation to the execution paths and preferably uniform throughout.

What DS or A makes this the logical choice?

Thread Thread
 
kelerchian profile image
Alan

in my experience singleton is only usable for tooling which lives outside the application

Before going too far on the discussion. Let's take a step back a bit.

"Singleton pattern is a software design pattern that restricts the instantiation of a class to one instance"

Do we have an agreement on the definition of singleton pattern?

By the definition, Singleton pattern is a software design pattern. Deducing from OP's sentence, "I meant that knowledge of DSA, Design Patterns, and other CS concepts can collectively help a person being a better Engineer." The decision to use singleton pattern or not is easier if we know DS and A.

Whether singleton is usable only for tooling which lives outside the application is little of relevance.

Thread Thread
 
jessekphillips profile image
Jesse Phillips

We agree on the definition.

Design patterns are not algorithms or data structures. Putting design patterns in to your statement then pulling them out does not make evidence DS&A help choose design patterns (specifically singleton)

Thread Thread
 
kelerchian profile image
Alan

software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design.

Software design usually involves problem solving and planning a software solution. This includes both a low-level component and algorithm design and a high-level, architecture design.

There you go. The creation of software design patterns are due to tried and tested architectures and algorithms.

Also the design patterns is only prominently apparent in the community using a rigid programming language. I've never heard people using languages like rust and python having long-running discussion about design pattern.

Heck even someone joked that the only design pattern in fp programming language is function, which is somewhat true based on my experience working with fp heavy project.

Thread Thread
 
jessekphillips profile image
Jesse Phillips

So now the question is, is a singleton an algorithm or architectural design?

Thread Thread
 
kelerchian profile image
Alan

Which do you think?

Thread Thread
 
jessekphillips profile image
Jesse Phillips • Edited

Architecture.

"More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data."

Collapse
 
blindfish3 profile image
Ben Calder • Edited

I don't agree. I didn't do CS at school/university - I'm old enough that it wasn't a popular/accessible subject. I have never formally studied DSA and I'm now a senior front-end dev (I accept that context may be important here). I'd agree that there are times I wish I had a deeper knowledge of some aspects of CS - more often than not when discussing things with colleagues who do - but I don't feel my lack of formal knowledge has held me back; or led to me making bad decisions. On the contrary: I have broader knowledge and for example will solve CSS issues far more quickly than CS grads. It's true I will have built up knowledge of DSA through experience; but I think that's an important distinction.

I think it's great that people have the choice to learn this stuff; but I think it's wrong to tout it as some kind of exclusive requirement for entry/success in development. Whether intended or not, that assertion gives the impression that development is somehow the exclusive preserve of "qualified engineers": it is not. Setting barriers up for those who can pick up the skills through other means does a disservice to the industry.

Collapse
 
mrsaeeddev profile image
Saeed Ahmad

Yeah I was also working on front end about a year ago. A that time I had same thinking but after my transition to backend and working on some data-centric apps and dealing with some problems at architecture level, I think that I should be better at DS and Algorithms. It helps in general situations and I feel it personally for myself which led me to write this post.

Collapse
 
blindfish3 profile image
Ben Calder

sorry - slip of the key: submitted my comment before I'd finished. Please don't take what I said as a personal criticism; but I think it's important to put the other side of this argument: that the industry is equally accessible to those who don't have the formal education that may not be accessible to them.

Thread Thread
 
blindfish3 profile image
Ben Calder

And yes - I can appreciate that when working on the back-end a more studied understanding of DSA is probably important; but I'd still argue that someone can gain that knowledge independently of a CS degree.

Thread Thread
 
mrsaeeddev profile image
Saeed Ahmad

Yeah it is. I also graduated with a degree in Electronics and now doing software work. So, it doesn't matter but what I noticed that I lacked in some areas as compared to CS graduates, so, I worked on them and then after around one year of my career, I am interviewing CS graduates.

Collapse
 
josemunoz profile image
José Muñoz

In my experience, having a good grasp of linear algebra will help you a lot with your data structures, and having a good grasp of boolean algebra will help you write better algorithms.

Collapse
 
metalmikester profile image
Michel Renaud

Indeed. My university had us do linear algebra (and differential calculus) before data structures. Of five courses in the first semester, three were math (the third was discrete mathematics), the programming course were just the basics - intro to programming, and data processing. The second semester is where things got "serious". Algorithms in the third semester could be brutal at times. :)

Collapse
 
mrsaeeddev profile image
Saeed Ahmad

Haha. Yeah. I was in Electronics and our teacher got brutal right at second semester because we had to study microcontroller interfacing right in second year.

Collapse
 
mrsaeeddev profile image
Saeed Ahmad

Thanks for your info. I didn't had idea about the relation of Maths and DSA. Yeah,I think that DSA are not only helpful in understanding software engineering but also data science and machine learning. What do you think about that?

Collapse
 
jankapunkt profile image
Jan Küster

I think you are not required to "master" them all but you should have worked through all of them at least once and understood when to use which and when not. This in my understanding is also beyond a specific programming language and will make transitioning to a new language and environment much easier and faster.

Collapse
 
mrsaeeddev profile image
Saeed Ahmad

What I think is that the more proficient you are, you have more grip over big picture of software engineering and that includes everything from general programming to software architecture.

Collapse
 
jankapunkt profile image
Jan Küster

Unfortunately, some projects just don't require some of the given structures and you begin to "forget" them. This is why I try to do coding puzzles and challenges in order to refresh my knowledge on data structures. But it takes a lot of my free time. There is always a trade-off.

Thread Thread
 
mrsaeeddev profile image
Saeed Ahmad

Yeah. I do the same. If you are not working on some hard stuff for a long time then you tend to forget some concepts. I agree it's always a challenge to remember structures though.

 
mrsaeeddev profile image
Saeed Ahmad

'Less pressure' matters. But you know we as Engineers are always short of deadlines, so, but frameworks make life a lot easier. Yeah they are modular in their own world. For example, you couldn't replace tyres of a car with that of a bike. So, each framework is modular but modular to it's own limitations and boundaries.

Collapse
 
amanullachishty profile image
AMANULLA CHISHTY • Edited

What are some best sites or books to go about learning DSA

Collapse
 
kasmodia profile image
kasmodia • Edited

I highly recommend the Data structures and Algorithms course provided by Princeton University on Coursera. I love that I learn a lot specially by doing the assignments. It is taught by Robert Sedgwick the author of Algorithms book. It's challenging and i Love it
coursera.org/learn/algorithms-part...

Collapse
 
omarmoataz profile image
Omar Moataz Attia

I think sites like Codeforces, Hackerrank, and Top Coder will help you build your problem solving skills and will teach you a lot about algorithms and data structures in the process.

A lot of people recommend The Algorithms Design Manual book but I haven't read it yet.

Collapse
 
mrsaeeddev profile image
Saeed Ahmad

Cracking the Coding Interview is all time winner for preparing for DSA. However, my suggestion is to start in the language with which you are more comfortable. Then pick up easiest of problems like Array-related ones, then move on to harder problems.

Collapse
 
codemouse92 profile image
Jason C. McDonald

I agree! Understanding the foundational concepts, data structures, and algorithms of programming has enabled me to quickly pick up any language or framework necessary.

"Game Programming Patterns" by Robert Nystrom and "Computational Fairy Tales" by Jeremy Kubica are two of my favorite books on the topic. I also love @vaidehijoshi 's BaseCS series:

Collapse
 
mrsaeeddev profile image
Saeed Ahmad

Great resource. I will give it a read and let you know.

Collapse
 
nashpl profile image
Krzysztof Buczynski

Love the article but it would be nice to get some references to books that can extend this though. Any recommendation from the public ?

Collapse
 
mrsaeeddev profile image
Saeed Ahmad

Cracking the Coding Interview is all time best guide on DSA, System Design and other topics.

Collapse
 
maajidqureshi profile image
Majid Qureshi

Saeed can you recommend some DS and Algo resources to brush up concepts?

Thread Thread
 
mrsaeeddev profile image
Saeed Ahmad

Majid, Cracking the Coding Interview is best if you are looking for something written. Otherwise in terms of video, Harvard's CS50 is best resource for DSA.

Thread Thread
 
maajidqureshi profile image
Majid Qureshi

I have elements of programming interviews in Java by adnan aziz . I will check Cracking Code too .

Thread Thread
 
mrsaeeddev profile image
Saeed Ahmad

Great. Do check it and let me know how can I help you bro.

Collapse
 
theodesp profile image
Theofanis Despoudis

Sad but true!

Collapse
 
omarmoataz profile image
Omar Moataz Attia • Edited

I don't think it's sad. Algorithms and Data Structures can be fun to learn. They just need a lot of persistence and hard work and you need to get used to feeling stupid most of the time in pursuit of that ahah moment when you finally figure something out.

Collapse
 
mrsaeeddev profile image
Saeed Ahmad

I think learning DSA is fun and I am enjoying it a lot. It opens up new horizons of thinking for you. Isn't it?

Collapse
 
mostafa_hashhash profile image
Mostafa Saeed Hashhash

Ok it may be a reason but not the only one, honestly it all about understanding how the most famous and well designed applications work internally and why something specifically.

Collapse
 
mrsaeeddev profile image
Saeed Ahmad

Yeah you are correct. But they are helpful in catching new frameworks too. Do you agree?