Upvote!
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
OttoVonNoob@lemmy.ca to Programmer Humor@programming.dev · 6 months ago

You seen the jank? I live in it.. molded by it...

lemmy.ca

message-square
15
fedilink
178

You seen the jank? I live in it.. molded by it...

lemmy.ca

OttoVonNoob@lemmy.ca to Programmer Humor@programming.dev · 6 months ago
message-square
15
fedilink
alert-triangle
You must log in or # to comment.
  • Admiral Patrick@dubvee.org
    link
    fedilink
    English
    arrow-up
    24
    arrow-down
    1
    ·
    6 months ago

    Just going to leave this horror here. It’s the post feed logic from Tesseract that determines what posts should be displayed or hidden.

    • Alexstarfire@lemmy.world
      link
      fedilink
      arrow-up
      23
      ·
      6 months ago

      If that’s horror to you, you’ve been sheltered. That’s quite readable, though I’d make the long lines into their own subroutines.

    • Sanctus@lemmy.world
      link
      fedilink
      English
      arrow-up
      13
      ·
      6 months ago

      Delightfully devilish, indeed. You made it as easy to read as possible though.

    • PoolloverNathan@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      6 months ago

      Why not factor out the ! via de Morgan’s laws (which would also remove most of the parentheses, as iirc && binds tighter than ||)? Also, does that language have a {#continue} sort of syntax for loops? If so, you could make it a guard clause.

      • setVeryLoud(true);@lemmy.ca
        link
        fedilink
        arrow-up
        4
        ·
        6 months ago

        Thank you, I knew the rule but did not know it had a name.

    • Kaboom@reddthat.com
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      6 months ago

      What is that, Vue?

    • Hoimo@ani.social
      link
      fedilink
      arrow-up
      1
      ·
      6 months ago

      deleted by creator

  • grandma@sh.itjust.works
    link
    fedilink
    arrow-up
    8
    ·
    6 months ago

    Early returns save lives

  • Odinkirk@lemmygrad.ml
    link
    fedilink
    arrow-up
    5
    ·
    6 months ago

    That’s why you set the alternate/exit cases as individual if statements before whatever was going to be inside the original if block.

    To me too long to learn that.

    • Traister101@lemmy.today
      link
      fedilink
      arrow-up
      6
      ·
      6 months ago

      My code got much more readable when I learned about early returns lol

      • lad@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        ·
        6 months ago

        Early returns improve readability in that they make it simpler to read, but I also find them decreasing readability in that you may miss an early return and wonder why is execution not hitting the line you expect it to

        • Traister101@lemmy.today
          link
          fedilink
          arrow-up
          3
          ·
          6 months ago

          I’d say in most cases that’s a sign something needs to be extracted into a separate function. Course sometimes code is just complicated and extracting only makes things harder to follow. Even then I’d much rather use early return than nested ifs as those are significantly harder for me to follow.

  • notprogrammer@programming.dev
    link
    fedilink
    arrow-up
    5
    ·
    6 months ago

    But what if I were to add more ‘and’

    It would be extremely painful

    • magic_lobster_party@fedia.io
      link
      fedilink
      arrow-up
      3
      ·
      6 months ago

      You’re a big function

      • usernamefactory@lemmy.ca
        link
        fedilink
        English
        arrow-up
        3
        ·
        6 months ago

        For you

  • dance_ninja@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    6 months ago

    Gotta go fast

Programmer Humor@programming.dev

programmer_humor@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: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

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

  • 1.55K users / day
  • 4.66K users / week
  • 9.3K users / month
  • 17.8K users / 6 months
  • 1 local subscriber
  • 23.1K subscribers
  • 1.31K Posts
  • 43.1K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.6
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org