Mark Sparshatt wrote: > --- "Keith P. Boruff" <kboruff / optonline.net> wrote: >> But.... if you think Ruby is impervious to needing >> any refactoring because >> it's less "verbose" than other languages, I would >> not agree. >> > > I don't think people are claiming that Ruby programs > never need to be refactored but rather that since > they're less verbose refactoring is easier, so that > you don't need the same heavyweight refactoring tools > that languages like C++ and Java require Actually, C++ is so verbose that to my knowledge, no one has been able to successfully create an automated refactoring tool for it. If someone knows otherwise and can provide a link, I'd appreciate it since I greatly need one. Refactoring is simply a process of changing the structure of your code without changing the way it behaves. When you do any refactoring, obviously, you have to do a regression test to make sure nothing has changed. As I'm sure you know, when you change code, you introduce the possibility of "bugging" your code. Why does one refactor? Basically to improve the design and make it more readable to humans. Tell me that you didn't write something in Ruby that you later changed because you thought the change would produce a better design. We all do it... we've all done it... in many languages. That's refactoring. Refactoring manually in any language can be a pain. It takes more time and you can introduce bugs. An automated refactoring tool (a good one) helps to alleviate those problems. For example, if you do an "extract method" refactor manually, you have to make sure you capture all the outlying variables that may be used in that new method. With an automated tool, you just highlight the code, the method is created, the locals are deleted from the old code, instered in the new, and that old code is replaced with a call to your new method. I think some of you here who are debating this issue with me are getting the idea of refactoring wrong. Don't think of it as a means to deal with a mechanism to deal with flawed programming languages but rather think of it as a software engineering mechanism that transcends programming languages. Would any of you guys seriously think about writing a big project without using source code revision control? Would Matz have attempted writing the Ruby interpreter without source code revision control? NO! This is a "best practice" s/w engineering mechanism that is independent of PLs. That's all I'm trying to say about refactoring. Finally, to successfully use refactoring, you have to include your classes in unit test harnesses to preserve behavior. Well, someone already wrote this test harness into the Ruby libs so someone must have been thinking about refactoring... for Ruby. I don't care what programming language you use, if you're writing a big program that many people had their hands on and have "hack-ins" from quick deadline pressures, you're going to have decaying or decayed code. Refactoring helps to minimize that decay. KPB