Like look at this crap https://refactoring.guru/design-patterns/visitor
The described "problem" here is just. Why wouldn't you... write a function instead of a method. What
@socks I don't understand where you'd want to use a function instead of a method
thing is, these patterns exist for corporate codebases that have to be worked on by a lot of people and like, comply with regulations, you won't always end up with the most convenient solution
@noiob I get that, and I think a big reason why they end up so messy is because classes are a terrible way of organizing code
"Oh I can't change the class because I might break something about it" Okay, write a function that takes in nodes and outputs XML. Boom, no changes required to the class
@socks where do I put the function? In (corporate, idk if it's actually necessary) Java you need a class to hold your function for you. Also you wanna be able to type-check and, if required, swap out the whole construct, which classes are useful for
@noiob Yeah and this is (one reason) why Java sucks to use!
The type checking is fine, you can have polymorphic functions
@socks can you typecheck for a type of function though?
@noiob @socks
Either that, or someone is just terrible at organizing classes?