4

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?

Comments
  • 4
    Use 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.
  • 0
    @24th-Dragon know what? I'll package hello world in a shitton of Streams and Lambdas and crap.
  • 5
    "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.
  • 1
    @AlmondSauce good point.
    I'll see if I'm able to convince my teacher to let me do another topic.
  • 0
    @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.
  • 1
    Teach them a multithreaded hello world
  • 1
    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
  • 0
    @MagicSowap Much appreciated!
  • 0
  • 0
    Learn Kotlin or Dart instead! haha
  • 1
    you're in a dead lock
Add Comment