Fork me on GitHub
#clojuredesign-podcast
<
2023-10-26
>
neumann20:10:12

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?

🎉 5
🚀 2
😱 1
JR16:10:43

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!

JR16:10:26

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.

neumann01:11:59

@U02PB3ZMAHH I love the metaphor! That's cracking me up! Yes, they are stuck together.

neumann01:11:55

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".

neumann01:11:33

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

neumann01:11:54

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

clojure-design 1