To refractor or not that is the question.

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
maintaining old code i know it might be on the bad side not to mess with it since it is all really proven to work as it was, but i sometimes just can't help myself to go and refractor and better those methods which are 1.5 to 2.0 screens long; it is a curse i think...
 

Gnome

Executive Member
Joined
Sep 19, 2005
Messages
7,208
Err yeah, if I ever meet someone who tells me he/she isn't going to refactor because it "works", it's over, they go or I go. I get highly annoyed with methods that sit at more than 1 screen. Usually that 2 screen code is written by someone who was in a rush or a idiot anyway so there's bound to be a bug. Eventually. Change something in the code and a next one creeps up, patch, change, patch, change, hence the need for refactoring classes.

So right there with you.
 

FrancTheTank

Expert Member
Joined
Mar 30, 2008
Messages
1,046
Definte refactor, I am a changed man after some serious refactoring. If the refactoring didn't work, or bugs crept in, you're doing it wrong! :)
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
Err yeah, if I ever meet someone who tells me he/she isn't going to refactor because it "works", it's over, they go or I go. I get highly annoyed with methods that sit at more than 1 screen. Usually that 2 screen code is written by someone who was in a rush or a idiot anyway so there's bound to be a bug. Eventually. Change something in the code and a next one creeps up, patch, change, patch, change, hence the need for refactoring classes.

So right there with you.

Can't say i have any love for... The One Method thinking, example in the same method the data is read from sql, then processed and lastly excel automation is done and believe it was a long method.

Sure in the sense of one method for one thing yes, then i have no problem but as i pointed out one method for everything just is too :sick: not to mention bad implementation and easily prone to bugs.

I had time to fix up the mother method into a decent class with smaller methods just doing what they are suppose to be without any other junk stuck into it.
 
Last edited:

grayston

Expert Member
Joined
Jul 24, 2007
Messages
3,733
Refactoring is wonderful because it forces you to write decent test cases beforehand.

And test cases are wonderful because they give you confidence that your code is working.

But at some point, a manager will ask you why you're wasting your time on stuff that already works. So start thinking of an appropriate reply now.
 

FarligOpptreden

Executive Member
Joined
Mar 5, 2007
Messages
5,396
"Because it's slow and users are complaining of performance."

Usually works for me, but then I drive the development of our software... :p
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
But at some point, a manager will ask you why you're wasting your time on stuff that already works. So start thinking of an appropriate reply now.

true, but in my case taking an extra 2 hours to properly rewrite the damned thing ensures that the next person can understand it easily and increases maintainability not to mention readability without the need to reread through the whole method before known what exactly was going on due to badly commented and the sheer length of it; its almost totals in 300 lines, 6x the visual height of my window.
 
Last edited:

grayston

Expert Member
Joined
Jul 24, 2007
Messages
3,733
true, but in my case taking an extra 2 hours to properly rewrite the damned thing ensures that the next person can understand it easily and increases maintainability not to mention readability without the need to reread through the whole method before known what exactly was going on due to badly commented and the sheer length of it; its almost totals in 300 lines, 6x the visual height of my window.

:)

That's convincing enough for most techies, but now how do you convince a manager?

Especially if he's the sort of nervous manager who is mortally afraid that his developers' "experiments" would somehow break something important...
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
:)

That's convincing enough for most techies, but now how do you convince a manager?

Especially if he's the sort of nervous manager who is mortally afraid that his developers' "experiments" would somehow break something important...

well he is a senior .net developer too; my given explanation would be enough. it is in essence imho anyways a lot better to have a manager who actually knows programming through and through and are able to apply that logically with project management as a whole.

my previous manager was non technical non programming which resulted in some applications going 'patchwork blanket' / 'los lappie komberse' or if it works it goes in no matter the how or what; not saying that all non technical non programming people can't manage properly but i would say it goes a long way in properly assessing the situation and not being pushed around by technical boohoo as you would know when it is bull**** or not.

refractoring when it is needed with proper implementation by someone who knows what he/she actually are doing hardly classifies as developers' "experiments" ;)
 

greggpb

Expert Member
Joined
Apr 22, 2005
Messages
1,818
The only time I don't re-factor is when the code is not critical to the code I am fixing.. because refactoring no matter how simple mean full retest of that functionality ,bet, preprod, prod testing, (can add an extra week to release time)

but again its depends on the situation
 

Raithlin

Executive Member
Joined
Jan 4, 2005
Messages
5,049
Well, I've just spent a week changing the database over from Oracle to MS-SQL. I know, it didn't need to take me that long, but I've also refactored a lot of the code I had to change - so I've spent a good 60% of the time refactoring in the name of change (and efficiency, and maintainability, and readability - the list goes on...). I'm now 2 days behind schedule, but I'll catch that up during the length of the project - probably due to the fact that the code is now simpler to understand and change.

Makes it all worth while in the end. No matter what the manager says (and yes, I have a nervous manager).
 

Raithlin

Executive Member
Joined
Jan 4, 2005
Messages
5,049
Ta dude. It's hectic here - still no internet @work, and studying at home (when I'm not reporting to the eSA Shock Troopers). Got exams in November.
 

Raithlin

Executive Member
Joined
Jan 4, 2005
Messages
5,049
@Dequadin - Let us know your in-game name, or befriend Raithlin at least. ;)
 
Top