[fpc-pascal] Visitor pattern (was: Weird interface behavior)

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Mon Jan 24 11:51:06 CET 2011



On Mon, 24 Jan 2011, Juha Manninen wrote:

> Michael Van Canneyt kirjoitti sunnuntai 23 tammikuu 2011 17:41:13:
>> On Sun, 23 Jan 2011, leledumbo wrote:
>>> WARNING: it won't be simple
>>>
>>> I'm using visitor pattern in my project and to the best of my knowledge,
>>> the visitor should be implemented as an interface.
>>
>> Why ?
>> tiOPF uses the visitor pattern extensively, and it is implemented as a
>> class.
>
> Is this visitor pattern something that I should care about?
> I have programmed quite much and never needed it.

You don't need to care about it. It's a pattern like any other.

>
> I found many Java examples from internet and they all were good examples of
> "over-engineering" IMO. A simple thing made complicated.
> Virtual methods or method references (kind of event handlers) solve those
> cases in a cleaner way.

Well, visitors have their uses, but I wouldn't overstate their usefulness.
Use the right tool for the job, I'd say. :-)

Michael.



More information about the fpc-pascal mailing list