When I have a short piece of code which doesn't contain any sensitive data and I strongly think that it could be published here I still often avoid unless it's a project of mine. (I'm not worried of being sued, but of being blamed or fired for doing something which everyone here is seeing as reasonable)
What scares me is that after years of working in many company I feel that often people are not reasonable. No one, in a company, is willing to take the responsibility of saying: "yes, you can publish the company's code". Even if it would be just one line of code. Even if after changing the name of vars it would be just a code like every other code in the net.
Users which post code are taking their responsibilities. But often what is allowed and what is reasonable is different. Who wants to blame them should ask if he is allowed to write here during the work time.. In most cases the answer is no. I suppose many members here could be blamed for the amount of time spent here during the the working time. But the risk is actually ridiculous, and everyone take that risk.
The problem with posting the code, instead, is that the code stays here forever.
Most of people are doing what is reasonable, most of people are reasonable. But when we incur under a very strict law judgement we may regret our choices
When I feel the code is anonymous enough, and that it could be possible to publish it. The problem still stays in the variable name which could make it possible to recognize it.
A tool for changing the code just a bit, I could help to meet:
- user's will to publish
- user's will to avoid (small) problems with company (I'm speaking of piece of code which are pretty universal)
- community's needs (because just to exist the community need people to post their code)**