[This is in respect of this question on Code Review, which contained anonymised proprietary code, and which was closed as discussed here.]

My feature-request to make is possible to post the anonymised code.

Not all the programmers are allowed to post their real code from the companies they working at.

  • 1
    \$\begingroup\$ I've changed your tags because a feature-request is for improving the software, this is a discussion. \$\endgroup\$ Mar 19 '13 at 17:52
  • \$\begingroup\$ Ok thank you! ) Its better than simply close \$\endgroup\$
    – MikroDel
    Mar 19 '13 at 17:53
  • \$\begingroup\$ I added some explanation of the context. \$\endgroup\$ Mar 21 '13 at 13:46
  • \$\begingroup\$ @GarethRees thanks :) \$\endgroup\$
    – MikroDel
    Mar 21 '13 at 14:21

This is already easily possible if you follow one simple guideline:

Preserve meaning when making code anonymous.

I don't see removing or changing details that could identify a company or individual as a problem.

The real problem happens when people make code meaningless in a misguided attempt to anonymize it. This results in questions that can't be usefully reviewed because they contain general terms such as Class1.MethodOne() == foo.

This is sad because there are a lot of domain experts around that would be able to give excellent answers if they had enough information. (There are edge cases where the code is so generally useful that this doesn't apply, but that's the exception, not the rule.)

Allowing reviews of meaningless code would diminish the value of the site.

In fact, if your company doesn't allow you to post project code online, you should:

  1. Comply with your company policy and refrain from posting your question.
  2. Discuss the issue with your boss: explain the benefits of requesting a code review online.
  3. If missing, try to establish a culture of code reviews at your company.


Make sure that your code still makes sense after anonymizing. In other words:

  • Don't remove information specific to the problem domain from your code, or it will be off-topic.
  • Imagine yourself as the reviewer: would a review of your anonymized code still make sense?
  • If in doubt, read the faq and make sure your question complies.

If you have proprietary code that needs reviewing, don't post it here without permission (even if you think you have anonymized it — this is more difficult than you might think). Get your colleagues to review it instead. This has many advantages:

  1. You won't be violating your duty of confidentiality, breaking your contract of employment, exposing your company to the risk of its code being copied, or risking disciplinary action yourself.

  2. Your colleagues know a lot more about the context in which the code runs than we do, and this means they can spot problems that reviewers here would most likely never spot ("it would be a bad idea to do it that way because customers X and Y are still running Windows XP" or "the embedded processor we run on only has 4 MB RAM so you can't afford to allocate that much space").

  3. Your colleagues will learn a lot about how your code works by reviewing it, and that will help them when they need to use or maintain it.

  4. By reviewing each others' code, you'll build up a shared knowledge of good practice within the company.

  5. It would be bad for Code Review's reputation if it became commonplace for people to post confidential code here.

If you are having trouble persuading your company to allocate time for code review, chapter 2 of Software Inspection by Tom Gilb and Dorothy Graham references a number of studies that suggest that code inspection yields net savings in project completion time (that is, projects with review completed sooner than projects without, even though reviews take time).


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .