Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complex objects modeling
Message
From
31/10/2018 11:32:47
 
 
To
31/10/2018 04:59:16
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
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:
01662990
Views:
65
Steven Black's was toooooo ahead .. he introduced the decorator pattern back in 1996! -thanks Internet-

but I confess that I just continued on from Lauren Clarke's "Decorating for the Busy Developer" work:

( https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/ms965308(v%3dmsdn.10) )

wich was great, but requiered to create a new object every time you wanted to decorate an existing one.

The need is the mother of invention, and as I found myself working every day more and more with value objects ,

I knew this needed a better way. ( I also used a ".net expandobject like" class )

This technique allows to refactor in many ways how we write code in VFP, take for example:
( from "Event binding And loose coupling : https://docs.microsoft.com/en-us/previous-versions/visualstudio/FoxPro/ms965450(v%3dmsdn.10) "   )


Define Class datacommands As ContainerProcedure 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
maybe thats' why we don't use bindevents as much as we 'd like to.

So I'd rather prefer:
       With bindeventsFor( This )

		.btnedit.interactiveChange  = "setEdit, 2"
		.btnedit.programmaticChange = "setEdit, 2"

		.btnundo = "Undo"
		.btnsave = "Save"

	Endwith
VFP can be new again!
@nfoxdev
github.com/nfoxdev
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform