Refactoring
Geoff Canyon
gcanyon at gmail.com
Thu Jan 29 12:29:15 EST 2015
Small thing, but I just turned this twelve-year-old code:
put "Double-Click:" into tProperty
if the optionKey is "down" then
if the commandKey is "down" then
put "Option-Command-Double-Click:" into tProperty
else
put "Option-Double-Click:" into tProperty
end if
else if the commandKey is "down" then
put "Command-Double-Click:" into tProperty
end if
into this:
put "Double-Click:" into tProperty
if the commandKey is "down" then put "Command-" before tProperty
if the optionKey is "down" then put "Option-" before tProperty
I love turning ten lines of code into three lines of code. I hope twelve
years from now I can look back at those three lines with the same degree of
horror I feel now looking at the ten-line implementation.
More information about the use-livecode
mailing list