반응형

on 으로 시작하는 메서드

 on____ 메서드는 어떤 발생에 의해 트리거 되는 메서드이다. 그것은 함수 컨벤션 중 하나이다. 그것이 어떻게 트리거되는 지는 implementation detail (구현 세부사항) 이다. 그 이름이 의미는 아래의 설계를 말한다.

 "이것은 ____ 후에 트리거됩니다.", 구현 세부사항이 아니다.

 

 접두사 on는 주로 callback 메서드로 사용할 때 쓴다. 어떤 이벤트가 발생하면 호출되는 함수를 콜백메서드라고 한다. 그때 on을 주로 쓴다.

 

출처

https://softwareengineering.stackexchange.com/questions/381423/using-on-at-the-start-of-a-method-name

 

Using "On" at the start of a method name

From what I've observed, methods that start with the word "On" fall into two categories: A base class that defines an event will expose a protected method whose name starts with "On" followed by ...

softwareengineering.stackexchange.com

 

 

 

반응형

'코딩 규칙' 카테고리의 다른 글

Code complete 12장. 기본 데이터형  (0) 2022.07.28
함수 네이밍 컨벤션 (Naming Method)  (0) 2021.07.07
커밋 컨벤션 관련  (0) 2021.07.06
코딩 컨벤션 관련  (0) 2021.07.06
Git Flow 관련  (0) 2021.07.06