Why Stack Overflow is Good for you

Published in Programming on 22-March-2014

I think everyone would agree that the best way to get better at programming is to program. "Practice makes perfect" as they say. Reading books and taking courses is great, allowing you to build a support network and develop research skills, but unless you are actually implementing the things you are learning, they are not going to stick. At the same time, even once you have learned something by using it successfully, even several times, if it's not something you do regularly, it's easy for your skills and memory to get rusty.

I've been using databases for a long time, and consider myself to be fairly advanced when it comes to developing for and administering MySQL and PostgreSQL databases. A while back, I was in a job that required virtually no database work. At the same time, none of my personal projects contained any database work beyond JPA entities being fetched and persisted. I found my database skills (and several other skills) languishing, to the embarrassing point where I was having a conversation with someone and my mind went completely blank talking about the differences between an Inner Join and an Outer Join. That was the point when I was pretty sure that looking for a new job with more stimulation was in order.

I've been fortunate recently to be in a job that allows me to wear a lot of different hats. I get to do Java EE development, database administration and development, build maintenance and a whole bunch of other things. I get to exercise my whole repertoire of skills regularly and don't feel like I'm stagnating. But even still, since my database mind-blank, I've been acutely aware of the need to keep up with all my skills, even while developing new ones.

I used to play chess quite a bit, and when I did, when I couldn't play, I regularly tried to do Chess Puzzles - scenarios where you start with a certain board setup and try to force a checkmate of your opponent, no matter what they do, in a specified number of moves. This allowed me to keep thinking about strategy even when I wasn't actually playing a game.

It's impossible to always be working on programming projects where you can practice all of your skills. It's only so often that I have to use Distributed Transactions or Spring Auto-wiring. If only there was a kind of 'Chess Puzzle' for programmers!

Like most software developers, it's pretty rare when a day goes by that I don't find myself going to Stack Overflow. It's a fantastic resource where you can find an answer to just about any programming question you can imagine.If you get stuck doing something, you can be almost guaranteed that someone else has gotten stuck the same way and asked a question on Stack Overflow. Usually you have multiple solutions to choose from. While there are pitfalls to some of the answers (and developing skills to tell the difference between good answers and bad answers is beneficial in and of itself), I don't know where I'd be without it.

Until recently however, I've looked at Stack Overflow as primarily a read-only resource. I never signed up for an account and I never answered questions myself. It was rare that I couldn't find an answer to any questions I had, so I figured that anything worth asking had likely already been answered. While this is somewhat true, there are still a huge number of questions that are asked every day. A few days ago, on a whim, I signed up for an account and decided to try to answer some questions. Man, it's competitive! For questions in my area of expertise, usually, within 5 minutes there is an answer posted. I realized that this was going to be a challenge. I kept my eyes open, and then in rapid succession saw two questions I could answer... One about how to use Comparator objects to sort lists in Java, and another about how to use mod_rewrite in Apache to internally proxy rewrite requests rather than send browser redirects. I started typing my answers frantically (only a five minute window to try to get in as the first answer!), Googling for links to documentation and specifications in order to provide supporting evidence for my suggestions and learning how to use the WYSIWYG editor to insert formatted code blocks and hyperlinks.

Despite my answer to the Comparator question being perfectly correct and sufficient, it was not accepted as the best answer... But my answer to the mod_rewrite proxy question was. It was a bit amazing to feel the rush of dopamine when I saw the +15 reputation points appear beside my user account name when my answer was accepted. At least in the short-term, this 'gamification' of helping other programmers solve problems proved quite rewarding. Ok, I thought. 15 points - that was easy... what does that get me? Well, you get access to the first 'extra' feature of the site (the ability to comment on questions and answers) at 50 points, so I had some more work to do.

Over a dozen answers, several accepted answers and a half-dozen up-votes later, I've come to what I think is a compelling realization. While it's true that a lot of questions asked on Stack Overflow are duplicates and would be unnecessary if the people asking them took 30 seconds to search Google for an answer rather than just ask the question, answering questions on Stack Overflow is kind of like playing Chess Puzzles. It combines a time pressure (if I don't get my answer in quickly with a high degree of quality, someone else's answer will get accepted and they will get the shinny new reputation points) with a challenge to be solved. A problem has been presented, it is necessary to analyze the problem, discover the hidden assumptions or fallacies, deduce a solution and explain the solution in a way that anybody can understand it. It's kind of like mental exercise for programmers. There are questions asked on every topic for every development language and tool. Want to brush up your JAX-RS skills? Answer a question on Jersey or RestEasy. Want to solidify your knowledge of Container Managed Transactions? Answer a question on XA transactions within JBoss using EJBs and JMS.

Keeping an eye on the questions as they come in and taking a stab at anything you feel you can answer is a great way to keep things fresh in your mind that you may not use everyday - and earn those shiny reputation points... It's amazing what kind of motivation a little +15 can provide.

About the Author


Daniel Morton is a Software Developer with Shopify Plus in Waterloo, Ontario and the co-owner of Switch Case Technologies, a software development and consulting company. Daniel specializes in Enterprise Java Development and has worked and consulted in a variety of fields including WAN Optimization, Healthcare, Telematics, Media Publishing, and the Payment Card Industry.