Refactoring...
-
:eek: Ok, everyone lay of me and flame this guy. :) Tim Smith I'm going to patent thought. I have yet to see any prior art.
he he he. I like it in the kitchen! Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus -
Tim Smith wrote: then it is like painting a cancer growth red to make it look like normal tissue. Good analogy. So to continue it, refactoring is the process of cutting it out and (ok, you can't do this with cancer) replacing it with something better. But it seems that this particular tool doesn't do much more than cosmetic stuff so in this particular case, you're right. But I still strongly believe that refactoring is a Good Thing and therefore tools that help with that process are also Good Things.
I'd wear a miniskirt and pimp myself for an extra ten grand a year. - David Wulff
Awasu[^]: A free RSS reader with support for Code Project.I would nearly bet that I would support manual or semi-automated refactoring. You would learn what the code does as you make deeper cuts into unwinding that nasty cancer. But in general, I feel that refactory should only come into play when things have already gone wrong. I don't see it being a standard day-to-day process. In "theory" properly done code shouldn't need refactoring. Of course, we all know that it will happen even to the best of us. Tim Smith I'm going to patent thought. I have yet to see any prior art.
-
I would nearly bet that I would support manual or semi-automated refactoring. You would learn what the code does as you make deeper cuts into unwinding that nasty cancer. But in general, I feel that refactory should only come into play when things have already gone wrong. I don't see it being a standard day-to-day process. In "theory" properly done code shouldn't need refactoring. Of course, we all know that it will happen even to the best of us. Tim Smith I'm going to patent thought. I have yet to see any prior art.
Tim Smith wrote: I feel that refactory should only come into play when things have already gone wrong. OK, here I totally disagree. It depends on what you mean by "gone wrong". Refactoring is not merely a process by which we try to fix crap code. Developers often (always?) don't fully understand the issues involved when writing a new piece of code, not because they haven't done enough up-front analysis or because they're dumb but because that's the nature of our work. We've all had times when we didn't realise that something in the design was wrong until we sat down and tried to implement it. This is Fred Brooks' "build one to throw away" idea. Part of refactoring is the process of going back and updating code that we have already written to be better, in light of the new knowledge we have gained of the problem. Tim Smith wrote: In "theory" properly done code shouldn't need refactoring. This assumes that we live in an un-changing world. Even if the code we write is perfect now, in a year's time, the customer may have asked for a bunch of new features, legal requirements may have changed, etc. The assumptions we were working under a year ago may not hold true today and so the solution we came up with a year ago may not be the best one today. So again, refactoring is the process of going back and updating that code to once again be perfect :-) Tim Smith wrote: I don't see it being a standard day-to-day process. Maybe not day-to-day but definitely on-going (week-to-week?). This is routine maintenance work. We all put oil in our cars and check the tyres on a regular basis, right, to keep it in good working condition (well, we're *supposed* to)? This is the same thing. Most people would define maintenance work as being fixing bugs, minor enhancements, the kind of stuff you give to the new kid just out of school :-) I would also include refactoring, the process of taking code that already works and making it work better.
I'd wear a miniskirt and pimp myself for an extra ten grand a year. - David Wulff
Awasu[^]: A free RSS reader with support for Code Project. -
Tim Smith wrote: By actually programming and not using 1000 mind numbed tools that try to hide the realities of programming from Do you use Visual Studio? There are a lot of people who reckon that it's a "mind numbed tool" and prefer Vi or emacs. I've heard this argument x times before. If it was really taken seriously, no one would be programming high level languages, we'd all still be flipping switches, or punching cards. Tim Smith wrote: because some bozo who can't program decided that it just wasn't "safe" to allow you to program properly. Isn't that part of what a compiler does? It checks your code to make sure you are programming properly. So whats wrong with another tool that makes it easier to program? Tim Smith wrote: Nothing replaces experience. Agreed. But why shouldnt I use a tool that safely allows me to automatically rename a variable throughout a program instead of sifting through a thousand lines of code? Why shouldnt I be able to automate the repetitive tasks in programming using a tool? Cheers The universe is driven by the complex interaction between three ingredients: matter, energy, and enlightened self-interest.
Mr Morden wrote: Do you use Visual Studio? There are a lot of people who reckon that it's a "mind numbed tool" and prefer Vi or emacs. Visual Studio is an IDE that doesnt hide anything from you, it simply makes the code more visible and adds a few editing features. Except for the initial app wizards and the class wizards it will not write the code for you, and even then those tools are not all that great. Mr Morden wrote: Isn't that part of what a compiler does? It checks your code to make sure you are programming properly The compiler only checks semantics, it does not verify your logic. That is where the competent programmer is required. Mr Morden wrote: Why shouldnt I be able to automate the repetitive tasks in programming using a tool? You should be able to as long as it does not change the logic. A program that rearranges your logic is dangerous.
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life! -
Tim Smith wrote: I feel that refactory should only come into play when things have already gone wrong. OK, here I totally disagree. It depends on what you mean by "gone wrong". Refactoring is not merely a process by which we try to fix crap code. Developers often (always?) don't fully understand the issues involved when writing a new piece of code, not because they haven't done enough up-front analysis or because they're dumb but because that's the nature of our work. We've all had times when we didn't realise that something in the design was wrong until we sat down and tried to implement it. This is Fred Brooks' "build one to throw away" idea. Part of refactoring is the process of going back and updating code that we have already written to be better, in light of the new knowledge we have gained of the problem. Tim Smith wrote: In "theory" properly done code shouldn't need refactoring. This assumes that we live in an un-changing world. Even if the code we write is perfect now, in a year's time, the customer may have asked for a bunch of new features, legal requirements may have changed, etc. The assumptions we were working under a year ago may not hold true today and so the solution we came up with a year ago may not be the best one today. So again, refactoring is the process of going back and updating that code to once again be perfect :-) Tim Smith wrote: I don't see it being a standard day-to-day process. Maybe not day-to-day but definitely on-going (week-to-week?). This is routine maintenance work. We all put oil in our cars and check the tyres on a regular basis, right, to keep it in good working condition (well, we're *supposed* to)? This is the same thing. Most people would define maintenance work as being fixing bugs, minor enhancements, the kind of stuff you give to the new kid just out of school :-) I would also include refactoring, the process of taking code that already works and making it work better.
I'd wear a miniskirt and pimp myself for an extra ten grand a year. - David Wulff
Awasu[^]: A free RSS reader with support for Code Project.At this point, refactoring becomes a very ambiguous term that encompasses all forms of code modification. The meaning is so watered down that it can be said that I have been doing refactoring for 20+ years. This just reinforces my opinion that refactoring is just another buzzword for processes people have been doing for years. The write once, burn the code and then do it again is a process I have been preaching for years. Flexible code design that can morph to meet new needs is also a process I have used since I got out of school. These are all processes good shops have been doing for years. Maybe I lead a sheltered life and have been hugely lucky and have only been in top quality shops. Lets just say I hope that isn't true. Tim Smith I'm going to patent thought. I have yet to see any prior art.
-
At this point, refactoring becomes a very ambiguous term that encompasses all forms of code modification. The meaning is so watered down that it can be said that I have been doing refactoring for 20+ years. This just reinforces my opinion that refactoring is just another buzzword for processes people have been doing for years. The write once, burn the code and then do it again is a process I have been preaching for years. Flexible code design that can morph to meet new needs is also a process I have used since I got out of school. These are all processes good shops have been doing for years. Maybe I lead a sheltered life and have been hugely lucky and have only been in top quality shops. Lets just say I hope that isn't true. Tim Smith I'm going to patent thought. I have yet to see any prior art.
Tim Smith wrote: refactoring is just another buzzword for processes people have been doing for years. If you have been making changes to your code with automated regression testing to ensure that you haven't broken anything in the process, then yes, you have. But I have yet to work at a place, or even know anyone who has worked at a place, that does such a thing (except my last job where I put it in place :-)) This is the key to refactoring. "Write once, burn the code, do it again" can be done in any number of ways from "proper", incremental refactoring to literally throwing it out and starting over. Which, btw, is also refactoring as long as you have the automated testing in place. Tim Smith wrote: Flexible code design that can morph to meet new needs is also a process Ah, but how do you achieve this? This is what a lot of this discussion is about - how to perform the process of developing applications better. OK, some of it (a lot of it?) is total crap and marketing hype but some of it is good as well. And the ideas behind refactoring are good ones, IMO. Tim Smith wrote: Lets just say I hope that isn't true. Have to disagree with you again. I think you've been very lucky.
I'd wear a miniskirt and pimp myself for an extra ten grand a year. - David Wulff
Awasu[^]: A free RSS reader with support for Code Project. -
safely allows me to automatically rename a variable Does it really? Would you not still test the new changes? Wouldn't you still do a desk check to make sure it hasn't screwed up your code? So really, what has it saved you? Of course, if you aren't going to test the changes or visually verify that the tool hasn't hacked up your code, then just use a global file replace. It is just as safe. FYI: I use VC7 :P But I don't use the class factory because it made me less productive. I don't see the logic in using the new fad tools when I end up being less productive. Tim Smith I'm going to patent thought. I have yet to see any prior art.
Tim Smith wrote: Does it really? Would you not still test the new changes? Wouldn't you still do a desk check to make sure it hasn't screwed up your code? Of course I would. Just as I would test code that I had written using any other method. And I wouldnt recommend not doing so. Tim Smith wrote: So really, what has it saved you? Time. Which of course is money. Tim Smith wrote: Of course, if you aren't going to test the changes or visually verify that the tool hasn't hacked up your code, then just use a global file replace. It is just as safe. Yeah, but using a tool ensures that only what i want to change is changed. Cheers The universe is driven by the complex interaction between three ingredients: matter, energy, and enlightened self-interest.
-
Then tell me what grand thing this tool does that actually IMPROVES the code? What does it do? Ooo it creates new routines. What about the documentation for those routines? You do actually document your code, don't you? Maybe that is why you need tools like this because you lack the self control to actually do it right to start with. You would rather waste money on salary and tools AFTER the fact. Silly if you ask me. It also renames silly variables. Why in the **** do you have silly names to begin with? Why not name them properly from the start? Everything this program tries to "correct" are all BAD PROGRAMMING practices. Chances are, if you really need to use this tool, then your software has more significant problems than just this. Like I said, garbage in, garbage out. Nothing replaces doing it right from the start. It costs more money to come in after the fact and clean up the mess. Tim Smith I'm going to patent thought. I have yet to see any prior art.
Why dont you try and learn something and find out a bit about these things yourself? Tim Smith wrote: Ooo it creates new routines. What about the documentation for those routines? You do actually document your code, don't you? Maybe that is why you need tools like this because you lack the self control to actually do it right to start with. You would rather waste money on salary and tools AFTER the fact. Silly if you ask me. Refactoring tools don't advocate the senseless and mindless automation of coding. They're not robots that are going to take your job. They are designed to *ASSIST* a programmer to make changes to his code that would normally be tedious steps and take precious time. It doesnt happen often, but sometimes I need to change the name of a class. This can be a real pain in the backside with VS. Change the name, but there's no rename feature in VS, so I have to delete the files, manually rename them, then re-add them. Then I have to go and change where the class is used in code. What a nonsense! Why shouldn't a tool make it easier? If I could just select a class name and rename it when I need to, and have it do everything I need. Oh, what a joy that would be! Tim Smith wrote: Everything this program tries to "correct" are all BAD PROGRAMMING practices. Chances are, if you really need to use this tool, then your software has more significant problems than just this. So you've never had to rename a class or variable that you've ill-chosen a name for? Mistakes are not bad programming practice, they are human programming practice, they happen. Have you never made a simple human mistake when coding? So why should you be penalised (late delivery, overtime, aggro boss) for a simple mistake if there is a tool that can help you fix it? Cheers The universe is driven by the complex interaction between three ingredients: matter, energy, and enlightened self-interest.
-
Mr Morden wrote: Do you use Visual Studio? There are a lot of people who reckon that it's a "mind numbed tool" and prefer Vi or emacs. Visual Studio is an IDE that doesnt hide anything from you, it simply makes the code more visible and adds a few editing features. Except for the initial app wizards and the class wizards it will not write the code for you, and even then those tools are not all that great. Mr Morden wrote: Isn't that part of what a compiler does? It checks your code to make sure you are programming properly The compiler only checks semantics, it does not verify your logic. That is where the competent programmer is required. Mr Morden wrote: Why shouldnt I be able to automate the repetitive tasks in programming using a tool? You should be able to as long as it does not change the logic. A program that rearranges your logic is dangerous.
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!Paul Watt wrote: Visual Studio is an IDE that doesnt hide anything from you, it simply makes the code more visible and adds a few editing features. Except for the initial app wizards and the class wizards it will not write the code for you, and even then those tools are not all that great. Neither will a refactoring tool. I started out in the industry using a line editing program on a Honeywell computer. (In fact my first major program was on punch cards for a Cyber.) How many orders of magnitude better is the VS IDE? I wouldn't want to give up my VS to go back to the old editor. Why stop there? Why not have tools that make it easier to program? Paul Watt wrote: The compiler only checks semantics, it does not verify your logic. That is where the competent programmer is required. The point is that the compiler saves the programmer from making mistakes that could be made using assember. The Assembler saves the programmer from making mistakes that could be made by directly entering the bits into memory. The refactoring tool doesnt stop the programmer from making mistakes. Its value is in assisting the programmer to recover from them. Cheers The universe is driven by the complex interaction between three ingredients: matter, energy, and enlightened self-interest.
-
After looking at their examples, I would say they have succeeded in extreme simplicity. Extreme simplicity = useless What garbage. Everything is done manually, and it's nothing more than glorified cut&paste and search&replace functions. The darn thing can't even automatically extract loop elements and create functions. That might be marginally useful. "Rename Local Variable". Oh, please. If these examples are the "best" of their product, well... enough said. Taka (see post above yours) has some kind words for refactoring and a fellow by the name of Martin Fowler. Ask Taka for an explanation. I can't give you an unbiased one. On a totally different topic--how's the weather in SD? We just got socked with 8 inches of snow in Rhode Island. Too bad it fell in the afternoon and evening. It would have been a great excuse to cancel school and not go in to work! Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian GrausMarc Clifton wrote: What garbage. Everything is done manually, and it's nothing more than glorified cut&paste and search&replace functions. The darn thing can't even automatically extract loop elements and create functions. That might be marginally useful. "Rename Local Variable". Oh, please. If these examples are the "best" of their product, well... enough said. They lost too much time documenting code and with methodologies (UML, eXtreme Programming). The analysis phase said almost 100% of the users: 1. Use search&replace 2. Use copy&paste 3. Would like a better search&replace and copy&paste The other features have been "refactored" and were eliminated in the design phase, because they produce so high quality software that they never needed it. :) I see dumb people
-
Marc Clifton wrote: What garbage. Everything is done manually, and it's nothing more than glorified cut&paste and search&replace functions. The darn thing can't even automatically extract loop elements and create functions. That might be marginally useful. "Rename Local Variable". Oh, please. If these examples are the "best" of their product, well... enough said. They lost too much time documenting code and with methodologies (UML, eXtreme Programming). The analysis phase said almost 100% of the users: 1. Use search&replace 2. Use copy&paste 3. Would like a better search&replace and copy&paste The other features have been "refactored" and were eliminated in the design phase, because they produce so high quality software that they never needed it. :) I see dumb people
The other features have been "refactored" and were eliminated in the design phase, because they produce so high quality software that they never needed it. :laugh::laugh::laugh: Extreme simplicity = useless! Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus