3 ms·
I've followed a very similar road. For me, the thing which halted that ivory tower mindset was changing languages. I find that after spending a lot of time in
by josephg 15y ago
I've followed a very similar road.
For me, the thing which halted that ivory tower mindset was changing languages. I find that after spending a lot of time in a single language, I start thinking along that language's lines when I'm designing software. There are a lot of things which are a good idea in some languages and rubbish in others. Eg, enums are great in C, but useless in Javascript. Interfaces and abstract classes are silly in ruby.
I think there's a trap programmers fall into with this stuff, where we get used to some method / philosophy. After awhile, its easy to forget that the method comes with a price that is being paid daily. Only by periodically re-evaluating all the little decisions you make can you start to get a real sense for when those decisions are appropriate.
But as for the code rot problem, there are two solutions I've seen which made a difference:
- Test-driven development (full on, no cheating, tests before you write code. 95%+ code coverage)
- Code reviews before every commit
But both of these methods will slow you down heaps in the short term.
I find proper TDD makes me about half as productive in the short term. In the long term, it slows down big redesign work because there's twice as much code to change. The benefit is that you can formalise all your obscure edge cases in tests. If your test coverage is good enough, you can safely refactor code without breaking anything. This removes fear from development and lets you make clear decisions about design. (Also, its amazing how many bugs you find when you start writing tests. It is humbling.)
I suspect that most of the benefits of code review comes from simply setting aside time to talk about code style. It consumes a lot of time. In exchange, you get higher quality code.
How much you care about speed and code quality really depends on what the project is. You need to try them both out some time to be able to make that decision properly.