clojuredesign-podcast

neumann 2023-10-26T20:02:12.119909Z

Should a game board play its own pieces? Or, perhaps a piece can place itself on the board? Isn't that the stuff of horror films? What does this have to do with functional programming? In our latest episode, we go back to the start and play through a composition strategy to see where we land. https://clojuredesign.club/episode/096-gaming-data/ What OO horror went away when you switched to functional programming?

🚀 2
😱 1
🎉 5
JR 2023-10-28T16:55:43.746299Z

Great episode. It seems like functions + data is a little like an instrument + sheet music. And maybe some objects are more like an old-timey wind-up music box where the song + player are stuck together. Not sure the analogy holds up to scrutiny though!

JR 2023-10-28T16:59:26.780999Z

I didn't realize it until you two mentioned it in the podcast, but the horror that went away for me was that I no longer needed to find /the/ object to hold a behavior. Sometimes it seemed like there was no good place, and I felt like that was a design failure on my part. 😱 Of course, now I wonder which module should hold a behavior, but that's a lot easier to refactor.

neumann 2023-11-01T01:08:59.926019Z

@john.t.richardson.dev I love the metaphor! That's cracking me up! Yes, they are stuck together.

neumann 2023-11-01T01:11:55.304269Z

I really relate to what you're saying about find the "right" place to put behavior. You always have to have a "class" be the holder. Sure, you can make a class with all static methods and have something that is similar to a namespace. However, that's an unusual way of using classes, and I can already imagine arguing about it with other team members. Namespaces have a clear purpose: to organize functions, constants, and other "global" things into related groups. That's all they do. When you abuse classes to try and get namespaces, you end up in the land of "careful programming" and "opinionated style".

neumann 2023-11-01T01:12:33.494369Z

But yes, not all the organizational questions go away! @nate and I have spent lots of time talking about namespaces too. 😆

neumann 2023-11-01T01:12:54.066989Z

Thanks for the feedback! Sorry I'm a bit slow to get back to you.

1