tags:

views:

411

answers:

12

So, in reading this site, it seems that the shop in which I work does a lot of things wrong and some things right. How can I improve the code that I work with from my colleagues? The only thing I can think of is to lead by example - start using Boost, etc. Any other thoughts?

A: 

Leading by example is always a good thing, though convincing others that your example is better than however they're currently doing it is not so easy. Constructive criticism through code review is probably your best bet for gently suggesting alternative approaches to how your colleagues work. The key point is to convince others that what you're proposing really is better in a tangible way that they can appreciate.

Jason Etheridge
+2  A: 

You probably have to look more closely at what it is your shop does wrong and what they do right. What can you actually change there? What can you change about your own practices that will improve your skills or that of your team? It can be difficult to realize change in an entrenched shop. Try proposing code reviews (on your code first), which could lead to discussion.

For tangible items, I'd look at Scott Meyers' Effective C++, etc. Develop your skillset and you will either help improve others around you or move on to a shop that will. Also, look at the Gang of Four's Design Patterns book.

Kris Kumler
I'll also note, this answer was quick and could have gone on forever, considering the breadth of the question. I'm assuming this is someone without too much experience in different shops at all.
Kris Kumler
A: 

Sometimes folks have to see that your way is working better than their way. It is often difficult to make people change.

Have you considered unit test writing if you don't do that already? I've found it to really improve my production code and give me more confidence that what I'm writing is what I'm supposed to be writing.

I like Jason's idea about code reviews. They can be helpful or they can be a place for arguing - really depends on how you set the tone.

itsmatt
A: 

Architect and design the project well so that none of the developers will be able to take a different route to violate the quality. If you set a great design, people will just follow the route and they will automatically learn

Jobi Joy
A: 

Other things to try is to add unit tests and documentation.

1800 INFORMATION
A: 

Although this probably isn't as direct of an answer, I recommend you pick up the book Code Complete. I find it to be the best resource for learning how to be a better programmer. If you read through the whole book and understand what it talks about, you'll really learn how to better yourself, and your code.

Dan Herbert
+2  A: 

Code reviews are the best way I found to improve code quality overall. Reviewing code from different individuals helping each other increases general awareness of different techniques and help propagate best practices. Hire a person more experienced than you are is also a good tool but it is a bit more tedious to implement.

David Segonds
A: 

I find writing unit tests helps code quality a lot - it means you have to think about how your code will interact with the tests and other parts of the code.

Peer code-review: Checking quality of code will also make the programmers think about how they write the code.

graham.reeds
A: 

It's great that you recognize that there's room for improvement and have the desire to try to enact some change. I suggest reading James Shore's 19-week diary where he documents the steps that he went through to enact agile development at his company. It's a hard fight, but his experience shows that you can make a difference.

Mike
+2  A: 
  • Reading good programming books
  • Learning from other's code - Open source projects are the best place to start
  • Read good blogs and forums regularly - Sutter mill, Coding Horror, Martin fowler etc
  • Code reviews
  • Unit tests
  • Using good libraries like Boost, STL. Also understanding their implementation
TG
A: 

Just asking the question is a good start.

Specifically you can:

  • Admit that your code sucks
  • Start asking others, preferably others with more experience, to review your code
  • Implement a continuous build server - you have to be the one who uses this first
  • Have courage because this can be difficult
  • Be humble
  • Read Code Complete
  • Use a software development methodology that encourages team work. Some of the agile methodologies are really good at this
  • Read development blogs
  • Get involved in a user group

Change is hard and you have to be the one who changes first.

If you are working in an environment where others are happy the way it is you are going to have rough going. Be persistent about wanting to improve code quality.

SWD
A: 

I am biased (as a result of my work), but depending on your budget (if it exists) static analysis is a possible option. There are lots of different types of tools, some of which also include coding standard enforcement checking..

If you use g++, you might be able to get a basic amount of help from the -Weffc++ option.

Richard Corden