Micro-pattern: IIFE and Return-Early

What are those and how can we utilize them?

Rakha Kanz Kautsar
Mar 8 · 3 min read
Photo by Omar Flores on Unsplash

Immediately Invoked Function Expression (IIFE)

If you came from JavaScript background you will most likely have encountered this pattern. Remember JQuery?

IIFE is a function that is declared then immediately executed

Return-early pattern

Sometimes we have to give up before it costs us.

Conclusion

So that’s it, these two are the micro-patterns that I find are used pretty often, not only by me but also by others. Oh and these two are not mutually exclusive, they can also be used together. Personally I think this pattern can help to make our codes to be easier to reason so it benefits our future selves and also the ones reviewing our codes.

Nerd For Tech

From Confusion to Clarification

Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Rakha Kanz Kautsar

Written by

React Native developer excited about performance and system designs. https://rakha.dev/

Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.