When people post code on forums they tend to change or blur out parts of their code. Probably because they want to protect certain parts that might be exploited if it ends up in the wrong hands, I guess?
But is it really necessary to do this?

Here are a couple of things I see a lot:

  • Renaming id's and class names in html and css
  • Renaming variables and functions in code
  • Bluring out parts of a folder structure
  • Changing stored procedure names and it's parameters
  • Posting of example code rather than real code

Passwords and connection strings to the DB are obvious things you shouldn't post but how a bout the rest? Is it ok to give out a DB name? Is there anything in the web.config you shouldn't post? How about the .htaccess file on Apache or a folder structure on the system, etc...

Basically what I'm asking is which parts are safe to post and which are not?

  • 1
    Renaming things in HTML and CSS seems strange. All of the original names are publically available once deployed using the "View Source" command.
    – Cody Gray
    Apr 28, 2011 at 9:10
  • I agree, yet I've seen it many times. Added it as sort of an obvious "mistake".
    – Niklas
    Apr 28, 2011 at 9:21
  • some times blurring is done to prevent others knowing the company/product the asker is working for Jul 23, 2013 at 7:07

3 Answers 3


When tackling any tricky bug you should reduce the problem to the minimum amount of code needed to show the issue. This is way before you post to any forum. Most of the time, the act of writing this example code will help you figure out the problem, and even if not at least you will have isolated it.

If you are still stuck the minimal code you have should allow you to describe the problem clearly and would also be a suitable piece of code to post on a forum.

  • That could be very difficult. More so for inexperienced users since they won't know which information is actually needed to solve the problem.
    – Niklas
    Apr 28, 2011 at 11:07
  • That is the whole point, they need to figure out what the problem is by doing this step, posting an entire code block is not the approach to take.
    – Steve
    Apr 28, 2011 at 11:10
  • @Niklas: It's not that difficult. Start commenting out blocks of code until you isolate the problem. Or, perhaps even easier, create a brand new, blank project and start copying over relevant lines of code, one at a time. This is what a debugger is for; learning to use one is a very important skill.
    – Cody Gray
    Apr 29, 2011 at 0:36

You should post the minimum of everything that is needed to reproduce the buggy behavior.

And when you post, you should remove anything that:

  1. Would indicate the company (publication may damage the company reputation if their employees are seen crying for help online)

  2. Would reveal anything that competitors might find to be useful knowledge. Elements of architecture, security measures, the data the company disposes of and so on.

  3. Is an indication of weaknesses in the current design (#2)

  4. Is a hint to upcoming features (#2)


Frankly the list you have is a bit extreme. I could see blanking out server names and things that might, say, identify the company somehow if someone is paranoid. But changing alot of stuff really makes little sense.

Related pet peeve: people who post screenshots of source code for review. I want to be able to copy and paste your stuff into something usable not Photoshop.

  • I've been back and forth between your argument and the other two posted here already. There doesn't seem to be an obvious answer though.
    – Niklas
    Apr 28, 2011 at 14:44
  • Well, there isn't -- it is a mix of your comfort level and what you are trying to protect. Apr 28, 2011 at 15:05
  • +1 for the pet peeve. I simply can't understand what motivates people to post screenshots of code. I suspect the people who do this are not real programmers.
    – Cody Gray
    Apr 29, 2011 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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