[Lazarus] Circular references

Lee Jenkins lee at datatrakpos.com
Fri Aug 14 15:36:06 CEST 2009


Graeme Geldenhuys wrote:
> Michael Van Canneyt wrote:
>>>
>>> Have ever tried to write code in a similar fashion as Java does?
>>
>> No, because I write object pascal, not Java.
> 
> OO design patterns & principles apply across programming languages. You 
> do not need to code in Java to use the same idea.
> 
> It's hard enough to implement well designed classes - and then having to 
> fight the compiler too. One class (eg: TCustomer & TCustomerList)  per 
> unit is a clean design and help make unit testing so much easier.
> 
> But then again, I have managed for so many years - what's a few more. ;-)
> 

I had to implement the State Pattern a while back and it was a pain because in 
order to avoid circular references, all the different state pattern objects had 
to be in the same unit.  That is of course if you want to refer to the new State 
object's class when transitioning.  Using a string to indicate which 
"registered" state to switch to would have allowed me to use different units but 
I didn't like that way of doing it.


--
Warm Regards,

Lee






More information about the Lazarus mailing list