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?

  • 4
    Teach them hello world wrapped in runnable
  • 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.
  • 1
    @24th-Dragon know what? I'll package hello world in a shitton of Streams and Lambdas and crap.
  • 6
    "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.
  • 1
    Am i kinda curious, what type of project do you have to make? Or is it just some simple lecture where you have to do something in another thread?
  • 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:


    Then delve deeper, to show the teatcher you understand advanced stuff too.

    Boom, done.
  • 0
    @MagicSowap Much appreciated!
  • 0
    @electrineer yes.
    Just yes.
  • 0
    Learn Kotlin or Dart instead! haha
Add Comment