SSCCE: Short, Self Contained, Correct (Compilable), Example
I am a strong advocate of helping others and will always offer my assistance when possible. To help illustrate this point, I’m a user on Stack Overflow. Due to the nature of the site, users often post very little information when asking for assistance, which only naturally limits the amount of assistance they receive. In other cases, users will post an external link to their code, which in itself is not necessarily a bad thing. If you do post a link to your code then make sure the code fits the guidelines below.
The process of complying with SSCCE is the process of programming at its core–break down code, isolate problems, and test/debug the code. These concepts are easily some of the most essential aspects of programming, which is why its so important that they are utilized.
Short (Small) – Minimize the noise for your example.
If the problem is database related and the DB has millions of records but only one is causing an issue, then only that one record and supply the schema that references the location of the problem.
If your problem is with a function for joining an interger and string then there is no need to show a function that determines if a user is logged in or not.
Self Contained – Ensure everything pertinent is included, ready to go.
Include everything that is needed to observe the problem that you are encountering.
If specific files are needed then try to replace the files and modify your code to use dummy data structures instead.
Correct – Copy, paste–compile–see is the aim.
Ensure that the resources you provide are valid and able to compile or execute properly, while being able to demonstrate your error/issue. This is not to be confused with everything running properly, which would defy the purpose of requiring assistance.
Example – Illustrate the problem that you are trying to solve.
Provide a clear example that illustrates the problem that you are ecountering. Do not force those trying to assist you to sift through a plethora of information and require them to decipher your code when its not needed.
Not only does following the above guidelines allow others to help you more effectively, it also helps you debug the issue yourself.
One of my biggest pet peeves is having someone say that something doesn’t work but doesn’t provide any additional details. Its impossible to solve an issue if you don’t know what the actual issue is. I try to be as descriptive as possible during my communication to help ensure that I am able to get my point across effectively and clearly.