>Hi All.
>Is there a good tutorial on how to implement a MVC pattern for VFP?
>Or is there a MVC model for VFP?
>
>I just took over a legacy code and I'm really new to foxpro.
>
>Thanks in advance.
Hi Sandy,
in xBase (of which VFP is an example), a record of a table IS an object, and the field is an attribute of that object. It gets directly attached (as a controlsource) to a control. There is no impedance mismatch
http://haacked.com/archive/2004/06/15/impedance-mismatch.aspx/ between data and object. That's why there are no MVC's in VFP: the MVC pattern (and associated ORM patterns) exists because Data got bolted onto languages, rather than being a first-class citizen. It's a different (and to many of us, a most useful) way of thinking about and working with data. That doesn't mean we don't use metadata: the various VFP frameworks all have various ways of using more, or less, metadata to inform the use of data. It does mean we have a separation of concerns.
That's also why VFP doesn't need something like LINQ for use in munging data: a SELECT does the work directly, using familiar SQL syntax, although a lot of work is made quicker in certain instances by indexing the cursors and setting relations, etc..
Getting my head around this back in 1986 when I picked up dBMan, an early xBase product, I remember my confusion (having previously worked with data in UCSD Pascal and FORTH): "how do I get the value of a field in a record?" I think I remember contacting their support (there being no internet back then) and when told the answer being embarrassed and delighted. :)
hth,
Hank