I have built things for the web and some of these things had really clever algorithms. I have written unit tests. I understand, and have done most of the things in-between building and deploying to a production server( this too included). Did I fail to mention that I’ve also collaborated with other developers using git ? Oh yeah I have.
Bruh! you are a pro mehn!
I wish... Even though I know I still have a lot to learn, there is one unchecked box that has become my biggest concern lately: I’m yet to master algorithms and data structures. Not mastering algorithms and data structures only means one thing: I’m a crude software engineer .
Oh wow! These constructs must be really important in software engineering then
No! algorithms and data structures aren’t essential components of software engineering; They are software engineering!
I’d love to really ask what makes these constructs so important in software engineering, but I don’t even know what they are to begin with
A data structure is a particular way of organizing data in a computer. For example, we could organize data in an indexed, ordered structure(lists/arrays). An algorithm on the other hand is any step by step instruction that manipulates some data. For example, when you write a for loop that prints each element in a list/array, that’s an algorithm.
These constructs are so important in software engineering because they guarantee building efficient software systems.
I beg your pardon?!
Building efficient software systems entails crafting applications that require the least amount of memory possible and the minimum execution time that’s achievable, to execute tasks.
Why is this important you ask ?
Usually a computer has several applications installed and most times 2 or more running concurrently. This wouldn’t have been a problem if these computers had infinite memory and indescribably fast processor clock speed, but they don’t. Remember, now there is a need for speed(pun intended) every where you go. As a result, if a program requires so much space and takes too long to execute, it will considerably slow down the computer, but most importantly, this will result in a poor user experience. It is imperative that every software engineer builds programs that are highly efficient.
Okay now I think I get the gist, but tbh, I still don’t understand how understanding these constructs will help me write efficient code though
Mastering data structures presupposes understanding the several existing ways data could be organized in a program and by extension the computer(lists, linked-lists, binary trees etc.). Usually, a given data structure is optimized for certain operations. For example, while lists/arrays are optimized for retrieving items based on index, linked lists are optimized for operations like inserting and removing items( something lists/arrays are poor at). There is always the right data structure for your use case. Using the wrong data structure could result in a revoltingly inefficient code.
Mastering algorithms on the other hand encompasses understanding the several existing ways for efficiently performing some of the most common operations(e.g. searching and sorting) in computer programming. Because some of these algorithms are relatively more efficient, knowing what algorithms exists and their behaviour will enable one use the optimal or near-optimal algorithm in a given scenario. Most times as software engineers, we create our own algorithms; having a strong grasp of these constructs helps us measure the efficiency of our algorithms too.
So tell me, how can I possibly be a pro when, out of ignorance I’ve probably wrongly used a data structure? How can I be a pro when out of ignorance I’ve probably written code that searches my sorted python list(probably called arrays in your favourite programming language) in a linear fashion, when there is a more efficient approach called binary search. No! to be a pro I’ve got to understand the art and the technique of software engineering. I need to start writing code that not only does the right thing, but does it well. To achieve this I need to start using correct data structures and highly efficient algorithms. Every software engineer needs to master algorithms and data structures! E get why!
Interested in understanding how to measure the efficiency of your algorithms? Read my post on space-time complexity, and the big-o notation
References
Top comments (1)
You've got questions, concerns? Let's talk here in the comment section.