Dendarii
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Aijan@programming.dev to Programming@programming.dev · 8 months ago

Avoiding if-else Hell: The Functional Style

lackofimagination.org

external-link
message-square
35
fedilink
87
external-link

Avoiding if-else Hell: The Functional Style

lackofimagination.org

Aijan@programming.dev to Programming@programming.dev · 8 months ago
message-square
35
fedilink
Many years ago, I took part in the development of a taxi-hailing mobile app that is still widely used today. I don’t know what kind of code they’re running now, but in those early days, the driver assignment code –if I remember it correctly– was similar in spirit to the grossly simplified example that follows. There are five levels of nested if statements in less than 30 lines of code. It doesn’t look so bad, some might say, but it’s not difficult to imagine how complicated this code can become with just a few more checks…
  • Ephera@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    8 months ago

    This is called the Pyramid of Doom, by the way.

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 138 users / day
  • 1.04K users / week
  • 2.86K users / month
  • 7.1K users / 6 months
  • 1 local subscriber
  • 20.1K subscribers
  • 1.46K Posts
  • 19.8K Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Ategon@programming.dev
  • MaungaHikoi@lemmy.nz
  • BE: 0.19.9
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org