Should I violate TDD?

I landed my first semi-development job. Going into this job, I expected to work with knowledgeable developers, who would show me better practices of writing code. I also made a commitment to myself to stop writing hacked code and start practicing TDD along with following the SOLID principles. It turns out the other developers are complete hacks and follow no type of clean coding standards. I am finding it difficult to produce any real output at work using TDD, since nobody at work can give me any guidance. Should I violate TDD and just start writing production code without any tests, just to finish my assigned projects? I have read the TDD book by Beck and have used other resources to pick up TDD, but am not yet knowledgeable enough to employ it on my own without some guidance.

Congrats on your first development job!

First off, every work place will have their own way of doing things, automatically assuming that your co-workers are “hacks” just because they don’t adhere to one development workflow versus the other is a very poor attitude IMO. Even if they’re literally the worst developers in the world you should treat your co-workers with some respect. An attitude like that simply is not conducive to any working environment.

Second, I would try and talk to the other developers there and find out more about what their development strategy is (or lack thereof) and find out why they made some of the decisions that they did before jumping to conclusions.

There was a post on here the other day about a company that didn’t encourage testing whatsoever. It had a lot of really good suggestions there that I think would be applicable to your situation.

Edit:

Here it is: Looking for advice. "No budget for tests" - #10 by Daryl

Thank you for replying. You’re right, I may have been a little harsh calling them hacks. I have pair programmed with my senior developer and have found his coding practices to be extremely messy, leading to several money losing bugs, since I’ve been working here. From what the head developer told me, our code base was first written by a very messy cowboy coder. The current head developer also practices cowboy coding. When I have mentioned tests to him, he has dismissed them as time wasting. The senior developer is very much entrenched in his ways of coding and very closed mined to following any type of best practices. Thank you for linking the other post. I will continue to use TDD, but will most likely be looking for another job.

but will most likely be looking for another job.

@coderasm Good move, it looks like that is the best and only way to go about it, I’m in the look-out for my first Ruby/Rails job and I believe it is really important to be picky when you are starting out because a company like this will diffidently hurt your career.

I would reply: it depends … When you do the job for money and you need the money and you know the job will end soon, then close your eyes and do it. Every job will teach you something. Almost always it is worth the things you learn on the job to do the job. You can follow TDD for your self - independent from then way your coworkers will do their work. It’s not easy, but you will learn how to isolate your tests and your code :wink:
But if this is a job you will stay on for more than a couple of months, then maybe it is better to stay away.

Some years ago I had a similar problem. I switched from PHP to Ruby. Germany is PHP country. It is almost impossible to find Ruby related jobs here. But you could drown in PHP related jobs. At a certain point I’ve decided to not accept PHP jobs any more, because it keeps me away from finding Ruby related jobs and it was difficult to become a better Ruby developer, when you don’t think and solve your daily problems in Ruby (with TDD).

In conclusion - it’s not the end of the world when you do a job where you follow TDD only yourself. But be careful :slight_smile: