>Hi
>This isn't a problem. Rather, it's just a discussion of something I'm curious about VFP.
>
>As c# developers know, we can't write a method/procedure/function in c# outside of a class.
>But in VFP you can.
>
>So, I have a co-worker who saw my VFP code that wasn't rapped in a class. He asked why?
>I'm new to VFP, so I just said "because you can in VFP".
>;-)
It is a matter of preference, but I myself do 99% in classes, and only exceptions in procedures for the following reasons:
- Classes and objects are more readable for developers coming from C# and Java.
- Many good resources (for instance about design Patterns) use classes for their examples
- The VFP Project Manager displays all classes under a classlibrary and you can write a description for each class separately, while the prg file cannot be expanded.
- An instantiated class has a state, that means you can store relevant Information in properties. In a function call you can have one return value, unless you return an object, but for that you will need a class. Or you use private variables, but that will cause you sleepless nights.
- Using classes you can take full advantage of IntelliSense, you can list all available methods with their descriptions, and review its properties.
etc
A good example for a prg in my code is GenerateGuid(). I do not want to instantiate a class each time I need a GUID and there is no static class in VFP.
Christian Isberner
Software Consultant