[Lazarus] fpGUI

Marcos Douglas md at delfire.net
Mon Jan 17 15:53:51 CET 2011


2011/1/17  <michael.vancanneyt at wisa.be>:
> I don't have to. But 80% of the functionality returns.
> This 80% is taken care of. The rest is business logic.

Business logic in the Form class?

> Totally wrong approach.
>
> You create a form Save() method, NOT virtual, and add a OnSave event. That
> is the RAD way. If you add hooks in the right places, there is no need for
> endless descendants. We have 2 forms:

Okay, the RAD way is create Save() method and OnSave event, to
configurations of child Forms...
These are beautiful and organized names... but is the same what I said, no?

> TAppForm
> TDBAppForm (DB-Aware)
>
> That's it. 95% of all forms descend from TDBappform. The rest descends from
> TAppForm.

Never happen to you have a child form (inherited of TDBAppForm) but
with special features such that it did not fit well with the routines
of TDBAppForm? So what did you do? Maybe you skipped some TDBAppForm's
methods having to implement them again, otherwise, only for this
particular Form, no?

> That depends on your definition of big.
>
> The form class together with all it's 8 auxiliary classes takes 2300 lines.
> I don't think this is big.

Well... 2300 is not so big.

> And you make a common mistake: you try to do everything in OOP in the parent
> class.

Just when I use OOP.
I have Forms RAD and Forms OOP (but just in Delphi... in FPC, I'm a
newbie for now).

> What is more, if now we need a new functionality in all our forms,
> I introduce it in the form class, and all our forms now automagically have
> this functionality. This has happened numerous times in our application.
>
> If your application has only 20 forms, all this is not worth it.
>
> But when I started, I knew that there would be lots of forms, and an
> application that would evolve over 10 years.
> I did as I described here, and this has saved us huge amounts of time. The
> whole team and management here agree on that.
> (one of the few things management and developers agree on ;-) )

I believe, sure. But my point is that can be done with code/classes
without RAD approach too.

Marcos Douglas




More information about the Lazarus mailing list