i think functional software requires you to place more importance on following patterns and style much more than OOP which railroads you into sticking with an (internal code, not REST) API a lot more. But if you're doing it well, then your application is a very thin layer in front of the data, which leads you to want to use the data directly instead of going through whatever functions or whatever
so basically i think it's a lot easier to footgun yourself a lot worse with FP if you don't know what you're doing
Conversation
Notices
-
Embed this notice
受不了包 (shibao@misskey.bubbletea.dev)'s status on Saturday, 06-Apr-2024 01:22:44 JST 受不了包 -
Embed this notice
Sick Sun (sun@shitposter.world)'s status on Saturday, 06-Apr-2024 01:27:03 JST Sick Sun @shibao I am going through a thing where everything can fail at every step in a combinatorial explosion of ways. In retrospect imperative mutable code is better for this but I don't have a language yet that is as good as Elixir for that. -
Embed this notice
受不了包 (shibao@misskey.bubbletea.dev)'s status on Saturday, 06-Apr-2024 01:34:51 JST 受不了包 @sun@shitposter.world so I knew someone who was working on a tcg engine in lisp that ran into the same problem, except I would argue that something like lisp (and elixir by proxy) is uniquely qualified to handle something like this due to how it's all untyped by default and you can do things like pattern matching super efficiently
since you're building something akin to a rule engine, have you thought about being able to draw or diagram out the rule dag you're making? -
Embed this notice
Sick Sun (sun@shitposter.world)'s status on Saturday, 06-Apr-2024 01:40:29 JST Sick Sun @shibao elixir doesn't feel as flexible as common lisp to me.
> have you thought about being able to draw or diagram out the rule dag you're making?
too many unknowns. basically, you need to be able to write sloppy code that can be easily modified to handle new cases as they come up. -
Embed this notice
narcolepsy and alcoholism :flag: (hj@shigusegubu.club)'s status on Saturday, 06-Apr-2024 01:41:54 JST narcolepsy and alcoholism :flag: @sun @shibao JS. look at themes 3. -
Embed this notice
Sick Sun (sun@shitposter.world)'s status on Saturday, 06-Apr-2024 01:42:33 JST Sick Sun @hj @shibao the last version of this code was written in js. it worked good for that purpose but I found its concurrency model far too constraining. narcolepsy and alcoholism :flag: likes this. -
Embed this notice
narcolepsy and alcoholism :flag: (hj@shigusegubu.club)'s status on Saturday, 06-Apr-2024 01:43:35 JST narcolepsy and alcoholism :flag: @sun @shibao I've had same complaints when making themes 3 tbh Sick Sun likes this. -
Embed this notice
受不了包 (shibao@misskey.bubbletea.dev)'s status on Saturday, 06-Apr-2024 01:49:02 JST 受不了包 @sun@shitposter.world i'm confused about how you can't easily just throw every single attribute into a new map and then pattern matching will work from top down, so you just have your most specific cases to least specific in order
def execute_turn(other_player_attributes, other_player) do get_random_attack_value() |> calculate_dmg(other_player_attributes) |> deduct_health(other_player) end def calculate_dmg(damage, %{condition: :on_fire}), do: damage * 1.5 def calculate_dmg(damage, %{condition: :sleepy}), do: damage * 0.8 def calculate_dmg(damage, _attributes), do: damageetc etc
the thing is you have to already ignore the idea of a class heirarchy or even traits and go back to data, if you have to set up traits then you're dealing with that complexity generated by your combinations (which might not even matter for most interactions) instead of just defining your interactions based on the data (which is what really matters) -
Embed this notice
pry (pry@raru.re)'s status on Saturday, 06-Apr-2024 01:53:46 JST pry @shibao yk when you learn the ternary operator and get like way too "clever" with how you use it?
that's what I'm like w some functional programming stuff... I end up trying to map filter reduce my way to a solution in like a single line and that's not even a fp problem, it's just a me problem
受不了包 likes this. -
Embed this notice
受不了包 (shibao@misskey.bubbletea.dev)'s status on Saturday, 06-Apr-2024 02:05:31 JST 受不了包 @sun@shitposter.world this code example is pretty bullshit but this is what basically the tcg guy explained to me that he had to discover with blood sweat and tears of creating multiple tcg engines that can handle basically infinite layers of added complexity without quickly combinatoricalling out
like if you think about how complex some of these card games can be, 3 turns ago a card was played that blocked an effect of this current card but then this card reverses a rule that was played last round so then your engine has to take this situation into account, you can't do this with a type hierarchy and it'd be hell with traits, the only solution is to really define out your state machine rigorously. before this guy explained it to me i never really considered how similar creating tcgs were to basically programming lolSick Sun likes this. -
Embed this notice
Sick Sun (sun@shitposter.world)'s status on Saturday, 06-Apr-2024 02:22:37 JST Sick Sun @shibao well I am still getting good at using Elixir.
I won't be abandoning it for this project, I'm seeing it through. -
Embed this notice
受不了包 (shibao@misskey.bubbletea.dev)'s status on Saturday, 06-Apr-2024 02:23:01 JST 受不了包 @sun@shitposter.world lmk if you have elixir questions, i've been using it for too long lol
Sick Sun likes this. -
Embed this notice
Sick Sun (sun@shitposter.world)'s status on Saturday, 06-Apr-2024 02:24:09 JST Sick Sun @shibao thanks I appreciate it!
-
Embed this notice