DEV Community

Discussion on: Should event handlers be named using business actions or UI events?

Collapse
 
mrdulin profile image
official_dulin • Edited

That's what exact I mean. UI event handler name should NOT be equal with the method name of the service layer. Event handlers should clearly represent elements and their events. Consider that there are multiple forms on the page, they all have submit event handlers. onFormASubmit and onFormBSubmit are clear. We should distinguish UI events and service method names. If this file has a 1000-line code, we don't have to scroll or copy the search, you can know which form of this is the submission event.

Collapse
 
janmpeterka profile image
Jan Peterka

If this file has 1000 lines, we should split the file :D