32

One thing I learnt after over two years of working as a programmer is that sometimes making your code DRY is less important than making your code readable, ESPECIALLY if you're working on a shared codebase. All those abstractions and metaprogramming may look good in your eyes, but might cause your teammates their coding time because they need to parse your mini-framework. So code wisely and choose the best approach that works FOR YOUR TEAM.

Comments
  • 0
    might cost them*
  • 0
    I remember struggling with this when I was a junior. The senior dev did exactly what you describe and everything took forever to do because it was so confusing.
  • 1
    This is where a good IDE comes in handy, that lets you jump to the method declaration to easily find out what it does.
  • 0
    THINK OF THE TEAM!
  • 0
    I think it's fine to use metaprogramming and abstractions when you code 3rd-party packages where other developers only care about the public API you expose and not about the underlying implementation of your packages. In your company's app, try not to. :)
  • 0
    @chrisrhymes if it involves metaprogramming and initiating a class from concatenated strings that form the class name, I don't think IDEs are going to help. you'd have to run the program and use debugger to look at the variable values at that particular point to understand the code. that's not very convenient.
  • 0
    @thatmalaysian agreed, but try writing some comments to explain what it does and what it's used by.
Add Comment