Don't make things too complicated

Ignorance is bliss. Especially when you are new in a field. Most people that are just getting started in web development want to change the world. But then they hit a wall and ask the more seasoned developer for help, those make it their mission to crush their dreams.

When I pour my heart into a project and a someone with more expertise tells me it sucks, it hurts. Well it used. OK, it still hurts a little.

Like they say, "haters are gonna hate". But the longer I spent writing software, the more I catch myself doing the same thing to others.

But when I do catch myself on time, I try to let them know without crushing their dreams.

A complicated sphere

The one of the left uses much more memory and render time, yet the visual differences are almost nil.

A friend of mine had an idea for a non-profit website. He worked on it for a long time and I am still impressed on how far he got without being a programmer. But one day we went to lunch and talked about some technical difficulties he was having.

He wanted to create a simple text field where people would be able to write exactly what they want and on the back end he would process it then return the correct data.

The keywords here are "write what they want". One thing he was not aware of was that natural language processing is one of the toughest challenge in programming. Here is an example of what the user could write.

Give me the list of all the donations that were made to organization ABC between March 2010 to September 2011

Fair enough. It is possible to parse this sentence and convert it to a SQL statement like this one:

SELECT d.* FROM donation d
INNER JOIN organization o ON o.company_id = d.company_id
AND BETWEEN '2010-03-2010' AND '2013-09-2011'
LIMIT 0,20;

Close enough. This should work. But then a second user comes in and write the same thing in a slightly different manner:

I want all donations to ABC between March 2010 to September 2011

You see how it can become complicated very quickly? Maybe someone will misspell a word, or just write something that will throw off our parser. Note that this a non-tech savvy guy working on this problem.

Not only it is hard to implement, it is over kill for the results that are expected. He spent a long time on it and decided to put it aside until he gets more experience.

A simple form with date range and drop-downs could have solve the problem:

The solution above is not as cool as the flexible natural language parser but it will do a good, if not better, job.

Do you ever get those times where you are stuck. When you think there is no solution to your problem? You step out to get some air and clear your mind?. When you come back, you find that there is a much simpler solution then the route you were taking.

Yes, sometimes a clear mind is all you need to realize you were making things too complicated.

One of the websites I used to work on had a bug that allowed people to write and run code directly on our server. We created complex solutions that required atomic precision to work. Any mistake during deployment made the server vulnerable. And we always made those mistakes.

After 3 years of dealing with it, and after I was blamed for not following the protocol and we got hacked, it took me 10 minutes to go through the server logs and find a simple and permanent solution.

Sometimes, we make things more complicated than they need to be. If you are thinking too hard and stressing, this should be your signal that it is time to stop. Take a few minutes to relax. Then comeback with a fresh mind and try a different and simpler approach.


There are no comments added yet.

Let's hear your thoughts

For my eyes only