Symfony on Stackoverflow
There are many ways to contribute to the Symfony community besides submitting Pull Requests to the GitHub-Repository, from reviewing issues to joining discussions on Slack. I particularly enjoy answering questions on Stack Overflow.
Most of my questions on Stack Overflow are from when I first started out writing PHP and when I first tried Symfony a few years ago. Even though I rarely post a question, I sometimes go through the motions and solve my problem along the way. This post is meant as a guide to improve how we interact on Stack Overflow both when answering and asking questions, making it a welcoming part of the Symfony community.
Unfortunately, there is a barrier of entry to Stack Overflow as you need to unlock certain functionalities by “earning” points. Another complaint raised is a dismissive attitude by people answering questions and admittedly I have noticed this in some of my past comments as well. One, if not the, major complaint from seasoned Stack Overflow users is the steady decline in quality. It is almost like a rite of passage getting to a point where you proclaim this to others. To be fair, I don’t think that is actually the case and more a bias from noticing repeated questions more easily when you have been around for longer or just having more experience, making certain questions seem obvious. It’s like watching someone work on a puzzle you already solved. You only see the path to the correct solution, whereas they see all the options available to them without knowing where they lead. This can become frustrating and hopefully this guide, will make future experiences more enjoyable.
Voting on questions and answers
As I mentioned before, new members on Stack Overflow face a few roadblocks to meaningfully participate in conversations. Conversely, seasoned members hold a degree of power over them, being able to vote on their questions and answers, determining whether they receive or lose points. This can be a deciding factor on how welcome someone might feel and allow them to, e.g. ask for additional feedback or posting an idea in a comment. This can be doubly negative, since answers that are comments will usually be closed, making them feel their input is not valued.
Spending your daily votes on up-voting questions, especially from new members even if it might be a duplicate or easy to solve is a good way to help closing this gap. Whether a question is useful is not necessarily tied to how challenging you find it. Instead of seeing votes primarily as a way to distinguish perceived quality rather look at it as a way to acknowledge the effort of publicly asking for help. This even holds true, when a question needs follow up comments to be able to answer it. Interacting through comments or leading people to the chat is usually more useful than a down vote, as you are able to interact with each other. Up-voting questions makes sure people have enough points to do so and this will hopefully improve everyone’s experience.
From time to time questions need to be closed. This is not to say that it was a bad question. Since Stack Overflow aims to be a knowledge base useful to many people, moderating the open questions makes it easier to find what others found useful. Despite offering a wide range of reasons why something was flagged for close, it can still be discouraging. I try to mitigate this by also leaving a comment and, if possible, guide to alternative means or how to improve a possible follow up question. This is even something that is automated when you mark a question as duplicate, as this will automatically leave a comment in your name pointing to the previously answered questions.
Asking the “right” question
Asking a question in a way so people trying to answer it have all necessary information and context requires a multitude of skills such as establishing a methodical approach, a certain degree of background knowledge, experience both with the problem at hand as well as with debugging and answering questions and sometimes even requiring special tools, like a profiler or being proficient with a version control system. They are immensely useful skills to have but no one can be asked to have them right away and naturally some might be more important than others in your day to day life or just come easier to you.
Usually when I ask a question on Stack Overflow, I try to cover the following three main questions in that order:
What do I want to achieve?
This can be as short as a single sentence or even just a link to a resource I am using, as long as it helps someone who has no context to know why I am having troubles. Most of the times, this is also the subject of my question. The clearer I can describe it the more likely I am to find a similar question in the suggestions provided when typing in the subject.
What is the problem I have?
When my problem is an error, I will usually post the whole message including the stack trace and then go through it to make sure it does not contain any sensitive information. When the problem is not as clear, e.g. when something has a different result than what I expected, I explain what I expected and why and how the outcome differs. I find it helpful to get that point across with data or pictures, instead of writing long explanations. Especially when comparing expected vs. actual data I try to provide it in a format that is easily reusable. That means both as formatted text to allow copy & pasting as well as making the data-set as small as possible to help people see, where it differs.
How to reproduce the problem?
This is usually the trickiest part for me, as sometimes it can be unclear what is causing the problem in the first place. I try to give a step by step guide of what I was doing up until the point when I (first) encountered the problem. The idea is to give something that looks like an installation instruction, so they know exactly what I did and where I might have done something wrong. For this, I try to stick to a certain sentence structure that is common in a certain style of software testing incorporating keywords like:
GIVEN I have X, WHEN I do Y THEN I expect Z (BUT I see A).
Sometimes, I even create a new, minimal example project just for showcasing the issue, that others can check out e.g. on GitHub. This might sound like a lot of effort, but it helps you focus and isolate the issue and when someone attempts to answer, they can provide a solution that fits your example more easily. If that is not possible, I try to identify a few essential parts of the code that others might find useful. Again, when working with an error/exception this tends to be a bit easier, as you can pretty much always copy the function where the error occurs as a good starting point. Try not to copy framework or library code and instead find the first part in the stack trace, that contains one of your own functions. If the problem really is within a library you use, they can always go to the project page and check out the code as long as it’s open source.
Even when I am not sure which part of the code causes the issue, I try to give a rough outline of what I am doing either with pseudo code or by looking for a particularly relevant part of the code, e.g. the controller action being called or some library being used.
When the question/problem I have contains answers to these three questions, I usually feel that it is enough information for others to - at the very least - guide me in the right direction and which I would enjoy answering, as they usually require little to no follow up questions. A similar approach can be used to describe possible bugs in the issue tracker as it allows people to reproduce the issue you have more easily and may provide a good basis for an automated test for the fix as well.
If these questions do not really fit with my question, then I might have to find different questions that help others not familiar with my task and my code answer it. It might also be that Stack Overflow is not the right place to ask. For example, questions like “What is the best way to…” or “Is there a best practice for…” rarely provide a single, “right” answer as they are subjective and are likely to be closed. It might be better to discuss them somewhere else, e.g. Slack or in person on community events like conferences or meetups.
Stack Overflow has its own moderation system and there are no designated moderators for the Symfony community right now, as far as I can tell. Once you have reached a certain score, you will gain access to more and more moderation privileges. Anyone interested in actively moderating can do so by applying filters to their review queue.
This allows for a community driven approach to making everyone using Symfony related tags welcome and ensuring answers and questions will stay relevant, e.g. through edits for newer Symfony version. On the down side this can be potentially problematic as it is not clear who to reach out to, if you encounter problems. While Stack Overflow provides their own support channels you are always welcome to reach out to the Symfony CARE team should you have any problems or questions. There is also a public channel #stackoverflow-mods on Slack where you can get in contact with people who have moderator privileges, e.g. if you would like to have a closed question reopened.
Become a certified developer! Exams are online and available in all countries.Register Now
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.