menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Data Science News

>

To return ...
source image

Medium

4w

read

384

img
dot

Image Credit: Medium

To return (early), not to return (early)

  • The Return Early coding approach encourages developers to handle function exits early by returning results or throwing errors/exceptions as soon as possible.
  • This technique is derived from the "Fail fast" concept, aiming to quickly identify and address any reasons for failure within the system.
  • Return Early method conflicts with the Single Point of Entry/Single Point of Exit (SESE) approach, which suggests having only one return point at the end of a function.
  • Choosing between the Return Early and SESE approaches depends on the context, with a recommendation to combine both based on the requirements, such as using SESE for business logic and Return Early for other aspects.

Read Full Article

like

23 Likes

For uninterrupted reading, download the app