Some thoughts on duck typing
th.douez at sunnyrevtalk.com
Mon Jan 17 04:19:55 CST 2011
Le 13 janv. 2011 à 17:02, Richard Gaskin a écrit :
> How did you do that for any objects other than images?
Well, it's a big topic. :)
First, I used this approach in all my *industrial* projects,
as BioArchimed for instance - can see it on my web pages.
For the sake of the story,
I had to do that to be able to win some contracts.
( software quality and version control needed )
and being a proponent of OOP and MVC,
this should be put into perspective too, as I guess
it avoids part of the ids syndrome.
The main idea is to make a proxy of the LC project
organized in a data tree, which contains my own object's definition.
Then build a new version of a stack by processing this tree,
roughly as a preprocessor like we have in C, with #include, #define pragmas.
plus obviously some organisation for the project which makes all the difference.
As another example, in my external rev2perl,
where Perl can deal with any LiveCode's objects in real time,
it's more or less the same concept : a Proxy designed as a tree.
And last, from year to year working with
Hypercard, Director, Metacard and Livecode,
I have organized my work in such a way that
I'm very rarely stuck with this IDs syndrome...
Just because you can do something doesn't mean you should,
and it certainly doesn't mean it's appropriate to do it all the time.
That said, I'm using a subset of LiveCode, and again, maybe I've never passed
through some pitfalls that others could have experienced because of .... ?
Factory Design Pattern is my friend !
Go and Meet the Gang of 4 :)
More information about the use-livecode