Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hide won't
Message
From
13/03/2014 08:25:16
 
General information
Forum:
Javascript
Category:
JQueryUI
Title:
Miscellaneous
Thread ID:
01596038
Message ID:
01596436
Views:
42
>Would you do the same thing I would?
>
>1. Reformat to get rid of the junk blank lines.

If I have to work with that code not just once, yes

>
>2. Move the code block into a new method. That keeps the mainline code concise.

Refactoring for itself borders on wasteful. Refactoring to get DRY code: certainly. Refactoring en passant while implementing change requests: certainly. Refactoring untouched methods if a large change refactored most of the rest: possibly...

>
>
>>That's a code smell and needs to be refactored.
>>
>>>Yes!
>>>
>>>Especially when you've had a prior programmer who did things like
>>>
>>>if (some condition)
>>>
>>>                          stmt1
>>>
>>>                          stmt2
>>>
>>>                          stmt3
>>>
>>>                          stmt4
>>>
>>>                          stmt5
>>>
>>>                          stmt6
>>>
>>>
>>>                          do case
>>>
>>>                                         case first
>>>
>>>                                         case second
>>>
>>>                          end case
>>>
>>>
>>>
>>>And this goes on for about 200 lines of code = 500 lines in the program.
Previous
Reply
Map
View

Click here to load this message in the networking platform