[fpc-devel] Circular references and forward declarations

Marco van de Voort marcov at stack.nl
Wed Jan 6 11:44:11 CET 2010


In our previous episode, Michael Van Canneyt said:
> >> projects end up copying everything into one file. Surprising... :-)
> >
> > I never do this, there is no need. Probably similar to the fact that 90% of
> > the Delphi programs have all important code in event handlers of the GUI
> > components. That still doesn't make a good thing.
> 
> Glad you give this example. I try for years to convince my fellow
> programmers that an event handler should contain at most 1 or 2 lines of
> code: a call to a routine that does the actual work, and maybe some status
> updating... But old habits die hard :-)

I'm not that strict. It may have more code but then that code must interact
with the GUI, usually to tie together various GUI components so that they
become a complete abstraction.

Example: a listbox, its repaint/fill events and the buttons that
add/remove/edit etc make a "list of classes edit" together. But for anything
more complicated than setting a field in the business code they must call
other code.

This is a deliberate violation of the presentation layer idea, that routs
nearly every event over controller code. The reason is that while those kind
of principles map perfectly to webapps, the principle makes GUI apps more
complicated without really getting anything back IMHO



More information about the fpc-devel mailing list