Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
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 '11 at 9:10
    
I agree, yet I've seen it many times. Added it as sort of an obvious "mistake". –  Niklas Apr 28 '11 at 9:21
    
some times blurring is done to prevent others knowing the company/product the asker is working for –  Carlos Campderrós Jul 23 '13 at 7:07
add comment

migrated from stackoverflow.com Apr 28 '11 at 10:36

This question came from our site for professional and enthusiast programmers.

3 Answers

up vote 5 down vote accepted

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.

share|improve this answer
    
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 '11 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 Haigh Apr 28 '11 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 '11 at 0:36
add comment

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)

share|improve this answer
add comment

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.

share|improve this answer
    
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 '11 at 14:44
    
Well, there isn't -- it is a mix of your comfort level and what you are trying to protect. –  Wyatt Barnett Apr 28 '11 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 '11 at 0:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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