MTGZone
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Sjmarf@sh.itjust.works to Programmer Humor@programming.dev · 1 year ago

You wouldn’t get it

sh.itjust.works

message-square
44
fedilink
396

You wouldn’t get it

sh.itjust.works

Sjmarf@sh.itjust.works to Programmer Humor@programming.dev · 1 year ago
message-square
44
fedilink
alert-triangle
You must log in or register to comment.
  • Victor@lemmy.world
    link
    fedilink
    arrow-up
    85
    ·
    1 year ago

    Ha. Cause there’s no getter. I get it. I think?

    • dohpaz42@lemmy.world
      link
      fedilink
      English
      arrow-up
      67
      ·
      1 year ago

      I get it.

      No you don’t; there’s no getter.

      • Victor@lemmy.world
        link
        fedilink
        arrow-up
        29
        ·
        1 year ago

        Oh, now I get it.

        Wait…

        • Batman@lemmy.world
          link
          fedilink
          arrow-up
          6
          ·
          1 year ago

          You don’t get the context of this joke

          • fsxylo@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            6
            ·
            1 year ago

            var context = getContext();

            • lightnegative@lemmy.world
              link
              fedilink
              arrow-up
              3
              ·
              1 year ago

              var context = RuntimeSingletonFactory.getCurrentFactory().getCurrentRuntimeSingleton().getContext()

    • 4am@lemm.ee
      link
      fedilink
      arrow-up
      23
      ·
      1 year ago

      It’s also an inside Joke

      • intensely_human@lemm.ee
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        And the Joker gets it, but you don’t.

  • sik0fewl@lemmy.ca
    link
    fedilink
    arrow-up
    69
    ·
    1 year ago

    Upon reflection, I do get the joke now.

    • rimjob_rainer@discuss.tchncs.de
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      This one gets it

  • JustBrian7872@feddit.de
    link
    fedilink
    arrow-up
    47
    ·
    1 year ago

    They don’t call me AbstractJokerAdapterFactoryProxy for nothin’

  • hydroptic@sopuli.xyz
    link
    fedilink
    arrow-up
    37
    arrow-down
    3
    ·
    1 year ago

    Where are your gods now?

    public static Joke getTheJoke(Meme yourMeme) {
      Field jokeField = Meme.class.getDeclaredField("joke");
      jokeField.setAccessible(true);
      return (Joke) jokeField.get(yourMeme);
    }
    
    • RonSijm@programming.dev
      link
      fedilink
      arrow-up
      16
      ·
      edit-2
      1 year ago

      Is it Java? It looked like Microsoft Java C# to me…

          public static void Main(string[] args)
          {
              var meme = new Meme();
              var joke = GetTheJoke(meme);
          }
          
          public static Joke GetTheJoke(Meme theMeme)
          {
              var memeType = typeof(Meme);
              var jokeField = memeType.GetField("Joke", BindingFlags.NonPublic | BindingFlags.Instance);
              return (Joke)jokeField.GetValue(theMeme);
          }
      
      • PoolloverNathan@programming.dev
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 year ago

        There isn’t an unnecessary level of capitalization; seems to be regular Java with Allman braces.

      • hydroptic@sopuli.xyz
        link
        fedilink
        arrow-up
        4
        arrow-down
        1
        ·
        1 year ago

        Frankly it’s been a while since I wrote either one. I just assumed Java because of the naming convention, and I didn’t see anything I took as obviously un-Java in the class definition

      • Hazzia@discuss.tchncs.de
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        10 months ago

        deleted by creator

        • hydroptic@sopuli.xyz
          link
          fedilink
          arrow-up
          3
          arrow-down
          1
          ·
          edit-2
          1 year ago

          If you want to be able to eg. (de)serialize non-public fields of a type for any reason, you’ll need some way to get around the access restriction. Mocking is another use case – although it’s a philosophical discussion whether you should be mocking non-public fields.

          And this isn’t just a Java thing, the comment you’re responding to has an example in C#, and you can do something similar in a lot of languages that support runtime reflection. Barring runtime reflection support you can do pointer math if the language supports it. Access restrictions on fields are there to stop casual misuse of private fields, but sometimes you actually may want to be able to step over those restrictions if you really know what you’re doing.

        • RonSijm@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          1 year ago

          Yea, what @hydroptic@sopuli.xyz posted is actually Java

          What even is the point of creating standards if you design backdoors to them

          If you’re building in a backdoor anyways, why would the backdoor require 5 lines of weird reflection to get the type, type info, fieldinfo with the correct binding flags, and then invoking the method?

          I think it’s kinda neat compared to C#, just being able to say “Ignore private/protected/internal keywords”

        • rimjob_rainer@discuss.tchncs.de
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          1 year ago

          Reflection is sometimes a necessary evil. At least it makes it harder to abuse the class and if you do, then you are responsible if something goes wrong.

      • rimjob_rainer@discuss.tchncs.de
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Because C# is a Java clone

      • noproblemmy@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        If you have to cast your joke it isn’t funny?

        • Karyoplasma@discuss.tchncs.de
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Could just change it to public static Object GetTheJoke, no?

  • BassaForte@lemmy.world
    link
    fedilink
    English
    arrow-up
    32
    ·
    1 year ago

    public Joke Joke { private get; set; }

  • Xylight@lemdro.id
    link
    fedilink
    English
    arrow-up
    21
    arrow-down
    2
    ·
    1 year ago

    i hate this programming pattern with a passion.

    • someonesmall@lemmy.ml
      link
      fedilink
      arrow-up
      26
      ·
      1 year ago

      Setters and Getters?

      • Xylight@lemdro.id
        link
        fedilink
        English
        arrow-up
        6
        arrow-down
        1
        ·
        1 year ago

        yes.

        • someonesmall@lemmy.ml
          link
          fedilink
          arrow-up
          7
          ·
          1 year ago

          So what is a better paradigm in your opinion?

          • Xylight@lemdro.id
            link
            fedilink
            English
            arrow-up
            8
            ·
            1 year ago

            immutable objects, i like functional programming

          • sudo@programming.dev
            link
            fedilink
            arrow-up
            8
            arrow-down
            4
            ·
            1 year ago

            Immutable members. Set in constructor then read only. The Builder pattern is acceptable if you’re language is an obstacle.

            • AVincentInSpace@pawb.social
              link
              fedilink
              English
              arrow-up
              7
              ·
              1 year ago

              found the functional programming purist

              • sudo@programming.dev
                link
                fedilink
                arrow-up
                3
                arrow-down
                2
                ·
                1 year ago

                ✅

            • Piafraus@lemmy.world
              link
              fedilink
              arrow-up
              3
              ·
              1 year ago

              So do you create new objects every time you need to change state?

              • sudo@programming.dev
                link
                fedilink
                arrow-up
                3
                ·
                1 year ago

                You avoid having mutable state as much as possible. This is a pretty standard concept these days.

                • Piafraus@lemmy.world
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  1 year ago

                  Can you please give me an example - let’s say I have a big list of numbers and I need to find how many times each number is there.

                  I would expect a mutable dictionary/map and a single pass through. How would you do that without mutable datastructure?

      • purplemonkeymad@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        1 year ago

        Where getter?

        • mexicancartel@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          5
          ·
          1 year ago

          Well you wouldn’t get it

    • intensely_human@lemm.ee
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      1 year ago

      Java?

  • _NoName_@lemmy.ml
    link
    fedilink
    arrow-up
    14
    ·
    1 year ago

    Is it possible to get the joke at runtime using the spectre exploit?

    • coloredgrayscale@programming.dev
      link
      fedilink
      arrow-up
      5
      ·
      1 year ago

      Not required. Looks like Java, just use reflection.

  • 🇰 🌀 🇱 🇦 🇳 🇦 🇰 🇮 🏆@yiffit.net
    link
    fedilink
    English
    arrow-up
    7
    ·
    1 year ago

    Stop making private jokes and start posting them publicly. We wanna laugh too, ya selfish bastid.

  • Alien Nathan Edward@lemm.ee
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    throw new SameJokeException();

  • BassaForte@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    deleted by creator

  • LinearArray@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    now i get it, do i?

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.88K users / day
  • 4.63K users / week
  • 9.2K users / month
  • 17.8K users / 6 months
  • 4 local subscribers
  • 23.4K subscribers
  • 1.42K Posts
  • 51.7K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.5
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org