#guardclauses โ Public Fediverse posts
Live and recent posts from across the Fediverse tagged #guardclauses, aggregated by home.social.
-
@haircode #typescript #tailwind #reactRouter #docker #graphql #java #nix #vim #mac #ios #iphone #express #gcp #reactNative #nativeApps #appStore #apple #aapl #htmx #vercel #netlify #heroku #nevernester #10xDev #10xdevelopers #codeReview #pairProgramming #oop #earlyReturns #guardClauses #flutter #angular #neverNesting #unitTest #unitTesting #cssFrameworks #jest #jetbrains #neoVim #wordpress #SQL #postgresql #rdbms #rubyOnRails
-
@haircode #typescript #tailwind #reactRouter #docker #graphql #java #nix #vim #mac #ios #iphone #express #gcp #reactNative #nativeApps #appStore #apple #aapl #htmx #vercel #netlify #heroku #nevernester #10xDev #10xdevelopers #codeReview #pairProgramming #oop #earlyReturns #guardClauses #flutter #angular #neverNesting #unitTest #unitTesting #cssFrameworks #jest #jetbrains #neoVim #wordpress #SQL #postgresql #rdbms #rubyOnRails
-
@haircode #typescript #tailwind #reactRouter #docker #graphql #java #nix #vim #mac #ios #iphone #express #gcp #reactNative #nativeApps #appStore #apple #aapl #htmx #vercel #netlify #heroku #nevernester #10xDev #10xdevelopers #codeReview #pairProgramming #oop #earlyReturns #guardClauses #flutter #angular #neverNesting #unitTest #unitTesting #cssFrameworks #jest #jetbrains #neoVim #wordpress #SQL #postgresql #rdbms #rubyOnRails
-
@haircode #typescript #tailwind #reactRouter #docker #graphql #java #nix #vim #mac #ios #iphone #express #gcp #reactNative #nativeApps #appStore #apple #aapl #htmx #vercel #netlify #heroku #nevernester #10xDev #10xdevelopers #codeReview #pairProgramming #oop #earlyReturns #guardClauses #flutter #angular #neverNesting #unitTest #unitTesting #cssFrameworks #jest #jetbrains #neoVim #wordpress #SQL #postgresql #rdbms #rubyOnRails
-
@haircode #typescript #tailwind #reactRouter #docker #graphql #java #nix #vim #mac #ios #iphone #express #gcp #reactNative #nativeApps #appStore #apple #aapl #htmx #vercel #netlify #heroku #nevernester #10xDev #10xdevelopers #codeReview #pairProgramming #oop #earlyReturns #guardClauses #flutter #angular #neverNesting #unitTest #unitTesting #cssFrameworks #jest #jetbrains #neoVim #wordpress #SQL #postgresql #rdbms #rubyOnRails
-
I think that the `if` block of an if/else statement should check for positive "happy path" conditions and the else blocks should handle exceptions.
bad:
if (!isExpected) handleUnexpected();
else handleExpected();good:
if (isExpected) handleExpected();
else handleUnexpected();Especially if you drop the `else`; like with #guardClauses or #earlyReturns.
It makes the #code harder to read and fold in the IDE; saving a level of indentation is not worth it!
-
I think that the `if` block of an if/else statement should check for positive "happy path" conditions and the else blocks should handle exceptions.
bad:
if (!isExpected) handleUnexpected();
else handleExpected();good:
if (isExpected) handleExpected();
else handleUnexpected();Especially if you drop the `else`; like with #guardClauses or #earlyReturns.
It makes the #code harder to read and fold in the IDE; saving a level of indentation is not worth it!
-
I think that the `if` block of an if/else statement should check for positive "happy path" conditions and the else blocks should handle exceptions.
bad:
if (!isExpected) handleUnexpected();
else handleExpected();good:
if (isExpected) handleExpected();
else handleUnexpected();Especially if you drop the `else`; like with #guardClauses or #earlyReturns.
It makes the #code harder to read and fold in the IDE; saving a level of indentation is not worth it!
-
I think that the `if` block of an if/else statement should check for positive "happy path" conditions and the else blocks should handle exceptions.
bad:
if (!isExpected) handleUnexpected();
else handleExpected();good:
if (isExpected) handleExpected();
else handleUnexpected();Especially if you drop the `else`; like with #guardClauses or #earlyReturns.
It makes the #code harder to read and fold in the IDE; saving a level of indentation is not worth it!
-
I think that the `if` block of an if/else statement should check for positive "happy path" conditions and the else blocks should handle exceptions.
bad:
if (!isExpected) handleUnexpected();
else handleExpected();good:
if (isExpected) handleExpected();
else handleUnexpected();Especially if you drop the `else`; like with #guardClauses or #earlyReturns.
It makes the #code harder to read and fold in the IDE; saving a level of indentation is not worth it!
-
Why I Don't Use Else When Programming #coding #programming #GuardClauses
https://www.youtube.com/watch?v=EumXak7TyQ0 -
Unless the #programming #language #compiler recognizes declarative predicates and flattens them into if-then-else structures (which turn into if-goto assembler), this could lead to a huge stack full of procedures that are just idling about, waiting for a nested procedure to get released.
It's the exact opposite of #guardClauses which short-circuit execution by failing fast, and return to their caller quickly, freeing that stack frame instantly.