Talk:Code refactoring: Difference between revisions

Content deleted Content added
SineBot (talk | contribs)
m Signing comment by 2A01:E35:8A47:4B10:A92C:DB53:4D89:17AC - "Redesign (software): different from refactoring"
m revert - please archive comments, don't delete them
 
(15 intermediate revisions by 12 users not shown)
Line 1:
{{Talk header|search_term=refactoring}}
{{WikiProject Software
{{WikiProject banner shell| class = Start|
{{WikiProject Software | importance = }}
}}
{{findsourcesnotice|refactoring}}
 
==deleted paragraph about refactoring historically being avoided==
The paragraph about refactoring being historically avoided in general is wrong. It's long been recognized as the right thing to do but often only been put off for lack of resources and automated tools.
Line 49 ⟶ 47:
Would it be appropriate to add information about tools that support refactoring, in this page? (For example, Eclipse etc)
--[[User:Peterl|peterl]] 01:43, 4 August 2006 (UTC)
 
:[[Code_refactoring#Automated_code_refactoring]] now exists but is in need of citations. ~[[User:Kvng|Kvng]] ([[User talk:Kvng|talk]]) 15:23, 11 December 2018 (UTC)
 
== Factorization example ==
Line 57:
An article on Refactoring with no reference to [[Code Smell]]s? Ideally it should right up there in the introductory para. No later than the source code section.
[[User:DSParillo|DSParillo]] 16:58, 17 January 2007 (UTC)
 
:Currently discussed in the [[Code_refactoring#Motivation|first section]] of the article. ~[[User:Kvng|Kvng]] ([[User talk:Kvng|talk]]) 15:27, 11 December 2018 (UTC)
 
==Spin-off proposal==
Line 117 ⟶ 119:
In regards to the article [[Redesign (software)]], I read that this is apparently "Code refactoring" applicable to the entire software solution. Do you think that the redesign article needs to exist, since the difference between the two appears to be scale - and that would be subjective (i.e. how much code can we refactor before its considered redesign)? My opinion is that article should simply redirect here... thoughts? [[User:Jwoodger|Jwoodger]] ([[User talk:Jwoodger|talk]]) 00:28, 9 February 2010 (UTC)
 
: Refactoring applies small behaviour preserving changes while redesign deeply changes the code and thus behaviour. I do not think this is comparable at all since the scale and impact are totally different. <!-- Template:Unsigned IP --><small class="autosigned">—&nbsp;Preceding [[WikipediaUser:SignaturesJnRouvignac|unsigned]] comment added by [[Special:Contributions/2A01:E35:8A47:4B10:A92C:DB53:4D89:17AC|2A01:E35:8A47:4B10:A92C:DB53:4D89:17ACJnRouvignac]] ([[User talk:2A01:E35:8A47:4B10:A92C:DB53:4D89:17AC#topJnRouvignac|talk]]) 07:1752, 24 November 2016 (UTC)</small> <!--Autosigned by SineBot-->
 
== Can't see the forest for the trees==
Line 158 ⟶ 160:
:::OK, that's a substantial difference, but it seems to me refactoring could still be a large part of it. I once worked on a numerical code that had originally been written in Fortran, had been run through f2c after a couple of years and then been maintained for a couple of years. I thoroughly refactored it into more OO C++. Running something through f2c is still a behaviour preserving transformation, though the immediate end result isn't more readable, so it's a bit of a stretch to call it refactoring. [[User:Mmeijeri|Martijn Meijering]] ([[User talk:Mmeijeri|talk]]) 10:50, 5 January 2014 (UTC)
::::I agree they are related. Conceptually I would say Refactoring is a kind of re-engineering. We have to be careful to distinguish words from their English use and from specific meanings word have to IT people. So if we are talking just English word meaning than I agree Refactoring is a kind of re-engineering. But for at least some IT people, if you look for example in old reports on Gartner or Forrester before Y2K the phrase "software re-engineering" has a very specific meaning, it means recapturing design from legacy systems which in virtually all cases weren't designed with an Object-Oriented model. I don't think software re-engineering is in vogue now the way it was before Y2K. Anyway, it's not a big deal, I was just trying to link an article to "software re-engineering" where I was talking about recovering designs from COBOL and was surprised that the link ended up here. [[User:MadScientistX11|MadScientistX11]] ([[User talk:MadScientistX11|talk]]) 14:16, 5 January 2014 (UTC)
 
== merge with [[Rewrite (programming)]] ==
 
{{Discussion top|result=The result of this discussion was to NOT MERGE with [[Rewrite (programming)]]}}
I am against this merge. Too often people confuse refactoring and rewrite. They are not the same thing at all.
 
Refactoring applies small behaviour-preserving changes, while rewrite means throwing away the existing code and restarting from scratch. Refactoring should retain bugs like for like, while a rewrite removes all the previously known bugs while it adds new unknown ones (hopefully less than before and/or less severe). The process of refactoring can be stopped at any moment and the system remains functional at all times. On its hand the rewrite must be completed before it can replace the previous code. If it is not completed then the new code is [[dead code]] or [[unreachable code]] and is immediately subject to [[software rot]]. [[User:JnRouvignac|JnRouvignac]] ([[User talk:JnRouvignac|talk]]) 08:03, 24 November 2016 (UTC)
:I agree. Although, I think your definition of refactoring is just a bit too rigorous. In the real world, at least in my experience, people can sometimes make minor changes to the functionality while doing refactoring. So for example, if I find that I have some class, hexagon that is created all by itself and then I realize it should inherit from the shape class, I would consider that refactoring even though the behavior may change (e.g., by making hexagon a subclass of shape it may inherit new behaviors that weren't originally needed but now are). But thats just a quibble, in general I definitely agree rewriting or re-enginnering code is not the same as refactoring (I said similar things in an earlier thread). --[[User:MadScientistX11|MadScientistX11]] ([[User talk:MadScientistX11|talk]]) 16:27, 24 November 2016 (UTC)
 
I am against merging this document. The concept and term of refactoring come up in computer science education and literature quite often. Some schools even have entire courses dedicated to refactoring and improving code. I myself found this Wikipedia page when searching for a concise, elegant definition of refactoring. This is a very different concept than simply rewriting a program. When rewriting code, it is expected that the behavior will change. When refactoring code, it is expected that it will not. <!-- Template:Unsigned IP --><small class="autosigned">—&nbsp;Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/174.16.14.244|174.16.14.244]] ([[User talk:174.16.14.244#top|talk]]) 02:59, 12 March 2017 (UTC)</small> <!--Autosigned by SineBot-->
 
I oppose this merging too, and I agree with the previous comments by MadScientistX11 and "unsigned". Refactoring and rewriting are completely different things. To abuse a car analogy, it's the difference between fixing your car and buying a new one. [[User:Dserodio|Dserodio]] ([[User talk:Dserodio|talk]]) 22:25, 30 May 2017 (UTC)
 
{{Discussion bottom}}
 
== Motivation section: debt vs payment ==
 
The metaphor of technical debt is introduced, and then refactoring is cited as a payment of technical debt.
 
Is such a metaphor really helping the article? Doesn't this just say that fixing poorly-organized or poorly-planned code is better than not fixing it? (It doesn't take a genius to figure that out.) :)
I'm not sure why that part is kept. [[User:TooManyFingers|TooManyFingers]] ([[User talk:TooManyFingers|talk]]) 21:08, 8 July 2020 (UTC)
:Fixing poorly-organized or poorly-planned code comes with a cost and with the risk of introducing new errors. In a given business environment leaving such code as it is may be entirely reasonable at a given time. &ndash;&nbsp;[[User:Tea2min|Tea2min]] ([[User talk:Tea2min|talk]]) 07:52, 9 July 2020 (UTC)
 
== Messy change in History section ==
 
In the History section, I just removed the redundant "Griswold's Ph.D. thesis, ..." sentence. It was a very messy edit, since the contents of the refs were embedded in it, and had to be shuffled to the next sentence. The diff (changes) is a mess, but the end results are just the removal of the pesky sentence. [[User:BMJ-pdx|BMJ-pdx]] ([[User talk:BMJ-pdx|talk]]) 08:39, 12 May 2024 (UTC)