Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complex objects modeling
Message
From
31/10/2018 18:05:24
 
 
To
31/10/2018 11:32:47
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Miscellaneous
Thread ID:
01662805
Message ID:
01663008
Views:
63
>Steven Black's was toooooo ahead .. he introduced the decorator pattern back in 1996! -thanks Internet-

I remember his session - also remember skipping Dinner while coding this pattern, realizing that each level of wrap added another method to be filled with a redirection or a method search via this_access... mixins using prototypal inheritance directly have clear runtime benfits, which you will not encounter while editing, but if depending on such features rolled out...

;-)

...
>
>( from "Event binding And loose coupling : https://docs.microsoft.com/en-us/previous-versions/visualstudio/FoxPro/ms965450(v%3dmsdn.10) "   )
>
>
>Define Class datacommands As Container
>	…
>	Procedure bindevents
>*!* Instead of button's click() calling a
>*!* method in the parent container. Simply
>*!* use the edit button's own event to trigger
>*!* the parent to some action.
>
>	Bindevent(This.btnedit,"InteractiveChange",;
>		THIS,"SetEdit",2)
>	Bindevent(This.btnedit,"ProgrammaticChange",;
>		THIS,"SetEdit",2)
>	Bindevent(This.btnundo,"Click",This,"Undo",2)
>	Bindevent(This.btnsave,"Click",This,"Save",2)
>	Endproc
>
>
>
>and maybe thats' why we don't use bindevents as much as we 'd like to.
>
>Would'nt you prefer:
>
>
>
>       With bindeventsFor( This )
>
>		.btnedit.interactiveChange  = "setEdit, 2"
>		.btnedit.programmaticChange = "setEdit, 2"
>
>		.btnundo = "Undo"
>		.btnsave = "Save"
>
>	Endwith
>
>
>
Second solution too much "hidden magic" for my taste. 2 approaches more to my liking are:

predefined buttons wiring default clickaction to method in .Parent if it exists there, walk parentcontainership or try for thisform.
having properties speccing all parameters, sometimes intermingled with numeric values to define containership level or thisform if negative.

Yupp, realize this goes against onion principle (esp. jumping levels!) but containership is so central to vfp object modeling I allow myself an exception ;-))

Also I do believe climbing level by levelmight be compared to exception forwarding/climbing levels for unchecked exceptions if following "unnamed" Parent-links ;-)

I know, excuses, excuses ;-))

have fun

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform