Question

This question already has an answer here:

This is a question I've been asking myself for a long time. Thought of throwing out it to you.

From my experience of working on several Java based projects, I've seen tons of codes which we call 'dirty'. The unconventional class/method/field naming, wrong way of handling of exceptions, unnecessarily heavy loops and recursion etc. But the code gives the intended results.

Though I hate to see dirty code, it's time taking to clean them up and eventually comes the question of "is it worth? it's giving the desired results so what's the point of cleaning?"

In team projects, should there be someone specifically to refactor and check for clean code? Or are there situations where the 'dirty' codes fail to give intended results or make the customers unhappy?

Do feel free to comment and reply. And tell me if I'm missing something here.

EDIT: I like to emphasize - What I meant by WHY is not the technical reasons, I'm asking about the motive. We all are familiar with why we should write clean code in technical point of view. But, imagine in college if I write bad code, I get bad marks (see @TofuBeer 's comment). So in your industrial environment what motivates you and your team to write clean code? And what de-motivates you and team from writing bad code.

It's so easy to write a method in a class to get the information you need without looking around and checking if there's a similar method!! result-a 5000 + lines of code with few methods doing almost similar tasks. :-(

Do feel free to add comments if you have seen or worked with same code.

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top