pivot_root
@pivot_root@lemmy.world
- Comment on Nintendo sues a streamer for streaming ten games before their release 1 week ago:
Thanks for the correction. I sometimes get those two mixed up in my memory, and it’s a really stupid problem that I need to fix.
- Comment on Anon tries programming in Java 1 week ago:
For some reason, my brain inserted a “like” before “C#”, and answered the question of “can’t you use explicit interfaces like C#.”
- Comment on Anon tries programming in Java 1 week ago:
What are some common situations where using an object is a good solution?
It depends on what you mean by “object"
- Some kind of structured data?
- Some named type which fulfills an interface?
When you have some kind of structured data, having a class to represent it is fine. If you’re able to give it type annotations, that’s much better than passing around random dictionaries.
When you need polymorphism and have an interface where some method on an object needs to exist (e.g.
car.honk()
), that’s also fine as long as you avoid creating subclasses and using inheritance. If you need some car that can honk like a truck and drive like a racecar, use composition.What I would consider a good use of classes (more specifically, nominal types) is refinement types. The Wikipedia page is lacking, but the idea is that you use the type system to enforce invariants for data.
For example, suppose you have a string for a user email. It might be a valid email string, or it might be garbage like “z#%@(”=))??”. You have a function for updating the user email in a database, and it requires the email string to be valid.
One approach is to validate the email string after receiving it from the user. That works, but what if your coworker creates a new form and forgets to validate the email string there? Bad data gets passed downstream to functions that expect well-formed data.
Another approach is to validate the email string at the top of every function that expects well-formed data. That also works, but now you’re validating the same string multiple times and pasting
validate_email(email)
everywhere.With a refinement type, you have a
ValidatedEmail
type and a constructor for it. The constructor will return an instance of theValidatedEmail
if and only if the email string is valid. Any function that expects a valid email will only accept aValidatedEmail
, and not a string. If your coworker creates a new form and forgets to validate the email, the type system will complain about a string being passed instead of aValidatedEmail
. You also shift the responsibility of validating the email to wherever there is a boundary between validated and unvalidated data, avoid having to validate the same email multiple times, since you know aValidatedEmail
is already valid. - Comment on Anon tries programming in Java 1 week ago:
I haven’t kept up with recent Java developments, but with Go, you’re out of luck. Interface implementations are—for both better and worse—completely implicit.
- Comment on Anon tries programming in Java 1 week ago:
Maybe check before putting words in my mouth, m’kay?
Sincerely, someone who uses composition.
- Comment on Anon tries programming in Java 1 week ago:
That’s entirely the fault of applications (or more likely their libraries) using internal APIs or JNI. Compiled Java bytecode that doesn’t do anything screwy with reflection to access JRE implementation details will absolutely still work on newer Java versions.
- Comment on Anon tries programming in Java 1 week ago:
What they should have done instead is create a backend restful web service and wire up a frontend rest client with something suited to web app ui dev such as angular or react.
If anon’s program was designed to work as a client for some server or if Java had absolutely no GUI frameworks, that would be fine. But if anon’s goal was to create a simple desktop application, doing this would be the programming equivalent of a Rube Goldberg machine.
- Comment on Anon tries programming in Java 1 week ago:
I strongly prefer how interfaces are handled
It’s better than Java, but they still chose to walk headfirst into the same trap that bites Java developers in the ass: placing the implementations under the concrete type instead of the interface.
When you have two interfaces that each require you to implement a function with the same name but a different signature, you’re in for a bad time featuring an abomination of wrapper types.
- Comment on Nintendo sues a streamer for streaming ten games before their release 1 week ago:
While it’s true that they’ve been attacking emulators for a long time, they haven’t been able to do too much about them because of Sony v Bleem.
Modern emulators exist in a legal gray area, though, and might be violating the DMCA. The more of these assholes that pop up and get sued, the higher the likelihood that one of them refuses to settle, gets steamrolled by Nintendo, and gives them and every other console manufacturer the legal precedent that emulators are piracy/DRM-circumvention tools.
- Comment on Nintendo sues a streamer for streaming ten games before their release 1 week ago:
Is that directed at me… or?
Either way, there’s going to be a lot of that here. A lot of Lemmings come to the same conclusions, but the reasons are very different and sometimes incomprehensible from an outside perspective.
- Comment on Nintendo sues a streamer for streaming ten games before their release 1 week ago:
You’re entitled to your own opinion, but keep in mind that it’s people like him who make corporations condemn the technology instead of the users of the technology. He’s blatantly pirating, trying to profit off of it, and taunting Nintendo to do something about it.
And what they’re doing about it is not just going after him but also the people who created the emulators, so more people like him can’t exist. Nintendo wasn’t nearly as aggressive about going after emulators until people started using them to play unreleased games, and now, in the span of a year, they took out the main developers of both major emulators.
As someone who suffers from severe motion sickness and uses framerate unlocking patches to alleviate it, these people’s actions are screwing me and other gamers with accessibility challenges over.
- Comment on Nintendo sues a streamer for streaming ten games before their release 1 week ago:
Yeah, but this asshole deserved it. He
- Streamed unreleased games
- Handed over prod.keys and firmware files to anyone who asked.
- Told Nintendo “I can do this all day” after being copyright striked.
- And set up a CashApp to make money from all of it.
All while using an emulator. That kind of shit makes emulation look like a tool for bad actors and pirates, which is going to ruin it for the rest of us.
- Comment on ATTN: GEOLOGISTS 2 weeks ago:
Compatibility with existing worlds
- Comment on Game Freak has been allegedly hacked, with source codes for Pokemon games reportedly leaked 5 weeks ago:
You can believe what you want, but there’s absolutely no way you would be correct. Any large company sponsoring a cyber attack, if caught, would be nailed to the wall and made an example of. The extreme risks are simply not worth the comparatively small reward of reducing a tiny fraction of piracy.
A more realistic and reasonable avenue would have been to sponsor the companies going after IA for copyright infringement as a result of them loaning out unlimited digital copies of books without DRM.
- Comment on Why are peole hating on .world? 1 month ago:
Then drag and I are in agreement :)
I saw drag clarification that drag comment was just about milk and not politics or economics. Myself and others had a different interpretation, which is where things were misunderstood.
- Comment on Why are peole hating on .world? 1 month ago:
Understandable. I hope drag has a good day and glass of ethical milk.
- Comment on Why are peole hating on .world? 1 month ago:
If drag does not support China, drag is probably not a tankie. If drag calls drag communist and consider Russia and North Korea communist-lead countries, drag is wrong, however.
- Comment on Why are peole hating on .world? 1 month ago:
So, Drag thinks countries that believe their neighbors are part of a greater whole ruled by them as the motherland are communist?
That’s imperialism, buddy.
Let me know when: 1) China stops trying to exert absolute control over Tibet, Taiwan, and Hong Kong; 2) North Korea accepts that their ownership ends where their globally-recognized territory ends; 3) Russia stops invading neighboring countries.
- Comment on Why are peole hating on .world? 1 month ago:
The constant cheerleading of brutally-repressive regimes that don’t have any values in common with actual socialists or communists just because they oppose the US and its allies.
This is my main issue with tankies. Yeah, late-stage capitalism sucks and exploits the layman to enrich the rich further—I take no issue with that. It’s the knob-slobbering of Putin, Xi Jinping, and Kim Jong Un that makes no sense. Modern-day Russia, China, and North Korea have about as much in common with communism as oat milk has with milk: nothing but the name.
- Comment on Maybe Even More Than 5 2 months ago:
- Comment on Recommendation engine: Downvote any game you've heard of before 2 months ago:
Oh, that is great. I have fond (painful) memories of I Wanna be the Guy, and this seems right up my nostalgia alley.
- Comment on Recommendation engine: Downvote any game you've heard of before 2 months ago:
Pick Quest Master. The developer is extremely active and responsive to community feedback and requests. There’s even weekly content updates.
- Comment on Recommendation engine: Downvote any game you've heard of before 2 months ago:
Quest Master. Mario Maker meets Zelda dungeons, done well. It deserves way more attention than it’s currently getting, and it’s pretty fun with huge potential despite being early access.
- Comment on Looks like it was a ... boobie trap 2 months ago:
Those “fans” sound like creeps with a fetish.
- Comment on Oh sweet, my old Empire Earth box! 4 months ago:
With powered hubs and balanced tree topology, you can split a single root controller into 4^5^ endpoints. Your motherboard being able to support that many devices and the shared bandwidth might be a problem, but it’s theoretically possible to survive off of a single USB port.
- Comment on Stay Mad 4 months ago:
It seems pretty obvious to me at this point that the DNC would rather lose than have an actual progressive win.
It’s not in their interests to let a progressive win. Just like their counterpart, the DNC takes a shit ton of
briberydonations fromcorporationslobbyists. Bringing in a progressive who would reform the system or push back against pro-corporate policies is biting the hands that feed them. - Comment on Stay Mad 4 months ago:
I’m mad that Biden and the Democratic leadership seems to have put their own interests above the interest of the
partypeople.The interests of the party is the interests of the rich :)
- Comment on Stay Mad 4 months ago:
The system is set up in a way that the only viable options are between two evils, unfortunately. Under a FTPT system where the only good options are minority parties that won’t win a single seat in their districts, you’re left with the choice of voting for the lesser evil, or voting for your morals but increasing the risk of the greater evil winning.
It’s a no-win situation.
- Comment on Stay Mad 4 months ago:
The Democrat party is just as corrupt and bought out by corporations as the Republicans are, but at least they aren’t trying to get the country to circle the drain as quickly.
- Comment on Whales 4 months ago:
Hmmm, let’s see:
- Can’t even spell “can” correctly. (dumb)
- Bad attitude towards animals. (mean spirited)
- Paid for premium. (desperate)
Yeah, I don’t see women lining up around the block for this catch of a human being.