futurebird ,
@futurebird@sauropods.win avatar

I'm looking for a FUN activity, or test question about Java classes, class methods, OOP.

If you can think of something memorable you did in a class or for fun that taught you something about Java classes I'd love suggestions.

I'm finding all the examples dry and boring. "The student class is a subclass of the people class"

Any suggestions?

kevinrutherford ,
@kevinrutherford@mastodon.me.uk avatar

@futurebird Not sure what level of difficulty you want, but this kata by @xpmatteo is always fun
https://matteo.vaccari.name/blog/archives/293.html

dahukanna ,
@dahukanna@mastodon.social avatar

@futurebird

I haven’t tried it myself but heard good things about this course by Angie Jones, check out - https://testautomationu.applitools.com/java-programming-course/chapter6a.html.

Personally, I only understood the OOP theory (explanation generalization) about classes by observing their behavior in specific exemplar situations e.g. exact same code behaves differently when included in a package scoped class I.e. public, friend or private vs a module (which I call free-range cos it can do it’s thing 🎶whenever, wherever🎶).

BrettCoulstock ,
@BrettCoulstock@adforward.org avatar

@futurebird Seriously old school, but could you fold it into an activity about coding a text adventure? It always seems fun to make simple things like that (and you can get creative making a little "world"), and it strikes me that they could easily include a class hierarchy.

18+ goob ,
@goob@social.wub.site avatar

@futurebird With the caveat that this probably won’t actually work: a stereo system? Then they get to tangle with methods that apply to all components (play) or to just some of them (rewind, repeat) and then have arguments about how to subclass them?

(Although I think they’ll probably just stare blankly and say, “we’ll just listen to Spotify instead”)

heathborders ,
@heathborders@hachyderm.io avatar

@futurebird I always thought that non-static inner classes were interesting:
class A { class B {} }
class C {
public static void main(String[] args) {
A a = new A();
B b1 = a.new B();
B b2 = a.new B();
}
}

llewelly ,
@llewelly@sauropods.win avatar

@futurebird
you might be better off working with a very simple video game world as a basis for examples; the real world of students and dinosaurs and other stuff is so messy and complicated it rapidly becomes an unfun mess in java.

futurebird OP ,
@futurebird@sauropods.win avatar

@llewelly

For some reason my students don't have much interest in video games, they did like 8 years ago, but my current batch of student like interesting visual pattens and math more....

maybe I'll do something with the mandelbrot set? I haven't shown them that yet...

Could a "window" into the set make a good class? I could work out the image generation for them and maybe have them interact with it? hmmmmmm

llewelly ,
@llewelly@sauropods.win avatar

@futurebird
I have to admit my own enthusiasm for video games surely isn't what it what once was.

DaWoDerPfeffer ,
@DaWoDerPfeffer@mastodon.social avatar

@futurebird @llewelly

OK now there is a thought.
Fractals are fun in any language that can handle complex recursion without memory leaks.
... oh, I forgot you want to use Java. 😉

DaWoDerPfeffer ,
@DaWoDerPfeffer@mastodon.social avatar
ALT
  • Reply
  • Loading...
  • Pointomatic ,
    @Pointomatic@post.lurk.org avatar

    @futurebird @llewelly if they’re interested in math here’s something kinda silly that highlights objects being self-referential https://www.codewars.com/kata/5578a806350dae5b05000021/javascript and one solution that could be ported to Java https://github.com/jeng/jeng-kata/blob/main/CodeWars/Fluent_Calculator.cs

    futurebird OP ,
    @futurebird@sauropods.win avatar

    @Pointomatic @llewelly

    This is very silly, I think they might like it.

    ShadSterling ,

    @futurebird @llewelly for math you could do equations, have an expression class and subclasses for different kinds of expressions

    dahukanna ,
    @dahukanna@mastodon.social avatar

    @futurebird @llewelly

    Try using Java(code) to implement the behavior of a mathematical equation like solving a sine or cosine equation with a set of array or vector input variables.
    Then add code to render the results on a XYZ chart (trigonometry & geometry maths) which can be done in a browser using CSS.

    richpuchalsky ,
    @richpuchalsky@mastodon.social avatar

    @futurebird

    Everyone is going to say it, but this is like watching Cthulhu rise from dead R'lyeh and saying "I'm looking for a fun activity about this."

    uliwitness ,
    @uliwitness@chaos.social avatar

    @futurebird I wonder if it even matters whether the example is person/student/teacher or dinosaur/herbivoreDino/carnivoreDino … Maybe it would be better to showcase it as a problem in need of solving? Start out with just e.g. two triceratopses, then a t-rex, then realize you have a bug and need to fix it twice, then creating a base class for the shared bits. So it's not pointless classification, but an actual, practical use case/need? Would that make it less boring?

    Graffotti ,
    @Graffotti@mastodon.social avatar

    @futurebird

    How about distinguishing between a curtain, a door, a gate, and a window?

    DaWoDerPfeffer ,
    @DaWoDerPfeffer@mastodon.social avatar

    @futurebird

    Java ≠ fun

    futurebird OP ,
    @futurebird@sauropods.win avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • test
  • worldmews
  • mews
  • All magazines