RT @Nick__Bentley@twitter.com
Publishers are treating games like a commodity and it’s going badly: https://www.nickbentley.games/commodity-board-games/
Solution: double dispatch. I replaced:
A result = otherObject.foo();
if (result instanceof B) {
B b = (B)result;
d.doSomething(b);
} else {
C c = (C)result;
d.doSomething(c);
}
with :
otherObject.foo().doSomething(d);
where B and C have different definitions of doSomething.
As desired, otherObject still can't call doSomething, even on Bs and Cs it creates, because it doesn't have access to d.
RT @TheOnion@twitter.com
Thousands Gather For Stuffing Of Giant Rockefeller Center Turkey https://trib.al/PJUtIfM
Another #java puzzle:
Interface A is implemented by classes B and C. I call a method that returns an A and want to do different things depending on whether I actually get back a B or a C. Is there a cleaner way than this?
A result = otherObject.foo();
if (result instanceof B) {
B b = (B)result;
doSomething(b);
} else {
C c = (C)result;
doSomething(c);
}
I can't change doSomething(b) into b.doSomething() because (for security reasons) I don't want otherObject to be able to doSomething.
instanceof feels dirty.
Ideas?
On its very first move, my primitive Scrabble AI played "LO". #singularity
RT @sadanduseless@twitter.com
World's Greatest Gallery of Round Animals (Not Photoshopped!) https://www.sadanduseless.com/cute-round-animals/
We Finally Know How Wombats Produce Their Distinctly Cube-Shaped Poop https://gizmodo.com/we-finally-know-how-wombats-produce-their-distinctly-cu-1830414749 via @gizmodo
RT @kthorning@twitter.com
@djolder@twitter.com I just found out that food pantries and homeless shelters love those cloth tote bags. Their clients prefer them to the plastic bags they usually have to use, the straps of which dig into your hands. I gave them ALL my tote bags and they were so glad to get them.
After our first session, we question the decision to launch @ingress@twitter.com at the beginning of winter. #brrr
Want a calmer, advertising-free social media experience? https://joinmastodon.org/ Now with over 1.7 million users. I'm @peterdrake.
I have moved to peterdrake@mstdn.social. If you found peterdrake@qoto.org on a website, please let me know at my new account.