Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
not_IO ( not_IO@lemmy.blahaj.zone )  to Programmer Humor@programming.devEnglish · 7 months ago

POV: You maintain a JS library that 80% of modern web infrastructure uses as a dependency.

lemmy.blahaj.zone

message-square
9
link
fedilink
301

POV: You maintain a JS library that 80% of modern web infrastructure uses as a dependency.

lemmy.blahaj.zone

not_IO ( not_IO@lemmy.blahaj.zone )  to Programmer Humor@programming.devEnglish · 7 months ago
message-square
9
link
fedilink
alert-triangle
You must log in or # to comment.
  • bleistift2 ( bleistift2@sopuli.xyz ) 
    link
    fedilink
    English
    arrow-up
    95
    ·
    7 months ago

    One way in which this could have come about is that Math.random wasn’t supported in all relevant browsers when the library author wrote the library. So they had to roll their own randomness with blackjack and hookers. Later the web standards evolved and the author was able to remove the custom code, but now had people relying on his library’s exposing a getRandom function.

    • Billygoat ( Billygoat@piefed.social ) 
      link
      fedilink
      English
      arrow-up
      36
      ·
      7 months ago

      You see this kind of stuff in C all the time when a code base supports multiple OSs by using macros.

  • katy ✨ ( cupcakezealot@piefed.blahaj.zone ) 
    link
    fedilink
    English
    arrow-up
    30
    ·
    7 months ago

    i mean its still good to use an abstraction layer in case you ever have to change the underlying call; it’s far easier to change it in one place instead of replacing every call

    • Hirom ( Hirom@beehaw.org ) 
      link
      fedilink
      arrow-up
      8
      ·
      7 months ago

      YAGNI

    • RickyRigatoni ( RickyRigatoni@piefed.social ) 
      link
      fedilink
      English
      arrow-up
      5
      ·
      7 months ago

      Just do a find and replace

  • Avicenna ( Avicenna@programming.dev ) 
    link
    fedilink
    arrow-up
    13
    ·
    7 months ago

    I can imagine multiple scenarios where this could be useful. Simplest is perhaps the coder imagined at the time they could extend the function in later stages.

  • ranzispa ( ranzispa@mander.xyz ) 
    link
    fedilink
    arrow-up
    5
    ·
    7 months ago

    Currently having a new hire write a library in python and I noticed he was doing this in a few PRs. I went and explained to him this was not necessary and that he could just call the original function where he needed it. While showing him how to inline the functions I realised he was actually adding type annotations to functions which did not have them in the original libraries.

    Nevermind what I told you, keep doing this.

  • brunchyvirus ( brunchyvirus@fedia.io ) 
    link
    fedilink
    arrow-up
    4
    ·
    7 months ago

    Its a modernized version of Infinite monkey theorem but instead of typewriters and Shakespeare its importing libraries and Facebook.

  • g_blob ( g_blob@programming.dev ) 
    link
    fedilink
    arrow-up
    1
    ·
    7 months ago

    How to forget my first pull request.

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
    • If the mod doesn’t find it funny, you’re banned. Ha-ha!.. For real: do not use the community for “statements”. There are other places for such content. Keep it chill and funny.
Visibility: Public
globe

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

  • 578 users / day
  • 1.03K users / week
  • 3.06K users / month
  • 7.39K users / 6 months
  • 463 local subscribers
  • 33.3K subscribers
  • 1.52K Posts
  • 24.9K Comments
  • Modlog
  • mods:
  • Feyter ( Feyter@programming.dev ) 
  • adr1an ( anzo@programming.dev ) 
  • BurningTurtle ( BurningTurtle@programming.dev ) 
  • Pierre-Yves Lapersonne ( pylapp@programming.dev ) 
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code