3
votes
3answers
122 views

Can removing unnecessary file from a repo be considered part of refactoring?

We're using Git as our DVCS and we're about to start to do a clean up (never done before in this team) of files that are not necessary (not part of the sources) from our products. This is done in two ...
12
votes
6answers
4k views

Avoid too complex method - Cyclomatic Complexity

Not sure how to go about this method to reduce Cyclomatic Complexity. Sonar reports 13 whereas 10 is expected. I am sure nothing harm in leaving this method as it is, however, just challenging me how ...
2
votes
2answers
344 views

Prevent code from getting mess [duplicate]

I am a student and a freelance programmer. These days I am developing a software in VB6 which has recently crossed 100KB of source code. The main problem, I face is, many times I have to refactor my ...
4
votes
2answers
547 views

How do I handle having so many SQL queries?

I have an MVC3 project that uses SQL Server. I use data from the SQL database all the time and I often find that I'm reusing/duplicating some SQL queries. I thought I'd solve this problem by creating ...
3
votes
4answers
394 views

Can notes/to-dos in code comments sent to code-reviews result in an effective refactoring process?

I want to start/improve a culture of collective code ownership at my company but at a geographically distributed level... I'd say there is some current collective code-ownership mentality, but only at ...
21
votes
5answers
1k views

What is the politically correct way of refactoring other's code?

I'm currently working in a geographically distributed team in a big company. Everybody is just focused on today's tasks and getting things done, however this means sometimes things have to be done the ...
2
votes
7answers
676 views

After how much line of code a function should be break down?

While working on existing code base, I usually come across procedures that contain Abusive use of IF and Switch statements. The procedures consist of overwhelming code, which I think require ...
5
votes
5answers
901 views

Example bad code project to motivate refactoring / good design [closed]

This is sort of the opposite of Is there an open-source project that can be an example of well-written code?. I am teaching software engineering to undergraduates and I would like a blob of object ...
3
votes
7answers
266 views

How best to prevent having to revisit a change after check in

Normally what happens is that I work on something for a while and then when I am done I check it in(After the test/review process of course). Sometimes I have to go back and fix something that I got ...
27
votes
9answers
2k views

How clean should new code be? [duplicate]

I'm the lead designer in our team, which means I'm responsible for the quality of the code; functionality, maintainability and readability. How clean should I require my team members' code to be if ...
23
votes
15answers
1k views

How do I convince my team to use smaller classes/methods?

Disclaimer: I'm a newcomer (this is my third day of work), and most of my teammates are more experienced than me. When I look at our code, I see some code smells and bad engineering practices, like ...
5
votes
5answers
199 views

Is there a name for the concept of a hierarchy of many short methods in a class

A refactoring I commonly do is where I come across a large method such as public void doSomething() { // do First thing doPartA1(); doPartA2(); //now something else ...
26
votes
6answers
846 views

What payoffs have you seen from taking care of technical debt?

This article on technical debt has some good points, including: Working on the "technical matters" works best when it is driven by stories. The code base is probably in need of work everywhere, ...
14
votes
11answers
410 views

Should you fix preexisting defects while working on something else?

Conundrum: During the course of working on a new feature or fixing a defect, you find a legacy problem in code. What should you do? Fix it and risk altering the behavior of the code. It has either ...
17
votes
8answers
778 views

Does anyone else have a refactoring problem? [closed]

It seems like after I've written a significant amount of code I get this anxious feeling like I haven't done it in the best possible way, and I end up continuously refactoring and spending way too ...