How can I cover my back when programming? (Building redundancies and not leaving things to chance)
<p>I work in a very hostile environment/company (which I am a junior dev in), and of course, if you do some coding, it goes live, and there is an error, your job is on the line.</p>

<p>In this company (and all others I have worked in), I have never had any dedicated testing tools available. We have no source control, test servers, bug tracking, etc., yet we have completed large scale development for clients.</p>

<p>How can I ensure that my code, however small, will work in all environments? I already don't leave anything to chance and try to build in redundancies and backup plans. Eg if for whatever reason I decide to log errors by email, I know this means I am putting all my eggs in the basket of "the internet must be live" and it could easily not be, and if so, no logging will happen and if someone says there was an error, I have no proof and "his word against mine" doesn't work for me as I am junior. So everything has to be logged, which incurs a performance and storage penalty of course.</p>

<p>What techniques can I apply to ensure my code will work in different environments? This doesn't apply to browser compatibility, just with things like winform apps and making sure I can write to the event log on every machine.</p>

<p>I am doing the backup/redundancy idea (eg if I can't log to mail, log to local file), as well as logging everything, and not hard coding system values which vary from machine to machine.</p>

<p>At home I have things like unit testing tools, Exception Hunter, all sorts of stuff, to help me. At work I don't.</p>

<p>I am interested in C# techniques to help with this (the language I use at work and generally my primary skill) and general programming techniques. I haven't found much on this on Google.</p>

<p>Also, is it a bad technique if I log to email and in my catch method, if that fails, I log to file? (so I have a plan if one method doesn't work). It seems I should make the performance/technical sacrifice to cover my back.</p>

<p>Thanks</p>
