Skip to main content
Notice removed Draw attention by DeveloperDon
Bounty Ended with Joris Timmermans's answer chosen by DeveloperDon
Post Made Community Wiki by Stefan
Tweeted twitter.com/#!/StackProgrammer/status/238470844416921600
Notice added Draw attention by DeveloperDon
Bounty Started worth 100 reputation by DeveloperDon
deleted 2013 characters in body; edited tags; edited title
Source Link
user8
user8

Finding time to refactor code How can I make refactoring a priority for my team?

The codebase I work with daily has no automated tests, inconsistent naming (mixing lower and upper case, Hungarian notation, underscores on class names, etc) and tons of comments like "Why is this here?", "Not sure if this is needed" or "This method isn't named right" (but nobody ever took the time to rename it to something better) and the code is littered with "Changelogs" despite the fact we use (a poorly implemented) source control. Some of the code is written in a procedural style in C# (including one massive file, 4k+ lines long that includes and relies on several goto statements), and some is written like old VB6 code, Hungarian notation and all. Code is often copy-pasted between pages, classes and applications. Business objects are a mix of logicSuffice it to say, data access and utility methodsour codebase could use refactoring.

We always have tasks to fix bugs or add new features, so no time is put aside to refactor code to be better and more modular (for example, there are no interfaces anywhere in the codebase; it's all concrete classes). In fact, the company culture seems to consider refactoring to be a useless endeavor that wastes the businesses' time and money since we aren't developing new features; when I mentioned some serious design flaws with the code that should be addressed, the answer was basically "The executives always has new features they want done, so we can't really go back and make the code better." Iit doesn't seem to be the only person on the team who even understands how to write modular code or, for example, why we should be using unit tests instead of using the Debugger or poking around the app on our development machine to test it, instead of just doing a quick fix in a code-behind file, copying it across to other files, and calling it a dayhigh priority.

Now don't get me wrong; I enjoy my job and my co-workers to a point, butHow can I feel frustrated as each day passes that nobody cares about quality or craftsmanship or any semblance of professional software development - we just stack crap on top of crap and I'm afraid it's going to collapse, but there's no buy-in to takedemonstrate the time to, say, create a suite of unit tests or refactor somevalue of the nastier modules to be more abstract and easier to maintain as we add to the applications. Nobody seemsrefactoring such that it gets added to understand why those are good things.

our task lists? Is there any way I can... force the issue, as it were? I am afraid ifworth it to just refactor as I go and refactor modules on my own, or say rename some of the badly-named methods to be more descriptive I will be written upasking for doing it when nobody told me to do it, but the old saying "It's better to ask forgiveness rather than permission" comes to mind.

Any suggestions for how I can keep my sanity in this situationpermission?

Finding time to refactor code

The codebase I work with daily has no automated tests, inconsistent naming (mixing lower and upper case, Hungarian notation, underscores on class names, etc) and tons of comments like "Why is this here?", "Not sure if this is needed" or "This method isn't named right" (but nobody ever took the time to rename it to something better) and the code is littered with "Changelogs" despite the fact we use (a poorly implemented) source control. Some of the code is written in a procedural style in C# (including one massive file, 4k+ lines long that includes and relies on several goto statements), and some is written like old VB6 code, Hungarian notation and all. Code is often copy-pasted between pages, classes and applications. Business objects are a mix of logic, data access and utility methods.

We always have tasks to fix bugs or add new features, so no time is put aside to refactor code to be better and more modular (for example, there are no interfaces anywhere in the codebase; it's all concrete classes). In fact, the company culture seems to consider refactoring to be a useless endeavor that wastes the businesses' time and money since we aren't developing new features; when I mentioned some serious design flaws with the code that should be addressed, the answer was basically "The executives always has new features they want done, so we can't really go back and make the code better." I seem to be the only person on the team who even understands how to write modular code or, for example, why we should be using unit tests instead of using the Debugger or poking around the app on our development machine to test it, instead of just doing a quick fix in a code-behind file, copying it across to other files, and calling it a day.

Now don't get me wrong; I enjoy my job and my co-workers to a point, but I feel frustrated as each day passes that nobody cares about quality or craftsmanship or any semblance of professional software development - we just stack crap on top of crap and I'm afraid it's going to collapse, but there's no buy-in to take the time to, say, create a suite of unit tests or refactor some of the nastier modules to be more abstract and easier to maintain as we add to the applications. Nobody seems to understand why those are good things.

Is there any way I can... force the issue, as it were? I am afraid if I go and refactor modules on my own, or say rename some of the badly-named methods to be more descriptive I will be written up for doing it when nobody told me to do it, but the old saying "It's better to ask forgiveness than permission" comes to mind.

Any suggestions for how I can keep my sanity in this situation?

How can I make refactoring a priority for my team?

The codebase I work with daily has no automated tests, inconsistent naming and tons of comments like "Why is this here?", "Not sure if this is needed" or "This method isn't named right" and the code is littered with "Changelogs" despite the fact we use source control. Suffice it to say, our codebase could use refactoring.

We always have tasks to fix bugs or add new features, so no time is put aside to refactor code to be better and more modular, and it doesn't seem to be a high priority.

How can I demonstrate the value of refactoring such that it gets added to our task lists? Is it worth it to just refactor as I go, asking for forgiveness rather than permission?

edited tags
Link
Thomas Owens
  • 85.9k
  • 18
  • 211
  • 311
Source Link

Finding time to refactor code

The codebase I work with daily has no automated tests, inconsistent naming (mixing lower and upper case, Hungarian notation, underscores on class names, etc) and tons of comments like "Why is this here?", "Not sure if this is needed" or "This method isn't named right" (but nobody ever took the time to rename it to something better) and the code is littered with "Changelogs" despite the fact we use (a poorly implemented) source control. Some of the code is written in a procedural style in C# (including one massive file, 4k+ lines long that includes and relies on several goto statements), and some is written like old VB6 code, Hungarian notation and all. Code is often copy-pasted between pages, classes and applications. Business objects are a mix of logic, data access and utility methods.

We always have tasks to fix bugs or add new features, so no time is put aside to refactor code to be better and more modular (for example, there are no interfaces anywhere in the codebase; it's all concrete classes). In fact, the company culture seems to consider refactoring to be a useless endeavor that wastes the businesses' time and money since we aren't developing new features; when I mentioned some serious design flaws with the code that should be addressed, the answer was basically "The executives always has new features they want done, so we can't really go back and make the code better." I seem to be the only person on the team who even understands how to write modular code or, for example, why we should be using unit tests instead of using the Debugger or poking around the app on our development machine to test it, instead of just doing a quick fix in a code-behind file, copying it across to other files, and calling it a day.

Now don't get me wrong; I enjoy my job and my co-workers to a point, but I feel frustrated as each day passes that nobody cares about quality or craftsmanship or any semblance of professional software development - we just stack crap on top of crap and I'm afraid it's going to collapse, but there's no buy-in to take the time to, say, create a suite of unit tests or refactor some of the nastier modules to be more abstract and easier to maintain as we add to the applications. Nobody seems to understand why those are good things.

Is there any way I can... force the issue, as it were? I am afraid if I go and refactor modules on my own, or say rename some of the badly-named methods to be more descriptive I will be written up for doing it when nobody told me to do it, but the old saying "It's better to ask forgiveness than permission" comes to mind.

Any suggestions for how I can keep my sanity in this situation?