Today a have a moral issue to share with you. Let say that you are coming from a country that has 25% unemployment rate (even higher for young people) and though government is saying programmers are easily employable (which is true) they are highly underpaid. Let say that you are in your late 40's and you work for this company where you are the only programmer around. Your boss knows it and though he values your work the free market allows his competitors to higher young highly motivated people that are willing to work for half what you make. You know that most of the base work is done and maintenance is the only thing you lately do. That does not require a lot of experience nor deeper understanding (my personal view) of how stuff works but just requires of your to follow latest trends. Let say that lately you noticed that company code (that you wrote) is being downloaded by your boss frequently. You try to figure out why but don't get a strait answer. What are you to assume especially if the company is not that big and you know cuts needs to be made.
My question to you guys is: Would you be willing to do a dishonest thing in order to keep your job, like for instance, write unreadable code? I know people that do that and now they are using it as a bargaining leverage for negotiating raise or keeping the job. Also my question to you is . How often this happens? How often people write hard to maintain code just to keep others away? Is it something that is done frequently (in your experience) or not?
Of course big companies do not allow you to do something like that but small ones do. What is your opinion on the subject.