11 Replies - 1300 Views - Last Post: 27 June 2014 - 10:11 AM

#1 LostTheMarbles  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 10-June 14

Dealing with a company that doesn't use coding standards

Posted 16 June 2014 - 02:51 AM

How do I deal with this without driving myself totally insane?

We have no coding standards, no test harnesses, no code reviews, nothing :(


I've talked to the manager about them and tried selling their virtues to him but he claims it's too late in the project to introduce them and he's pretty much anti anything that would improve overall quality.

One of the other senior (Old, not experienced) developers is the key wall, he sees it as an insult that I'd even look at his code, let alone suggest there are issues in it, I'm quite gentle and diplomatic when I do so but he's just not open to any suggestions.

I (and a few others) spend most of my time fighting against the development style rather than making and real progress towards our targets.


Leaving isn't an option right now but it has been tempting :P

Is This A Good Question/Topic? 0
  • +

Replies To: Dealing with a company that doesn't use coding standards

#2 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 431
  • View blog
  • Posts: 2,989
  • Joined: 12-January 10

Re: Dealing with a company that doesn't use coding standards

Posted 16 June 2014 - 02:56 AM

you can tell them how much time is being wasted trying to figure out other peoples codes without comments --

style is all relative -- some people like items like goFishLbabel or go_fish_label or goFishLbl or lbl_go_fish etc.

if you are using vs there is an auto format option Edit -> Advanced -> Format Document (CTRL+K, CTRL+D)
Was This Post Helpful? 1
  • +
  • -

#3 LostTheMarbles  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 10-June 14

Re: Dealing with a company that doesn't use coding standards

Posted 16 June 2014 - 03:04 AM

View PostDarenR, on 16 June 2014 - 02:56 AM, said:

you can tell them how much time is being wasted trying to figure out other peoples codes without comments --

I've tried it from that approach but didn't get anywhere, he says style is an individual thing and he wouldn't want to stifle creativity. A nice easy way to brush off my comments from what I can see.

View PostDarenR, on 16 June 2014 - 02:56 AM, said:

style is all relative -- some people like items like goFishLbabel or go_fish_label or goFishLbl or lbl_go_fish etc.

I don't really mind the lack of naming conventions as much as some of the other things that are missing, saying that, I prefer the goFishLabel style names as they're easier to read and write out.

The big ones that hurt readability are people not using {} brackets after an if statement if they're not needed and the lack of vertical indentation (blank lines) around logical blocks and around functions, this one developer says he likes to fit as many lines of code as he can onto a page and thinks blank lines are a waste of space. Oh yeah, we don't have comments either.
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is offline

  • Dic Head
  • member icon

Reputation: 5163
  • View blog
  • Posts: 26,832
  • Joined: 10-May 07

Re: Dealing with a company that doesn't use coding standards

Posted 16 June 2014 - 03:14 AM

View PostLostTheMarbles, on 16 June 2014 - 05:51 AM, said:

How do I deal with this without driving myself totally insane?

It is important to remember that when you interview for a position, that you are also interviewing them to see if their company is a place that you would like to work. When they ask if you have any questions, this is a good time to go over standards, assumed practices, IDE's & other tools.

View PostLostTheMarbles, on 16 June 2014 - 05:51 AM, said:

I've talked to the manager about them and tried selling their virtues to him but he claims it's too late in the project to introduce them and he's pretty much anti anything that would improve overall quality.

While you may feel that you are making an improvement, you must also realize that to this manager you are basically telling him or her how to do their job. As well as you are pointing out a lack of effort to a specific area & shoving it in their face. It's all about approach.
Was This Post Helpful? 2
  • +
  • -

#5 LostTheMarbles  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 10-June 14

Re: Dealing with a company that doesn't use coding standards

Posted 16 June 2014 - 04:02 AM

View Postno2pencil, on 16 June 2014 - 03:14 AM, said:

While you may feel that you are making an improvement, you must also realize that to this manager you are basically telling him or her how to do their job. As well as you are pointing out a lack of effort to a specific area & shoving it in their face. It's all about approach.


I initially approached it in a way to be quite soft and to avoid spreading blame, I suggested improvements instead of criticizing anything.

We're working in C# so I tried out tools like ReSharper and nDepends and showed how they could find potential problems that wouldn't be spotted otherwise, the soft approach didn't really work so I found some specific bugs and softly presented them to them as why the tools are so powerful without backing him into a corner or letting him get defensive.

I should mention, we don't have code reviews or any QA or test team.
Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5432
  • View blog
  • Posts: 11,643
  • Joined: 02-June 10

Re: Dealing with a company that doesn't use coding standards

Posted 16 June 2014 - 05:34 AM

*
POPULAR

If there are no standards, then there is nothing stopping you from using your own within your code, right? LEAD BY EXAMPLE.

Define your own naming convention and stick with it. Use #regions to keep properties together, and methods together and so on. I make a point of updating snippets for things like properties so all I have to type is nuprop{tab} and have an entire property with regions and comments and INotifyPropertyChanged support inserted, making them all follow the same standard, and so on.

Put in text file that define your naming convention, hand ChangeHistory.txt files.

When your fellow coders start opening your files and see how nice it is to have all that they will start adopting your standards.

If your manger won't make it happen, then he's not going to stop you either. At some point it will take hold at a grass-roots level. And... maybe, just maybe, your bosses boss might notice who's a real LEADER amongst his peers.
Was This Post Helpful? 5
  • +
  • -

#7 jimblumberg  Icon User is online

  • member icon


Reputation: 3987
  • View blog
  • Posts: 12,298
  • Joined: 25-December 09

Re: Dealing with a company that doesn't use coding standards

Posted 16 June 2014 - 08:46 AM

While I agree with tlhIn`toq. I want to say that if you are modifying someone elses code you should stick with their coding convention, unless there is a very good reason to change it. If you think your co-worker is sensitive to you even looking at their code imagine the problems if you start making wholesale changes to his code.

But by all means in your own code use what you think is the proper standards, and justify these standards as already suggested.

Jim
Was This Post Helpful? 2
  • +
  • -

#8 cfoley  Icon User is online

  • Cabbage
  • member icon

Reputation: 1937
  • View blog
  • Posts: 4,022
  • Joined: 11-December 07

Re: Dealing with a company that doesn't use coding standards

Posted 24 June 2014 - 03:36 AM

THE BIG ONES

The big ones that hurt readability are people not using {} brackets after an if statement if they're not needed


You can get used to this. I don't care if braces are there or not because I've worked with both styles long enough to see it, and using your IDE's autoindent helps shape the code correctly.

and the lack of vertical indentation (blank lines) around logical blocks and around functions


That's annoying but I bet you can get used to it. If not, I recommend using a formatting tool to space everything out before you edit.

Oh yeah, we don't have comments either. 


This is actually good. Comments tend not to get updated when the code changes so they often lie. It also means that you don't have commented out blocks of code lying around too.

As much as I am a fan of clean code, I would say these are the little ones. Armed with a code formatter, you can view the code in any way you like. Good ones can even add braces for you or remove them when they are not needed. You can specify rules for blank lines, indentations, line length, spaces around parentheses and so on. I've barely scratched the surface. The best part is that if people really dislike nicely formatted code you can use your formatter to jumble it all up the way they had it.

I'd say the big ones are these:

We have no coding standards, no test harnesses, no code reviews, nothing


I hope you at least have an architecture and a plan, but from what you say this is doubtful.

tlhIn`toq is right. Lead by example and hold yourself to a higher standard than the rest. Write nice clean code so that yours is simple to understand and modify. Follow TDD so that you complete your work quicker. Any bugs you introduce will be due to misunderstandings rather than crap code. They'll be easy to fix anyway since your code isn't a mess. Commit your tests so people can see them but keep a local copy. I bet people will delete them either out of spite or when they make a change that causes them to fail.

However, if you consistently churn out bug free code faster than they churn out bug-riddled code you'll build up a reputation as a good developer and then people might start paying attention to the practices that enable such high quality work.
Was This Post Helpful? 2
  • +
  • -

#9 LostTheMarbles  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 10-June 14

Re: Dealing with a company that doesn't use coding standards

Posted 24 June 2014 - 03:53 AM

Thanks again.

I've been doing my best to keep my own standards as high as possible and I've brought a few others on board but there's still resistance from the manager and the teacher's pet, we also have a guy working remotely who has no feedback and is producing the worst code I've ever seen.

I've talked about adding test cases and using other tools to improve quality but the default response is that there's no time for things like that at this stage, it's the usual: I know it's wrong, we've always done it wrong so at this stage, lets keep doing it wrong.
Was This Post Helpful? 0
  • +
  • -

#10 cfoley  Icon User is online

  • Cabbage
  • member icon

Reputation: 1937
  • View blog
  • Posts: 4,022
  • Joined: 11-December 07

Re: Dealing with a company that doesn't use coding standards

Posted 24 June 2014 - 05:48 AM

It sounds like you are making good progress but it also sounds like the manager and "teacher's pet" are set in their ways. You have to be very careful you don't upset them too much as their egos might have a long way top fall. Yes, your better practices will produce higher quality work faster and yes, their quality metrics that you have described to us will lead them down the wrong path. However, your job is at their discretion. If quitting isn't an option, getting fired isn't good either.

I would continue to lead by example. They might come round to embrace your practices. It might take a ling time and they might pass it off as their ideas

By the way you don't need a framework to write tests. I usually put together a quick and dirty way of testing things when I learn a new language. Here's a Java example (ironically untested).

public class QuickCheck {

	static String quickTally = "";
	static String detail = "";

	public static void check(boolean isPass, String failMessage) {
		check(isPass);
		if (!isPass)
			detail += "\n" + failMessage;
	}

	public static void check(boolean isPass) {
		logTally(isPass ? '.' : 'F');
	}

	private static void logTally(char c) {
		System.out.print(c);
		quickTally += c;
	}

	public static void report() {
		System.out.println(detail);
		System.out.println(quickTally);
	}

}


OK, I guess this is a framework but it will let you write tests and print a report. You could even add methods like checkEquals() that just call the other methods if you feel it would save some time.
Was This Post Helpful? 1
  • +
  • -

#11 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4422
  • View blog
  • Posts: 7,690
  • Joined: 08-June 10

Re: Dealing with a company that doesn't use coding standards

Posted 27 June 2014 - 08:38 AM

I'll throw my weight in behind the "no comments" crowd. I believe code should be self-documenting. If you can't read the code and know what it does, it needs to be refactored until you can. If that's not possible, comment away, but in reality inline comments are noise 85% of the time. It breaks the flow of reading an algorithm, and usually the wrong thing is commented. //loop through the array and apply calculation is a great example. No shit, I can read a for/foreach loop. I know what the code says it does. I don't need a comment to repeat that. If that calculation isn't obvious what/why, that's what I'd like to see a comment about. //this algorithm transforms data x to data y because business rule z. That's more like it.
Was This Post Helpful? 1
  • +
  • -

#12 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5432
  • View blog
  • Posts: 11,643
  • Joined: 02-June 10

Re: Dealing with a company that doesn't use coding standards

Posted 27 June 2014 - 10:11 AM

I agree it depends on the purpose of the comments.
Sometimes you can't tell looking at the code what the data it is processing is going to look like... Or what the third party vendor is doing weirdly that you have to compensate for. If you study the code someone else wrote to handle that oddity long enough you might glean it.

But a note at the top of the method that says:

// Stupid third-party protocol has the red and blue swapped in their 
// photo transmission. So don't fix this method: Its supposed to be
// swapping the colors in order to patch their screw up.


Can save you a lot of issues caused by someone 'fixing' a 'broken' method that really was never broken, but could have looked broken to anyone not familiar with the context of its use or the content of the data it was processing.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1