On the dangers of automated refactoring

Curry Kenworthy curry at pair.com
Tue Apr 13 17:07:07 EDT 2021


Andre:

 > Often in LiveCode (and most programming languages to be honest)
 > we go coding for a long while and then realise that our code
 > need extensive refactoring. We may have repeated a pattern over
 > and over again and discovered that we need to change every
 > instance of them, or something similar.

Speaking to LC users as a whole rather than Andre in particular,
tools to help with smart refactoring are useful. It all helps.
But there's an even bigger danger than the one already described:

Relying on tech to substitute for good fundamental coding skills.
If a script needs many repeated changes to fix a single problem,
usually that's because the code was not well-organized and modular.

With good coding habits, you will excel with or without such tools.
And when used carefully, they can increase your productivity.
But if you have powerful tools with bad habits, you'll have trouble.

Look at the F-35 stealth fighter, for example. Used in many nations.
Agile coding is a key enabler in the project, but bugs are a problem.
They've had cost increases and delays. Efficient coding is crucial.
Whether jets or vaccines, many lives actually depend on computer code.

In other words, good coding habits are more important than ever.
Software will win or lose wars and determine health outcomes.
You may not be in those line of work, but good habits save headaches!

Well-designed code is a joy to maintain. One problem = one change.
Modular, so that we're not repeating the same code with tiny variations.
There will be cases where old code needs a revision, but much easier.

Bob:

 > We should have a contest: Who has the biggest code base.
 > Mine's pretty big, but I doubt it's the biggest. :-)

The biggest code is the most repetitive and least modular!
I've seen scripts that were long enough to overwhelm the SE,
yet performed fairly simple tasks. Could be 1/10 the code.

Good topic. Back to work....

Best wishes,

Curry Kenworthy

Custom Software Development
"Better Methods, Better Results"
LiveCode Training and Consulting
http://livecodeconsulting.com/





More information about the use-livecode mailing list