in reply to Bad conscience

First problem -- you said you work at a large company.

If that's the case, where they do cuts will likely be done on an organizational basis -- not on a personal basis as the main weighting factor.

The secondary factor is if you are well known as a star outside of your department (not just by your boss), then, that increases the odds one or more people might speak up for an exception in your case.

The fact that you make 2x a less experienced replacement is peanuts. The time it would cost to bring anyone in to replace you at 50% your salary, ignores the other costs of your position -- office space, needing a computer, needing to come up to speed in company culture, and not least of all, need to come up to speed in your code -- **providing** they company will keep your position at all. If a company like HP gets out of the PC market or IBM out of the server market, and you are in one of those areas, they don't need to find someone to take over your code. It'll just be trashed.

The third factor -- how likely do you think it is your manager would read your code and use that as a decision to keep you or not? If he looked at your code and it was spaghetti, he'd be as likely to push you out the door for being a bad coder as not -- i.e. if he kept you and he thought that was the way you normally code -- then keeping you will cost them more in the long run as you generate more of the same before you leave. I.e. the longer they keep you, they more volume of "hard to maintain" code they will have.

Fourth factor -- if you stay, how long before your obfuscation starts biting you back -- either as you are writing new code based on stuff that -- 6-12 months later looks like hieroglyphics? What if you are given another team member? You might find yourself doing documentation, full time, just to enable them to work.

I won't say what course you can take as there may be many variables you haven't mentioned and every situation is different, but look at the above issues -- and ask yourself -- do you really think spending energy on doing something like that would be likely to benefit you in the long term?

Your best tactic is to try to network more with other teams and get your name known as a solution provider/problem solver (taking care not to step on other people's toes in the process -- a tricky process). That's likely to give you your best protection -- but showing such coordination skills might also get you promoted to being a manager or director that coordinates others working together full time -- a different danger entirely.

It's hard to be appreciated as an individual contributor -- especially when you would need to be appreciated by such by multiple people -- your current manager might wonder where you are getting the free time to be so helpful to others or if they are insecure, might think you are aiming for a managerial position or positioning yourself to be moved into a higher position underneath a director or such...depends on his insecurities and position...

Hope that gives you some ideas about what you might be facing and how your coding style may have little part in how well you are valued (or how it might have the effect opposite you were intending)...