By: Matt Perry
Learning to Solve Problems Without Limitations
In 1939, George Dantzig, a graduate student at the University of California Berkeley, was running late for his statistics class. Frantically entering the classroom, he noticed that two problems were written on the blackboard. Assuming they were assigned for homework, he wrote them down and worked out the problems over the next few days. Several days later, he approached his professor, apologizing for the delay in giving him the homework. The professor replied that he should drop the homework on his desk. The student did so, setting the papers apart from the mess of other research papers and notes sprawled across the desk.
Several days later, Dantzig and his wife were awakened by banging on the front door. To their surprise, his professor was outside and rushed in with papers in hand. He exclaimed, “I’ve just written an introduction to one of your papers. Read it so I can send it out right away for publication.” Dantzig had no idea what he was talking about.
Dantzig didn’t realize that the two problems on the blackboard that day were problems that remained unsolved in statistics for decades. A year later, his professor allowed him to use the two problems as his thesis. He went on to become a professor of Operations Research and Computer Science at Stanford University.[1]
You’ve been told that programming is problem-solving. Like Dantzig, you want to be the ultimate problem solver. The first principle that we learn from Dantzig is that the sky is the limit when left unrestrained by perceived limitations and difficulty.
Let’s say that you are a freshman in college taking your first-ever programming class. Some of you may be. Well, due dates are coming fast—it’s hard to keep up. So, you do what any stressed programmer does. You stop problem-solving and start panicking.
And in doing so, you turn to Stack Overflow.
You don’t have to type much more than “error in main.cpp” to find a Stack Overflow forum about possible syntax error solutions.
Discovering this fountain of knowledge, you continue using it. After all, the teacher has not been much help and every other programmer is worried about getting their own program to compile.
As you continue, you realize that Stack can answer your questions about variable declaration and assignation; but now you’re studying classes and you don’t understand why Stack Overflow doesn’t seem to have an answer!
If you’ve felt this way, programmer or not, you’re not alone. As a full-stack developer of a website, I have often turned to Stack Overflow for answers. First, it was to determine how I could get my Vue website to display data. Then I had questions about how to use plain JavaScript in a very DOM-heavy website. By the time I was learning PHP, I was lost! Luckily, I discovered a few references which helped me along the journey to become a real problem solver and save time as I learned more about programming.
This article will discuss some of the reasons that you should not use Stack Overflow as a crutch to learn programming and offer some alternative methods which have been proved effective.
The Question of Dominance
The term “stack overflow” was first used to describe the overflow of data when a program recourses repeatedly until the programming attempts to store more data than what’s available in memory.
Now, what started as a simple website, Stack Overflow has grown into a massive resource. It dominates as the largest programming forum on the internet with more than 100 million users. In 2018, Stack Overflow had 2 million new questions and 1.6 million new users.[2] If any programming forum dominates the memory of the internet, it’s the stack exchange.
Most questions about programming on Google will return a Stack Overflow question. A study by the University of California Davis found that “when performing Google searches of the API methods in jQuery, 84.4% of API methods had a Stack Overflow post returned on the first page of the Google search”.[3]
With such a large rate of return, it has become increasingly hard for other forums—such as Quora, Reddit, Google Groups, SitePoint, and CodeProject—to find a place on Google’s first page of search results. Of these 84.4% of API methods, they would have searches of at least one result, with many having more than one.
SEO, search engine optimization, includes using keywords that are carefully selected to appear in the head of an HTML documents so that the document may appear as far up in Google search results as possible. Stack Overflow uses algorithms that make words submitted by users transparent to Google, resulting in the question appearing at the top of the results page.
The Answer to Dominance
Fortunately, as a programmer-in-training, your Google search query is likely to return a different resource at your disposal. Official documentation and websites on documentation often provide the basics and fundamental information that successful coding practices build upon. Sites like W3Schools and the MDN are comprehensive guides to coding classes, variables, arrays, objects, branches, etc. Official documentation is common, and programming languages that have existed for decades are well-documented enough to provide answers for any question.
The Question of Under Coverage
Stack Overflow has been successful at answering traditional programming questions. Concepts that have been around for decades have thousands of answers on Stack Overflow. As such, a focus has been placed upon providing crowd documentation for traditional stacks.
With the emergence of APIs as a method to develop apps, Stack Overflow has been incapable of providing answers to most questions that are pertinent in a professional programming setting. In research done by Georgia Tech, several researchers determined that crowd documentation on APIs was lagging, stating that “the crowd is too slow to ever replace official API documentation. For example, within the first year of Stack Overflow’s operation, the coverage of Android API classes only reached 30%.”[4] As more classes are released, the question of coverage becomes an increasingly difficult task.
Figure 1: The coverage is a percentage of how many API classes had n threads discussing them on Stack Overflow. Android APIs have more coverage than GWT and Java APIs.
The Answer to Under Coverage
Developers create documentation when they create their platform. Ideally, websites on documentation should exist for every platform, though some are better than others. When it comes to Android APIs, Android provides a comprehensive guide to Android API classes. Other references to common programming stacks are included in Mozilla’s MDN and W3Schools.
The Question of Context
Consider the difference between these two questions:
What was the context of the statistics problem for Dantzig’s class?
What was the context of the problem for Dantzig?
The problems we solve rely on the context in which we are working. If we are told that a solution is impossible, we believe it’s impossible. If we are told it has been done, we find ways to make it work.
It would be convenient if we could code a program any way we want while achieving the desired result. However, programming has limitations. If you desire to create an impeccable, suitable program to accomplish your goal, careful consideration is required. What tech stack should you use? How much help do you have? In other words, what is the context for your project?
Many Stack Overflow posts fail to provide this necessary context. Inaccuracies are everywhere in Stack Overflow pages. Between the wordiness, poor grammar, and ambiguous information provided, some posts fail to even explain the tech stack. Are we working in Java, or JavaScript? While the names may seem similar, these languages are completely different! A loop in JavaScript and C++ can look practically identical . . . so how do we know which one we’re working with?
The Answer to Context
Once again, official documentation provides terrific insight on the context of specific problems. Websites such as cplusplus.com exist for C++. Oracle, the creator of Java, has a reference website for Java documentation. These sites provide very comprehensive documentation for these languages.
Akin to reference sites are textbooks. You’re probably thinking about your teacher’s monotone lectures, but textbooks provide a comprehensive reference. Indeed, textbooks are thoroughly reviewed and edited before being published and distributed—so you know they can give accurate and official information.
The Question of Inaccuracy
Imagine Dantzig’s process while doing the statistics problem. Dantzig probably knew that this problem was unusually difficult compared to many problems presented in the class.
Perhaps many students would go to other students to collaborate on such problems, taking each other’s false answers for truth and making assumptions based off that information.
Crowd documentation in Stack Overflow has often drawn confusion for even experience programmers with high Stack ratings. Upon analyzing a large sample of answers on Stack Overflow for what makes some questions more popular than others, a group of researchers concluded, “Moreover, there are many questions that are not duplicates; however, they are similar enough to cause confusion among users and negatively affect post quality. Such drawbacks limit Stack Overflow’s ability to attract a greater number of high-quality posts.”[5]
The Answer to Inaccuracy
There is a possibility of false information anywhere; however, you might try searching for a programming mentor. People who have programmed for years, who have taken courses in school, and who possess experience are valuable assets from whom you may solicit help. Be mindful that these individuals’ time is valuable—some of them may be paid large salaries for their expertise. Always approach them with respect and understanding if they are busy, and gratitude if they are willing to help.
Another approach is pair programming. Mistakes are inevitable while programming. Having a pair programmer at your side can assist you in your efforts to have clean code without typos. A study on pair programming showed that “most programmers are long conditioned to working alone and often resist the transition to pair programming. Ultimately, however, most make this transition with great success.”[6] Though difficult at first, learning to pair programming is a great long-term investment to producing faster and cleaner code.
Abandon the Stack
Stack Overflow is a jungle of open-ended answers and incomplete understanding. Relying on this resource as a programmer can be a waste of time. Although Stack Overflow dominates the web as the number one source of programming answers, programmers have the option to turn to other documentation sources that are common on the internet. These sites provide enough coverage to explain each concept. Alternatives to reference sites also include personal connections to other students and mentors. These relationships can help you code with accuracy.
Let’s review the answers to the issues with Stack in regards to dominance, under coverage, context, and inaccuracy:
- Use reference sites specific to your tech stack. Do the necessary research to understand how ideas build upon each other.
- Use less-common sources such as textbooks to understand the bigger concept.
- Find connections such as friends and mentors who can work in-person and provide live feedback.
Next time you turn to your friend Google for answers . . . think about abandoning the Stack.
[1] Donald J. Albers, Constance Reid, George B. Dantzig; An Interview with George B. Dantzig: The Father of Linear Programming (The College Mathematics Journal, 1986), 293–314.
[2] David Fullerton, State of the Stack 2019: A Year in Review (The Overflow, 2019).
[3] David Minh Kavaler, Sociotechnical Aspects of Performance and Success in Software Engineering (University of California Davis, 2018), 34.
[4] Chris Parnin, Crowd Documentation: Exploring the Coverage and the Dynamics of API Discussions on Stack Overflow (Georgia Tech Technical Report, 2011), 9.
[5] Raul Quintana Selleras, Predictive Model: Using Text Mining for Determining Factors Leading to High Scoring Answers in Stack Overflow (The George Washington University, 2019).
[6] Laurie A. Williams and Robert R. Kessler, All I Really Need to Know About Pair Programming I Learned in Kindergarten (Communications of the ACCM, 2000), 110.