5

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.

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.

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.

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.

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.

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

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.

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.

Thanks

8
  • How do you combine your code with the code of your co-workers without source control? Aug 14, 2009 at 22:45
  • I've no idea. Source control is coming, but work has been done without it.
    – GurdeepS
    Aug 14, 2009 at 22:47
  • "No source control?!?" WTF?!? How is your code protected? What happens to your project & code if your desktop's hard drive crashes? Aug 14, 2009 at 22:57
  • Oops, I see. Sorry, I reacted to soon in the post... :-| Aug 14, 2009 at 23:00
  • 2
    Assess the situation, take part, take over. Or find another job :)
    – Al.
    Aug 14, 2009 at 23:01

15 Answers 15

9

This sounds like a nightmare. I've worked at places where there was no source control, people made changes on the fly to live systems, and where I've had to definitively prove that my code wasn't the problem. But our jobs weren't on the line if someone screwed something up. Just so long as it didn't happen too often.

That's probably because one of the senior developers was the worst offenders. His favorite trick was to have shell scripts calling shell scripts calling shell scripts and explicitly redirecting stdout and stderr to /dev/null, sometimes 2 and 3 layers deep.

Then there was the time he "verified a customer's backup" at their request by making sure the job was running from cron rather than actually reading data from the tape. Of course the tape was bad - and he'd redirected stderr to /dev/null. When the customer lost a hard drive and 5 years of historical data 2 months later, I got to lead the effort of scanning in and OCRing their printed records to rebuild something resembling a database. They promoted the other guy. I quit not long after.

Which brings me back to your situation.

  • Have your resume up-to-date.
  • Have some savings in the bank; be able to look for a job without being homeless after 2 weeks.
  • Start quietly looking for other work. This economy won't last forever, and you're getting more marketable every month. Life is too short to put up with a hostile workplace.
  • Do what you can to CYA.
    • Start using an RCS for your own stuff.
    • Test your stuff thouroughly. Keep the tests around; re-test when you make changes.
    • Keep notes (email it to yourself, or edit a text file) about what you've changed, and how you've tested before deployment. With some luck, good documentation will trump a more senor guy's finger-pointing.
    • Look for a mentor within the company.

Good luck. As another commenter put it: we've all been there.

6

Set up source control for yourself, if nothing else.

If it were me, I'd go further: I'd install Trac & Subversion on my dev machine, and use it. If others start to wonder how I managed to track down the exact change that introduced a bug, etc, I'd point them at the URL. Let it grow virally.

But it sounds like you need to find a better place to work.

(Disclosure: I'm one of the Trac devs, so I'm biased.)

2
  • I second this post. I'm also a junior dev and I've gotten a lot of better software engineering practices implemented in my company in this "viral" manner. And I'll second the recommendation for Trac (I'm NOT a dev for Trac).
    – Imagist
    Aug 15, 2009 at 5:43
  • I've done the same -- installed svn locally, used that for check-ins, merges, incorporating other people's code. Fortunately that only lasted for a month or two, and we got management go-ahead to mandate source control usage.
    – Michael H.
    Aug 15, 2009 at 20:26
3

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, you're job is on the line.

Been there, done that. How many people have you seen actually fired because they had a bug in their code?

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

Therein lies the problem.

What techniques can I apply to ensure my code will work in different environments?

You can't. You can have a bank of machines (or virtual images) with various configurations to check against. But it doesn't sound like your work environment is conducive to that. If you just want logging capability, that should be a given.

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.

While I admire your dedication, that's like making a doctor build their own stethoscope, when it's much more cost-effective and safer to buy one.

Unfortunately, your organization will probably not make the changes they need to do it correctly, and you can't do it all yourself. Pay your dues there for a few years, learn all of the right tools, and then find a better place to work.

1
  • 1
    +1 for the stethoscope remark, so right. I'd say get another job, the only problem is that economy sucks at the mo. I have never had had a hostile environment to work in, but was a "mister-fix-it-all" at one, and I mean ALL it sucked, I left.
    – Colin
    Aug 14, 2009 at 23:35
3

I wish I hadn't made a flippant comment earlier instead of answering;

Prove yourself worthy of leading their technical environment (you clearly have skills above theirs) or leave. If you can't achieve the former you are wasted on them. It's bad for them, bad for you, bad for your CV.

Give it 3 months and see if you can change their perception. They may mean well but have little technical experience. Give them a chance.

If its as hostile as you think - walk.

EDIT: There are many teams out there who share ideas and love being corrected. This is the best way of thinking. There are teams who cuss you down whether experienced or not. It's not really code it's attitude and experience. You need to find a team that matches you. Even in "the current economic climate" you will find one. Don't be afraid of finding happiness :)

3
  • I don't have skills above theirs. My team leader has LOADS of experience and qualifications. It's not whose the cleverest, it's who can shout the loudest and even then, if anyone in our dept can shout loud, it is not loud enough. Because what we do may be responsible for bringing in the money, it's also such a complex job that it is not understood by non-IT people. Bug fixing, testing, it's all words for management and seems like an excuse to waste time, but it's an important task which is abstracted (management think we are redundant when they see something not working in a system).
    – GurdeepS
    Aug 14, 2009 at 23:53
  • Bare in mind, sometimes when something isn't working, it's because of another team, but as the medium (the project that has been coded) which the error has been displayed through is our responsibility, we get the blame.
    – GurdeepS
    Aug 14, 2009 at 23:54
  • "I don't have skills above theirs." Yes, yes you do. You're here asking how to improve yourself, that alone is +100. If its a shouting contest turn it into a results contest. It's not just about earning the cash (although that's priority #1) it's about earning it reliably. If your code is revenue generating they have to listen otherwise GTFO.
    – Al.
    Aug 15, 2009 at 0:10
3

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. 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.

Let me get this straight: you work in a "very hostile" company where a single deployment error means "your job is on the line." Yet you have no source control, test servers, bug tracking, etc.? I'm also assuming this means you don't have continuous builds and unit tests as well?

Honestly, I think the best way you can cover your back is to spice up your resume and start looking for other jobs. The whole notion of not using source control or test servers or bug tracking or any of the other foundations of modern software development is repugnant. Even more repugnant is that a company would be so aggressive with its employees all while refusing to provide even the most basic development infrastructure.

If you do decide to stay, see if the company will (at the very least) pay for an Assembla account--this will get you SVN, nice project tracking tools, bug tracking, etc. for literally a couple bucks a month. For a large team, it might be like $50 a month, but that is an absolute pittance compared to the cost of hiring and firing programmers for stupid mistakes. It takes almost no time to setup, and they don't have to babysit any servers.

0
2

I know this may seem like a cop out, but given the way your describing this environment my only meaningful advice is this: start looking for a new job.

I've been in some pretty horrible situations, for a time I actually felt physically nauseated at the prospect of coming into my job each day, and at least we had source control (I really can't imagine trying to develop anything significant without it, so part of me almost wonders if this is trolling).

You can try to think of every eventuality, but if things are truly as bad as your making them sound, if there is blame and recrimination, someone, somewhere along the line will find a way to pin something on you even if you did everything right (This actually happened to me at my job).

In my case, I stayed with my company for years after I should have left and I was utterly miserable as a result. Once I did finally start to look, I had a new job within months, double the pay, and was a much, much happier person, both at work and outside of it.

1
  • Someone else felt this way (another IT dept), and left for a better job with all of those things. It's just that people high up look for scapegoats (are doing so right now) and if you screw up the job you've worked hard to do, then they will wonder why are you here (our team leader said something along these lines).
    – GurdeepS
    Aug 14, 2009 at 23:43
1

"We have no source control, test servers, bug tracking, etc"

Oh man I could tell you some stories along those lines. I was on a similar project at one point... My bad for not fully checking out their development environment first, fortunately it was a short term project.

The software I was developing ran in a 3rd party framework where new components could be added and removed fairly easily. To develop, I installed a duplicate of the same framework on my machine and did all testing against that. Module installation was automated and ran against my local environment so I could be reasonable sure I could reliably install it to the live environment. I kept my own backups and covered my code with unit tests. This worked pretty well, I had a reliable environment to develop in then when things went live they mostly behaved as expected.

There were problems, but in an environment like there are going to be definitely bigger problems so I was not singled out for persecution. I am a senior dev and was able to communicate/set expectations well, so it worked out.

Definitely look for other work in the offhours.

1

Dude, respect.

Seriously, working without source control and still be able te work in a team and then actually deliver... Amazing. I can not imagine coding any project than your next door neighbour's companies website without it.

I can only agree with most people here, it sounds like a nightmare, get a new job. But, as i said in a comment, the economy sucks at the moment.

If you can't get a new job, at least install a source control for yourself and introduce your colleagues to the possiblities of labelling milestones, branching (and if you go all the way, bug tracking), being able to compare old versions to the latest one, etc. i.e. the stuff that makes SC so damn handy.

Show you manager the advantages as well, he is bound to come around, and make sure to tell him that it doesn't even have to cost anything!

Good luck, and again, respect..

2
  • Taking the initiative and installing source control sounds like a really good idea, if your manager comes around and sees that you have done this and it has made everyone work better and faster (which it almost undoubtedly will) while not costing the company anything, will show that you have initiative and may even lead to a promotion (which will give you even more opportunities to improve the tools available) Aug 15, 2009 at 0:42
  • I'm going to do this. I can get Perforce (Free).
    – GurdeepS
    Aug 15, 2009 at 1:30
0

Seems to me given your situation, your doing what would be the proper thing. However it bugs me that your based on a try fail system with no method of testing your work at work where as at home you can test your programs. The irony to me is that the place you work which is spending money on you and the program you make isn't doing the Q&A to make sure that to catch all the bugs. Your techniques aren't bad at all for your situation, What i would say to you would be to anticipate as much as you can, and if you get an unanticipated error, make the program fail gracefully.

I had a similar thing with a website i made in a advertising agency, i told my boss that i was going to make the website for 1024x768 and i was going to disable the scrollbars. The one of the first people he showed it to had a resolution smaller than that, and i got chewed for it, thankfully he okayed the paperwork for that before hand

4
  • Most of the work here is ASP.NET (websites). Exiting gracefully in any app doesn't look good.
    – GurdeepS
    Aug 14, 2009 at 22:49
  • sure, it doesn't look good but its not possible to anticipate everything. Your log files though should be able to help you build new work arounds for those new cases
    – Jim
    Aug 14, 2009 at 22:53
  • True. Yeah the logs would help with that but then at the moment, I don't think we put the apps we make in an incubation period where we could test it out in a mirror of the production environment (eg staging). I guess I need a framework - so the app will work in this environment, not in this way, etc. I like the way you told your boss you would make something in a certain way - that helps (keeping him/her informed).
    – GurdeepS
    Aug 14, 2009 at 23:36
  • one way to cover your ass i found, is to put in writing what it is your going to do and submit it to the boss/lead/ overlord and get them informed on exactly what you intend to do and have them sign up on it, im known when i do websites i get in writing what the client wants the website to do, and then i will photoshop a mockup of how it will look when i am done and then have the client sign off on that before i even start, saves time defining things like a color pallette
    – Jim
    Aug 14, 2009 at 23:57
0

I don't think there's any good solution to your question, I mean, other than the obvious tools that you're obviously aware would mediate the issues you're running into. It's not a fun situation to be in but we've all been there. Try to work the words "source control" and "testing" and such into your conversations with the other developers and maybe it will start to sink in. Until then, just realize that all these less elegant methods you're using to cover your ass are going to make you a better developer once you get into a better work environment... and look for another job. ;)

0

You mentioned that there is a serious lack of tools there, basic ones like unit tests and source control. Are these actually banned? Or just not used by convention?

I suspect it's the former and I'd suggest leading by example. You seem to already be taking steps to avoid code issues, but can your coworkers claim that you wrote code that you didn't? (I've had to stand up in front of reviews and deny claims that I wrote faulty code, luckily there it was trivial because the offending code was written in a language I don't know, but I would have gone to source control if that wasn't the case).

At the very least use source control yourself. Set up a private repository, treat it like your own personal branch, and check in changes. Then when you're ready to integrate those changes, treat it like you're merging into the trunk (or merging the trunk into yours). Then at least you'll be able to show what code you wrote. Step two is to demonstrate the value-add of a system like that and introduce it to more of the company.

At the very least do this with the basic tools that you personally use and try to build your environment to something where you can trust your code.

1
  • I've seen unit test tools on some dev machines (eg the senior guys) but I have not seen any evidence that these tools are used. All I hear is "need to look into testing more" - and this is a personal learning target.
    – GurdeepS
    Aug 14, 2009 at 23:45
0

How can I ensure that my code, however small, will work in all environments?

I suggest peer reviews of your code and of your algorithms; and not only by peers but also by your team leaders (and, to some extent, the customer and/or product manager).

But really this is a huge subject. Part of the answer is that nothing works in all environments, so if it matters then a large part of the solution is specifying and then controlling the environment .

1
  • We do peer reviews (this happens in every company) but it's not going to find all problems. Testing your app in different conditions is another story.
    – GurdeepS
    Aug 14, 2009 at 23:44
0

I would leave that place as soon as possible. The fact that the company doesn't have these tools in play already is probably an indicator that they really don't care about the products they produce.

1
  • Problem is, I have worked in quite a few places all doing large scale development (apart from 1 company which wasn't geared for development), and none of these companies use proper tools apart from Visual Studio. It seems so hard to find a company which uses proper tools - not just the IDE and Sql Server.
    – GurdeepS
    Aug 15, 2009 at 0:21
0

You're in a bad situation. You have three(ish!) options:

  1. Quit (it sounds pretty bad, so this may be a good decision!)

  2. Complain and do nothing while hoping for the best.

  3. Constructively complain and do something about it. Make incremental improvements. Set up source control, a bug tracker, continuous integration, unit testing. Don't ask for permission, just do it. Show people the benefits of doing this. There's a good Joel article on this subject and, as the Pragmatic Programmer says, "it's easier to ask for forgiveness than permission".

The bonus of this approach is that, even if nobody takes any notice of you or buys in to the improvements, it will be a good talking point if you interview at another company. It will prove that you think about your day to day development effectiveness and that you're a do-er rather than a whiner. :)

Good luck.

1
  • These aren't so much options as things you should do simultaneously. (Well, okay, you should prepare to quit while doing the other things.)
    – Imagist
    Aug 15, 2009 at 5:52
0

One thing junior folks (and many seniors) don't seem to get is that your process for checking in changes to revision control needs to be the following:

  1. Test your code to make sure it works right.
  2. Check in your changes
  3. Pull the entire baseline down into a brand-new directory
  4. Build the baseline
  5. Test again

Everyone wants to quit after step 2. However, you'll be amazed how many errors you catch in steps 4 and 5. What tends to happen is that you will either forget to check in a change, or create a brand new file and forget to add it to revision control. There are other odd things that can happen too. Building from a clean directory protects you as much as possible from your own errors.

5
  • 1
    Uh, he says there's no source control. How is this relevant? Aug 14, 2009 at 22:47
  • Yeah, it isn't. But can you explain steps 3 and 4 for me? Thanks.
    – GurdeepS
    Aug 14, 2009 at 22:48
  • 1
    Steps 3-5 are demonstrating that, if your laptop was destroyed, you could reproduce a running system from what is in source control. It shows that you haven't forgotten to commit any changes and that the build process didn't leave some crucial bit lying around.
    – retracile
    Aug 14, 2009 at 23:07
  • Having continuous integration and a good suite of tests mitigates this risk, as does having 10 other devs sync up to your changes and then start throwing stuff at you :) Aug 14, 2009 at 23:21
  • Since this seemed to confuse folks, I added a sentece to clarify.
    – T.E.D.
    Aug 17, 2009 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.