Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
'Agile series' in UT Mag - wrong on refactoring!
Message
 
 
À
13/07/2005 13:06:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01032029
Message ID:
01032476
Vues:
13
Hi, Jim.

>The article is basically saying 'if you see something you don't like you SHOULD (feel obligated to) change it'. This is what I take issue with.
>Something not to my liking but working is far more valuable than something I have to redevelop and test just to get it looking like I want. A wasteful effort for sure.

I'm sorry if you got this idea, but my articles doesn't say at any rate that you have to feel obligated, nor that you should change code to look like you like. What I say is that everytime you have to work over some code and you find it smelling bad, it is usually better to refactor it before starting to change it.

For example, you can find a really long method to the one you have to add more functionality. Maybe you don't really want to add to the already long method, but it is so tangled that it is difficult to add your funcionality in a clean way. Then, before changing anything, you write your tests, start doing Extract Method in different portions, little by little, and checking if the code keeps working fine, and then it is quite probable that you can quickly add your new logic to one of the shorter methods, or even better, add another method altoghether.

The same applies to many other smells like bloated classes, tighly coupled interfaces, long lists of parameters or data that goes back and forth everywhere in the same blocks, etc.

It is not something as "stylistic" as you think. Object Oriented Design and OO Programming are something quite evoluted over almost two decades now, and there are many well-established techniques that you can safely apply to enhance flexibility, self-expresiveness, and reuse that has little to do with styles. I didn't even reach to the topic of Refactoring to Patterns, where you can make your code even more easy to understand to someone familiat with Design Patterns, something that it is not unlikely to find these days anymore.

Of course, there are always grey areas and trying to apply Desing Patterns to EVERYTHING is also a bad smell in itself, but in general terms, you are much better if you are a bit Pattern-excesive than if you use no single technique.

Best regards,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform