1

I started working in a company not much time ago, and what I see a lot inside a project is a high amount of low quality code and some custom ideas instead of industry standards and selected best practices.

But when I trying to talk with manager about that, I often see the answers, that guys who doing that make things quick and they are good etc, etc, etc

4

This is fundamentally a cultural issue. First of all, be careful of thinking you can "prove" that a different methodology is better. With time and experience, you'll get better about "persuading" your colleagues about better practices.

The problem is that the people in a shop develop certain habits, and come to certain shared understandings, and become quite comfortable in that. They experience "confirmation bias", in which their experiences confirm their bad practices ("I wrote that really quick and dirty, and we still shipped on time!") and discount evidence that contradicts their beliefs ("I spent three weeks on that bug, but I'm moving on to new code now.")

My experience is that the shops with bad practices are particularly resistant to good practices. The reason the shop settled on bad practices in the first place is that they weren't interested in alternatives.

On the other extreme, I've worked in shops that were so smart, and so open to new ideas, that it got kind of crazy because the infrastructure was so dynamic even from week to week, it was hard to tell how to write code and get it released (I'm currently in a situation where I've been waiting a month for a QA box, but they just re-engineered their code check-in workflow, so I'm back to square one, with no QA box. Or maybe square -1.)

As you stay with a shop, and as you gain responsibility, you'll have more and more influence on the culture. After all, the guy sitting at the keyboard ultimately makes a lot of the decisions. But it will be a long process of identifying specific things that could be improved, and either changing them individually yourself, or educating and persuading others to follow a better way.

...

...or, I should add, moving to a different shop. In this industry, sometimes the grass really is markedly greener on the other side.

  • +1 for "Sometimes the grass really is markedly greener on the other side." – John R. Strohm Jul 21 '14 at 22:03
-2

In the case of refactoring, for example: Refactoring takes time. Time costs money. Therefore, refactoring is only worthwhile if you get benefits from it that outweigh the refactoring cost.

Just after you have created a kind-of-working solution, that's the time when refactoring is cheapest (because you know the code inside out at that point), and can give immediate benefits if refactoring makes bugs visible and debugging easier, so you get to bug-free code faster.

The other time when refactoring is useful is just before or while you have to make changes anyway, if the existing code is sufficiently bad, and it is cheaper to turn bad code into good code and modifying good code than trying to understand bad code and modify it.

Refactoring code that nobody looks at is pointless.

  • 1
    I think there is a shallow view to the problem. Of course if you just write the code and then it's going to be unchanged and no one read it, so your point make sense. But all we know 1) code changes often 2) we write code once, but read it many times. And than if you will spend more time to read the peace of code each time, just because it's hard to read or dirty, it's very expected that one day you start spending more time on reading, than for re-factoring. So that's is an important point, that you miss in your thoughts. – Ph0en1x Jul 21 '14 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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