Hear me out. I love StackOverflow and Google. Alot. It has made my job overall much less frustrating and has made for some short work days. Before StackOverflow we had to get our knowledge from online forums. They didn't have up-votes or anything marked as 'correct'. They were simply long streams of words that people wrote with images and flashing GIF's inserted. The answer might be located somewhere on page 28 of that forum post and it was your job to wade through people attempting to be humorous in order to find it.
StackOverflow jumped on the scene thanks to Joel Spolsky and Jeff Atwood, and the thousands upon thousands of devs that have hopped aboard to help answer questions throughout the years. And answer questions they have, with an impressive 43,191,386 posts to date and many times many more attempts at answers to go with those. And fantastic answers they are, I'll say that now. But as with anything in life, everything ages and is susceptible to father time. And the answers on SO are not immune to these things.
Take the following for example. A question that I myself ponder on occasion. Just what is the fastest way to read a text file (in C# was my query). While it is possible that there are fresh new answers and advancements in the field of file-reading, we wouldn't know about it by looking at the Google search results. The best we can do is 8 answers from 2016. Being in 2019, that's quite a gap we are building up.
While Google is doing its best to find the most 'relevant' answer, at least, relevant to you, StackOverflow is not as advanced in terms of its search capabilities.
Where do I begin here. For one, the top answer has nothing to do with my query, at least not to me. And secondly, most of the answers are from a decade ago. Many upvotes yes, but coding has surely changed in this past decade. Take the second result for example. I find it hard to believe that there have been no updates to the XML parsing engine in C# since then. Hardware has changed, software has changed, as has the framework. Perhaps .NET Core has an improved way of doing it. We wouldn't know. We'd have to go somewhere else for that answer.
Truthfully, I still don't know. I've looked online, but for now I have to rely on whatever appears on page 1 of Google. Which is what prompted this post to begin with.
But this isn't necessarily an issue with Google or with StackOverflow, as they are simply showing you what they think the best possible answer is based on their own algorithms and metrics and such. And it would be strange to expect Google to keep up with the many changes that programming languages go through during its lifespan.
So do we blame the organizations in charge of these languages? Well, they all for the most part offer change logs and updates about any small and large tweaks to any language. They also allow time for deprecated elements, usually in the span of years and such. So the resources are there and everyone seems to be doing their best jobs to maintain some sense of structure and order.
If there is no one to blame, what can we do? We can simply truck along for the next couple of years and pretend like our code is just fine. But this is akin to having our space program run off of decades old soviet rockets. Eventually, these things will hold us back. They might not fail in any regard. They might get us to space and back with relatively ease and continue to do so for decades to come. But they won't get us to Mars effectively. Or they won't get us outside of our solar system. And the same is true for our old outdated code. We can only build up to the level that our infrastructure will allow.
To some extent, we have to have some accountability with keeping our code updated. And I mean that on a societal level, not on a personal level. Because again, if it were left to us, we would simply just Google it and click on the very first StackOverflow answer that we saw. And that's what this whole article is about. Not doing that.
Perhaps, we can simply start by taking some personal responsibility though. We can admit, that maybe we do copy and paste too much with little regard to whether what we are copy/pasting is in fact relevant and new. I myself, am slowly taking that responsibility. And I will say this. It is difficult. The habit of Googling, clicking the first link, copying, pasting, runs ? is strong and years in the making. So undoing it will take some time. The fastest way to get rid of an old habit, is to replace it with a new one. What's the new habit? It's to save StackOverflow as a last resort. It's to read through the documentation first on whatever it is that I am using, in order to get a better understanding of the concepts and of language itself.
Does it take longer and is more frustrating? Sure. That is the nature of learning more. But it makes us more prepared for the next challenge and then the one after that. Sometimes we have deadlines and external stressers in our lives that push us towards that easy answer. That somewhat complex solution to a problem that someone answered 3 years ago that just works. And that instant gratification sometimes outweighs any other thought of right or wrong and blocks us out from thinking too far into the future. "It works now" we say, and that's all that matters.
And this will only give us a world that's hollow, outdated and flashy on the outside but with little substance on the inside. And when we hand the reigns over to the next generation, with millions upon millions of lines of code that are soon to be deprecated, or that can't keep up with the huge demand of data that we are accumulating, then we will look back and wish we had spent 5 minutes reading the documentation just a little more.
So I challenge you this week to take a step back, and put the simple and easy solutions on the backburners for now. Do the harder work and dive in deep to your work, and see what makes everything tick.
Walter G. is a software engineer, startup co-founder, former CTO of several tech companies and currently teaches programming for a coding bootcamp. He has been blogging for the past 5 years and is an avid BMX rider, bio-hacker
and performance enthusiast.
Stay up to date with my weekly coding tips!