Walter Meester
HoogkarspelPays-Bas
Versions des environnements
Hi Jim,
Well I think there are good and bad sides to refactoring.
Of course you're absolutely right that you should not rewrite every method function you come to see where the 'polution' or inflexibility is minor or even moderate (in complex cases).
There are factors involved like:
- Readability
- Flexibility
- Complexity
- Frequency of use
- Defense against unrecoverable error messages
However, If I get the slightest hint that rewriting the function will be better in the long run (see arguments above) I'll not hesitate to rewrite it. Essentially this is the only way you're able to write a decent framework for your application.
The dangerous thing of course, and you're absolutely right in that, is that in the revision you might not oversee all possible states in which the method or function is used and indeed writing a function that not always the same output as the original.
OTOH, if the above happens, it shows that the function was poorly written as the code should outline all possible states.
But in the end we are all humans and make mistakes. I really depends on the programmer and their skills. Unfortunately often these design paterns and methodologies assume you're are well educated , all knowing, brilliant programmer with an IQ well over 140, who never make mistakes. In the real world thing might be way different. Sometimes it is better to hold on to "If it ain't broke, don't fix it..."
Walter,
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement