How to know whether to create a general system or to hack a solution

Posted by Andy K on Programmers See other posts from Programmers or by Andy K
Published on 2014-08-25T14:18:52Z Indexed on 2014/08/25 16:27 UTC
Read the original article Hit count: 1807

I'm new to coding , learning it since last year actually.

One of my worst habits is the following:

Often I'm trying to create a solution that is too big , too complex and doesn't achieve what needs to be achieved, when a hacky kludge can make the fit.

One last example was the following (see paste bin link below) http://pastebin.com/WzR3zsLn

After explaining my issue, one nice person at stackoverflow came with this solution instead http://stackoverflow.com/questions/25304170/update-a-field-by-removing-quarter-or-removing-month

When should I keep my code simple and when should I create a 'big', general solution? I feel stupid sometimes for building something so big, so awkward, just to solve a simple problem. It did not occur to me that there would be an easier solution.

Any tips are welcomed.

Best

© Programmers or respective owner

Related posts about algorithms

Related posts about code-quality