r/ruby • • Oct 12 '24

Service Objects as Functions: A functional approach to build business flows in Ruby on Rails

https://medium.com/@beard-programmer/service-objects-as-functions-a-functional-approach-to-build-business-flows-in-ruby-on-rails-bf34bf18331d

I wrote this article last year and want to see what you guys think? I have not received much feedback when sharing on LinkedIn.

Original idea was to have a 3-4 post series, but I am not sure is it worth it and if its something people are interested to read about.

16 Upvotes

22 comments sorted by

View all comments

Show parent comment

1

u/kahns Oct 12 '24

Ofc it’s nitpicky, how else can you make an article example? I’m not really following you here. Good unit tests will catch all bugs. Writing software without bugs in the first place would be even better no?

And it’s not even FP thing, you can totally write pure functions in OOP. Mb im a bad advocate for FP, have you tried reading “grocking simplicity”? I believe it does good job of explaining this.

And about DI - well I have not heard anything specific bad about DI. Millions of files can be frustrating as well as a lot layers. But that’s not DI thing at all and not “service objects” thing either. Imagine a concerns that can include other concerns and they include some more. Your classes could look very “clean” but in fact it’s just a huge over functional giant. So it’s not DI or not DI I believe but just a matter of design