Quote:
Originally Posted by :::grimReaper:::
Never heard that poor OOP design being referred to as "the Rails way".
Id assume the mutation aspect isnt "The Rails Way", but you see it a lot (updating a user field in a user service or something).
Common pattern I dont care for
Code:
class FooService
def initialize
@foo = Foo.new()
end
def method_100_lines_later
# Do something with @foo here, mutating or just reading
end
end
I had code that didnt pass review bc my service looked more like:
Code:
class FooService
def method_100_lines_later(foo)
# Do something with foo here, mutating or just reading
end
end
I dont care for the former pattern, especially on a big app.
And obviously there are considerations for a rule. I tried doing 100% immutable but that was just stupid annoying and slows you down on anything with a slight bit of logic to it.
Quote:
Originally Posted by OmgGlutten!
in ruby if you do
x = 5
x + 1 returns 6
but x is still 5
there are some methods that will mutate the object. they are available but i'm not sure it is fair to say that they are encouraged.
I specifically said rails, and you did no mutations there of any sort.
Im more butthurt by the private or self modifier being on one random line in bigger files than any of this stuff btw