Getting a solution that is simpler than what another person has posted

Hey everyone,

I’m sure that the majority of us have looked over on StackOverflow for solutions to a certain problem. I’m also sure that we’ve done a copy and paste at one point or another. I’m sure that there are those situations where we take the source and then try it, and the test works!

So, as anything in life, there are some good, and there are also some bad. So, the question is how do we understand that it is bad?

First of all, I want you to think for yourself in terms of sitting there, looking at the code to get a general idea of what it does, then looking deeper into the source level, and then see if it fits what you’re trying to achieve.

Do you see any potential problems aside of the solution posted on StackOverflow?

If you see a red flag, then I’d think of another solution that’ll be the “same”, but “better”.

In fact, I saw one today and thought to myself the solution wasn’t worth implementing since there seems like some potential side effects that I couldn’t fathom with. Moreover, it was also complicated, and there was also an edge-case that I know wouldn’t work with that. And because I already knew that I’m unable to use the solution, I started looking into making one that I’m much more sure of which will work.

It is all about analysis before getting something done. Whether it’s writing whatever you need down in chicken-scratch, looking deeper on the internet for more answers, or asking another person about a problem, this is all going to give your application good performance, and ensuring that you did it right!

I’ll give out an example, but that’ll wait until next time!

Brian.