You wouldn’t get it

393 points · 41 comments · view on lemmy.world

41 Comments

victorz@lemmy.world · 82 pts · 2y (7 replies)

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

dohpaz42@lemmy.world · 65 pts · 2y (4 replies)

I get it.

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

victorz@lemmy.world · 29 pts · 2y (3 replies)

Oh, now I get it.

Wait...

Batman@lemmy.world · 6 pts · 2y (2 replies)

You don't get the context of this joke

fsxylo@sh.itjust.works · 6 pts · 2y (1 reply)

var context = getContext();

lightnegative@lemmy.world · 3 pts · 2y

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

4am@lemm.ee · 23 pts · 2y (1 reply)

It’s also an inside Joke

intensely_human@lemm.ee · 2 pts · 2y

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

sik0fewl@lemmy.ca · 69 pts · 2y (1 reply)

Upon reflection, I do get the joke now.

rimjob_rainer@discuss.tchncs.de · 6 pts · 2y

This one gets it

JustBrian7872@feddit.de · 47 pts · 2y

They don't call me AbstractJokerAdapterFactoryProxy for nothin'

hydroptic@sopuli.xyz · 34 pts · 2y (10 replies)
[ removed ]
RonSijm@programming.dev · 16 pts · 2y (9 replies)

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 · 4 pts · 2y

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

hydroptic@sopuli.xyz · 3 pts · 2y
[ removed ]
rimjob_rainer@discuss.tchncs.de · 2 pts · 2y

Because C# is a Java clone

Hazzia@discuss.tchncs.de · 2 pts · 2y (3 replies)
[ removed ]
hydroptic@sopuli.xyz · 2 pts · 2y
[ removed ]
rimjob_rainer@discuss.tchncs.de · 1 pts · 2y

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.

RonSijm@programming.dev · 1 pts · 2y

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"

noproblemmy@programming.dev · 1 pts · 2y (1 reply)

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

Karyoplasma@discuss.tchncs.de · 1 pts · 2y

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

BassaForte@lemmy.world · 32 pts · 2y

public Joke Joke { private get; set; }

Xylight@lemdro.id · 18 pts · 2y (16 replies)

i hate this programming pattern with a passion.

someonesmall@lemmy.ml · 26 pts · 2y (14 replies)

Setters and Getters?

Xylight@lemdro.id · 5 pts · 2y (11 replies)

yes.

someonesmall@lemmy.ml · 7 pts · 2y (10 replies)

So what is a better paradigm in your opinion?

Xylight@lemdro.id · 8 pts · 2y

immutable objects, i like functional programming

sudo@programming.dev · 4 pts · 2y (8 replies)

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

AVincentInSpace@pawb.social · 7 pts · 2y (1 reply)

found the functional programming purist

sudo@programming.dev · 1 pts · 2y

Piafraus@lemmy.world · 3 pts · 2y (5 replies)

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

sudo@programming.dev · 3 pts · 2y (4 replies)

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

Piafraus@lemmy.world · 2 pts · 2y

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 · 3 pts · 2y (1 reply)

Where getter?

mexicancartel@lemmy.dbzer0.com · 5 pts · 2y

Well you wouldn't get it

intensely_human@lemm.ee · 4 pts · 2y

Java?

JayDee@lemmy.ml · 14 pts · 2y (1 reply)

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

coloredgrayscale@programming.dev · 5 pts · 2y

Not required. Looks like Java, just use reflection.

Kolanaki@yiffit.net · 7 pts · 2y

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

reverendsteveii@lemm.ee · 4 pts · 2y

throw new SameJokeException();

BassaForte@lemmy.world · 2 pts · 2y
[ removed ]
LinearArray@programming.dev · 1 pts · 2y

now i get it, do i?