Every once in a while I come across something that mentions one of the Gang of Four patterns and I look it up to refresh my memory and go "what the fuck, why would anyone do this"

Of course the answer is "classes suck", I guess I just subconsciously assume that we have collectively moved past the need for classes, and keep being surprised when we have not

@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?

Follow

@socks interesting, I don't think I ever used one that could

@noiob @socks

"classes are a terrible way of organizing code"

Either that, or someone is just terrible at organizing classes?

Sign in to participate in the conversation
Awoo Space

Awoo.space is a Mastodon instance where members can rely on a team of moderators to help resolve conflict, and limits federation with other instances using a specific access list to minimize abuse.

While mature content is allowed here, we strongly believe in being able to choose to engage with content on your own terms, so please make sure to put mature and potentially sensitive content behind the CW feature with enough description that people know what it's about.

Before signing up, please read our community guidelines. While it's a very broad swath of topics it covers, please do your best! We believe that as long as you're putting forth genuine effort to limit harm you might cause – even if you haven't read the document – you'll be okay!