> Hi Khurram
>
> > You are telling about public memory variables are also not a good choice for new one then the persons who swithed from FPD26 to VFP9 what they do ?
> > What is the alternative of public memory variables ?
>
> An afterthought! This Forum is a good example of an Object Oriented Environment and illustrates the difference between OOP and Procedural Programming very nicely. Think about it...
>
> You have a question. You also know that
someone knows the answer but you don't know who. How can you find the answer to your question?
>
> Well, first you could decide who YOU think might know the answer, and ask them directly. This is the 'procedural' approach and suffers because you don't really know who to ask first, and you can't ask someone else until the first person has answered. So you have to compile a list, then work through it until maybe you get lucky - after all there is no guarantee that any person who knows your answer is on your list!
>
> A better solution is to post a question on this forum. The difference is that now you are shifting the responsibility from yourself to anyone who reads your message. If the reader knows the answer, they can reply - not only do you not have to know WHO to ask, you may even get several replies and maybe even from a person who you would never have thought to ask at all.
>
> This is what, in OOP is called the "Broadcast" approach. Each reader (object) either responds to the question (the request) or doesn't. You do not need to know, or care, which reader (object) will respond - providing that you get the right answer (result)!
>
> A good example of a VFP Broadcast is the "ThisForm.Refresh()" call. This does not refresh each object on a form. What it does is tell each object to Refresh itself! The difference is subtle, but crucial. In accordance with the rules of OOP and encapsulation, the form must not mess with the internal working of any other object, so instead it calls on the object and tells it WHAT it wants the object to do, but not HOW to do it.
>
> Now where does the public variable fit into all this? Well that is where, in the procedural world you would have to store each person's answer so that the next person asked could see it. In the OOP world, you see all the answers (each responder posts their own ) and you only need a LOCAL variable (you) to store the answer.
>
> Does that make things better, or worse ?
>
> Regards
> Andy Kramek
> Microsoft MVP (Visual FoxPro)
>
Tightline Computers Inc, Akron Ohio, USAGood analogy - my rating to you.
I am not sure that for a newbie to OOP it would make a great deal of sense, but to someone with a cursory understanding, it is a great analogy.
Ken
You shall know the truth - and the truth shall set you free. (John 8:33)