DEV Community

Discussion on: ⚡ Why Engineers need to master Data Structures and Algorithms ?

 
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."