Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
mr-user13495yUse immutable and final everywhere. Immutable solve the multi thread problem.
Every data structure should only have get and no "set". The "set" should return new object and should not modify the current object. -
@24th-Dragon know what? I'll package hello world in a shitton of Streams and Lambdas and crap.
-
"I have a bunch of toddlers here who can't quite stand up yet. I've been tasked with getting them to do back-flips and long-jumps in an hour. Any strategies?"
If they *literally* can't write hello world, then well - you're doomed. My advice is *don't* teach them. Not yet at least.
Multithreading is pretty much complicated by definition (unless we're talking about scenarios where immutability is guaranteed, which helps immensely.) The biggest problem I see with multithreaded code is, in general, people writing it who *think* they know what they're doing, because they had a couple of lectures on it previously. -
@AlmondSauce good point.
I'll see if I'm able to convince my teacher to let me do another topic. -
@Frederick Essentially yes, just super simple putting stuff in other threads running them, stopping them.
Maybe outputting their IDs and naming them.
Sad thing tho is, that it's not even supposed to be a program, just a fucking slideshow. -
Just use 2 threads with print and sleep.
On the slideshow, draw these 2 threads as separate lines like:
/-{Hello}-------{sleep(1)}-
--
\-{sleep(1)}---{World}----
Then delve deeper, to show the teatcher you understand advanced stuff too.
Boom, done.
EZ
Related Rants
So, for my task I'm supposed to make Multithreading in java simple and understandable using Runnable classes.
The only problem is, that that's practically impossible when you're in a course where more than 80% can't even write a hello world program.
Any ideas?
random
me
help
fucking