Holy cow! I haven't blogged about anything in a very long time. I intend to do something about that starting with this post.
A little while back a colleague asked me to look at some code. He was curious if I thought there was a better way to write it. The only thing I knew about the code was that it worked.
Before you ask. I can't share any of the code. Just let it go.
The code was designed to look for a known string pattern inside a user entered string. The original code was looking for very specific patterns. Also, it had some logic in it that would allow for some of the checking to be bypassed under certain conditions. Like it was explained to me, the code worked and did what was expected of it.
After about 30 minutes I had whipped up, what I felt, was a better way to write the code. My code had about a quarter of the lines and was more efficient. It would check for an infinite number of patterns and conditions. I ended up expanding on it and delivered a couple different ways to make it better. Each one expanding on the previous. Also, I felt my code was better constructed as solve the intent now and still work years from now without alteration.
This is where I feel that experience came into play. I had to write something like this before I was able to pull on that experience when writing it. Not only that, but just my overall time in the field has allowed me more overall exposure to things so my thought processes are just different when presented with a problem.
But, at the end of the day the code is not even the main part if this. All it does is provide context for the main point I want to make.
I think that all of us should strive to be better and "Think Different". What I mean by that is to always look for a better way. Don't continuously rely on how you have always done something. Expand your knowledge and find opportunities to do you what you do, just do it differently, do it better.
Failure is an option, but don't let it deter you. Not every attempt to make things better will work out they way you wish. When trying to find better ways you will more than likely find more ways not do do something. For example, it took Edison over 1,000 tries to invent the lightbulb. He kept striving to find a better way or a different way to accomplish his end goal.
When trying to make it better don't be afraid to reach out and ask for help. With today's technology we are all connected to a vast network of people that have probably already done that. The large majority of them are usually more than willing to help and offer their expertise. There is a large wealth of knowledge and support out there, but if you don't use it you are only handcuffing yourself.
The new year is quickly approaching. Try and spend part, if not all, of 2016 trying to "Think Different".