6

Don't refractor for fun!

An anecdote from my previous company. A developer had written a shitty java console app for fetching stock prices. About 3000 LOC. just one java GOD class. So, when me and my friend looked at it, we were amazed how that code works with all that if conditions spanning 100LOC. so. My dear friend underestimated the complexity. Since it just fetches stock price and puts in database right. I can write it in few days and much better one. So, he started writing code in an OO way. Three days later I see he still working on it. Having a glimpse at code. The app is now Object oriented shitty and ugly.

Guess what new code never goes in prod too.

Learning
Don't underestimate complexity of app.
Be empathic about fellow developer. Don't think he has written a shitty code. Think why he had to do so.
Don't work on refractors if there is no one to guide you.

Comments
  • 1
    I agree with everything but the last line.
  • 0
    @Root the reason I say this because we start with refactoring code on our personal adventure which doesn't go well and ends up being an expense to the company that you work for.
  • 0
    @no0bdeveloper Often the original developer -- or anyone familiar with the legacy code in question -- simply isn't available.

    While wasting time on a refactor definitely isn't ideal, sometimes those refactors are quite necessary regardless.

    Like I said, though, I agree with everything else!
Add Comment