15

I have a bug in my application that I'm building. I asked a question on S.O. and one of the users asked me to post or send all the code to him so he could look at it.

I totally understand the request. It is valid and understandable. However, I'm having doubts on if I should. Obviously, I give him/her the keys to the kingdom and I will not have any recourse if he/she would do something malicious.

I also want to add that I mean no-disrespect to the user on SO that offered their help. I'm just airing a concern.

I do want to have my bug fixed but there is no guarantee that this person would be able to fix it.

Should I release the entire source code and hope for the best? Or keep it and try to figure it out on my own?

What would you do?

1
  • 3
    Tough question. Well asked.
    – yfeldblum
    Apr 11, 2011 at 15:08

5 Answers 5

44

Build an SSCCE (short, self contained, correct example). If the bug disappears when you remove some of the extra details for the SSCCE, then you found it.

Otherwise you will have an SSCCE that you give or post that ideally eliminates the code that you are concerned about sharing.

4
  • 1
    For those unfamiliar with "SSCCE": acronymfinder.com/SSCCE.html (ignore the first definition of "Superficial Squamous Cell Carcinoma of the Esophagus"). Aha, found the better link: sscce.org Apr 11, 2011 at 14:58
  • What's an SSCCE? EDIT: Just stick it in your answer. :)
    – jprete
    Apr 11, 2011 at 14:58
  • 7
    Building the smallest possible repro is great for many reasons, not only are you not giving away your code but you may well find the bug in the process of developing an example.
    – Steve
    Apr 11, 2011 at 15:05
  • 3
    And the SSCCE doubles as a regression test, making sure you never get that bug again. Also, often you can build a rule for a static analysis tool from SSCCEs, thus also making sure that you not only get that bug never again, but also never get a similar bug ever again. Apr 11, 2011 at 16:56
9

I wouldn't do it, especially if you're working for someone else, who likely wouldn't appreciate you handing potential competitors source code.

But even if it's your own code, it misses the point of Stack Overflow, which is to have an index of questions and answers for everyone to read and use. So you post enough to ask your question, people answer the question as posted, and future readers have a well-encapsulated question and answer in front of them.

If you can't reasonably post enough to understand the bug, then you should try and reproduce the bug in as small a piece of code as you can, and post that. (EDIT: The Short Self-Contained Compilable Example concept mentioned by jzd.) Don't post large amounts of source code, and don't simply hand large chunks of your application to total strangers on the internet.

2

If it's code that you are planning to release as part of an open source project, then I wouldn't worry too much. Otherwise, if this is code you work on at your place of employment and it contains proprietary ideas that belong to someone else, then don't release it to anyone. It could get you into lots of trouble.

Use your best judgment!

1

If it is the code of your personal project and it is not a commercial one, you don't have issues in giving your source as long as you are maintaining a copy of it(better in some source code version control system).

0

Be discrete

It's innocent. You want to post some code and have the SO community help. The problem is people are always watching.

I got written up for posting a script. It happens.

Post at home or in a cafe. Post discretely. You should be able to take some notes and bring it in without getting in trouble.

Note: I'm a little pissed at how naive I was. Be smart!

1
  • I think the word you're looking for is "discreet", perhaps you've spent too much time programming! :) Apr 12, 2011 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.