Back

LL036

Form logic in event handler

Object Pascal — Delphi & Free Pascal
Warning
Design

Large event handlers couple business logic to the UI, hindering testability and reuse

large event handlers couple business logic to the UI, hindering testability and reuse.

Why this severity

large event handlers couple business logic to the UI, hindering testability and reuse.


Known false positives

small handler bodies that only delegate to a single well-named method.

Remediation example

procedure TForm1.btnSaveClick(Sender: TObject);
begin
  OrderService.SaveOrder(GetOrderFromUI);
end;

Reconnecting… Connection lost. Reload