Advantages of refactoring
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Advantages of refactoring
However crude my method of refactoring with my Devawriter Pro might be
[it largely consists] of shunting shared socking great Switch statements out of individual buttons
into a function in a cardScript]
having only completed about 2% of my projected refactor my stack has shrunk from 120MB to 118MB.
At the risk of sounding incredibly naive, I had no idea that even that small amount of work
could result in a quite significant gain.
I envisage reducing the stack size to less than 50MB.
----
An added advantage of this refactor is that I get to look at some code that is as old as 9 years,
see how goofy it is, and redo it in a less goofy way.
[it largely consists] of shunting shared socking great Switch statements out of individual buttons
into a function in a cardScript]
having only completed about 2% of my projected refactor my stack has shrunk from 120MB to 118MB.
At the risk of sounding incredibly naive, I had no idea that even that small amount of work
could result in a quite significant gain.
I envisage reducing the stack size to less than 50MB.
----
An added advantage of this refactor is that I get to look at some code that is as old as 9 years,
see how goofy it is, and redo it in a less goofy way.
Re: Advantages of refactoring
Certainly sounds like your heading in the right direction and cleaning out the cruft as it were.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Advantages of refactoring
I'm not sure if 'cruft' is the right term,
after all, my code worked . . . albeit rather inefficiently,
but, certainly, I am having to face some of my past sins, insofar as what looked good in 2010
looks like a load of clunky stuff in 2019 . . .
How much of that is due to the fact that I have learnt a bit more about LiveCode in those 9 years,
and how much is just that, after 9 years, I can look at old code rather more critically, I don't know.
after all, my code worked . . . albeit rather inefficiently,
but, certainly, I am having to face some of my past sins, insofar as what looked good in 2010
looks like a load of clunky stuff in 2019 . . .
How much of that is due to the fact that I have learnt a bit more about LiveCode in those 9 years,
and how much is just that, after 9 years, I can look at old code rather more critically, I don't know.
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Advantages of refactoring
I hoard code. Storage is cheap - why not? But I have to admit, I find very little I've written five years ago that can't benefit from rewrite, and almost nothing from ten years ago. Technology changes all the time, and our minds along with it.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Advantages of refactoring
As far as I can tell, that is the exact definition of 'cruft'richmond62 wrote: ↑Wed Mar 13, 2019 3:45 pmI'm not sure if 'cruft' is the right term,
after all, my code worked . . . albeit rather inefficiently,
cruft
n. Anything old or of inferior quality. (Your new code is superior to the old code.)
n. Redundant, old or improperly written code, especially that which accumulates over time; clutter. (Your new code is less clunky, and you have found ways of optimizing it that you either didn't know previously or have thought out more efficient ways to write it to achieve the same objective.)
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Advantages of refactoring
As I am "refactoring": and those quotation marks are there because by that I find that I actually
mean refactoring, tweaking some 'dicky' code and ironing out bugs that pop out at inconvenient
moments during the process: I save each significant 'move' in a new folder:
- -
This means if I get something wrong along the way I can move back a single step rather
than have to re-do 5-6 hours work.
mean refactoring, tweaking some 'dicky' code and ironing out bugs that pop out at inconvenient
moments during the process: I save each significant 'move' in a new folder:
- -
This means if I get something wrong along the way I can move back a single step rather
than have to re-do 5-6 hours work.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Advantages of refactoring
I have got in the habit of labelling changes and/or additions to code so I can have a vague idea
of what I was playing at in the future:
-
of what I was playing at in the future:
-