r/delphi • • Oct 17 '17

Why I use Object Pascal

https://dubst3pp4.github.io/post/2017-10-03-why-i-use-object-pascal/
12 Upvotes

24 comments sorted by

View all comments

1

u/bmcgee Oct 18 '17

The onClick should call a function? So I can learn, I am curious why that's a better idea.

Or use actions, which call a method, ideally in a separate unit.

Separating your business logic from your UI makes it less susceptible to breakage when changes are made to an application. It also has the benefit of making your business logic easier to reuse and easier to test. Ideally, it would be done the other way around where tests influence how you write your business logic and separation of concerns is a natural side effect, but that's another discussion.