DEV Community

Cover image for 7 Powerful Principles to Tackle Complex Coding Problems 😤

7 Powerful Principles to Tackle Complex Coding Problems 😤

Lukas Mauser on October 25, 2023

Recently I was given the task to fix a bug in a very complex component with some mind bending recursiveness going on. It took me days to wrap my he...
Collapse
 
userof profile image
Matthias Wiebe

MVS = minimum viable solution -> I love it! 👻

Collapse
 
peerreynders profile image
peerreynders • Edited
Collapse
 
wimadev profile image
Lukas Mauser

Perfect illustration! keep the vehicle functional early on :-)

Collapse
 
artydev profile image
artydev

Let's spread this new concept :-)

Collapse
 
wimadev profile image
Lukas Mauser

haha, I was just talking about building something crappy that works really fast. Not sure if that's a new concept 😅

Thread Thread
 
artydev profile image
artydev

Even if it is not a new concept, it really worth to remind it :-)

Thread Thread
 
wimadev profile image
Lukas Mauser

True.
Then let's spread the word 🙏🏻🤠

Collapse
 
raulferreirasilva profile image
Raul Ferreira

Me too, I found the tips simply incredible and real, I have "experience" in legacy code and basically everything he said I apply and it's enlightening to see this in such a well-written post, it opens your mind, thank you very much 🦤.

Collapse
 
wimadev profile image
Lukas Mauser

Happy to hear that! 😊

Collapse
 
tqbit profile image
tq-bit • Edited

Unpopular opinion: Nobody ever does point 7 after breaking things.

If one of my peers hands me code saying they'll clean up later, it'll be an instant refusal to review whatever mess they developed

Then again, the MVS part is rather brilliant. Gonna keep that in mind for sure.

Collapse
 
wimadev profile image
Lukas Mauser

Clean up is a MUST.

To make it clear: I do not recommend to hand over half baked solutions to anyone.

But rather quickly hack something together that works first, and make it pretty afterwards and only then hand in the PR.

Collapse
 
lundjrl profile image
James Robert Lund III

Really really good article. We get paid to solve problems, not write code. The client doesn't care if something is in a factory, they care that their feature is developed and their business is making money and moving forward. But as always, before that code gets into main, try to clean it up!

Collapse
 
artydev profile image
artydev

Nice advises, thank you

Collapse
 
wimadev profile image
Lukas Mauser

🙌🏻

Collapse
 
code42cate profile image
Jonas Scholz

Addition to 7: don't get emotionally attached to your prototypes! Prototypes are for validating, you should be happy if you can throw them away after you validate your hypothesis :)

Collapse
 
wimadev profile image
Lukas Mauser

Good point! 🤝

Collapse
 
fonyuygita profile image
Fonyuy Gita

Great advice, thanks🙏🙏

Collapse
 
wimadev profile image
Lukas Mauser

❤️

Collapse
 
preciousxploit profile image
Precious-Xploit

Thank you very much for the insight

Collapse
 
wimadev profile image
Lukas Mauser

You are very welcome! :-)

Collapse
 
wihend profile image
Wihend

Nice

Collapse
 
wimadev profile image
Lukas Mauser

Glad you like it <3

Collapse
 
framemuse profile image
Valery Zinchenko

Long comment 🥴

My thoughts

My approach to tackling larger problems is to first test some of my assumptions using code that is not overly complex, but rather clean. This is what I am accustomed to, and it is difficult to abandon years of clean code practices.

Once I have successfully tested several hypotheses, I begin combining them together. This is when things become challenging because I need to maintain a codebase while still experimenting with different solutions. This often leads to multiple re-writings of the code.

This is where clean code can both help and hurt. While rewriting code takes extra time, I believe it is worth it because it provides more control over the code and predictability. This is crucial because you need to be able to prove that ideas are achievable or valuable, rather than having to convince others.

The purpose of creating a Minimum Viable Solution (MVS) or Minimum Viable Concept (MVC) is to present it and determine if it meets the objectives. If it does, you may not immediately start working on this idea yourself, or it may not be your responsibility at all. That's why "clean code" practices are so important, they are not only for you.

We should find that right balance between code that is not too messy and code that is not too clean, which could be difficult.

Abstractions

The last point that I don't like about this article is abstractions. I mean, maybe this is your experience that you're sharing, but personally, I like to create abstractions when trying something. This helps me explore many different solutions to see how they would work. Why limit yourself in conceptions when the goal is actually to find a solution?


I apologize in advance, maybe it is my pursuit of perfection, always striving to find the best solution, but this is how I grow. I am tired of spreading bad code all over the place and just to validate MVS or MVC.

Collapse
 
vantiennn profile image
VanTiennn

Yes, yes, i was fix a big problems, and i also need to clean code, after i create a new file for a function, the solution change, i need to change the file name and file code, it take a lot of time :v