What an awesome little game Replicube is. It’s like Picross 3D meets shader programming. The puzzles are a fun challenge and the interface is charming. Thanks @walaber! https://t.co/KtrCIxlQLp
@amugnolo@pragdave That’s a great article, thanks for sharing. I basically code in a similar style that Dave does here. Create modules with class methods for the behavior. Use classes/objects as bags of data with minimal logic.
90% of the Ruby code I’ve written the past few years has been class methods without shared state. The code has clearer dependencies and is easier to read, test and maintain. OOP has its place, but I don’t think it fits the majority of web-app logic.
@MorriceGavin@ismasan I generally don’t follow the functional core approach. Having a pure method is great, but I don’t go too far out of my way. I find most web apps rely so heavily on the database that a functional core leads to a lot of layers and indirection. I don’t like layers.
@MorriceGavin@ismasan Exactly, those dependencies are very clear. You can see what is being called and follow them. It’s also easy to reverse-lookup to see what is calling a given method.
@gagsdfhy There is some repetition but it isn’t bad with the Ruby shorthand for named arguments. I thought this would be a bigger issue but it really isn’t.
@mahdix I’m actually not the greatest fan of functional programming either. I’m fascinated by it but the constraints are a little too much for me. I often find functional code harder to read and follow compared to a more procedural style.
Whenever you’re tempted to reuse a method that *almost* does what you want: Stop, duplicate the method, make the modifications, and then refactor the actual duplication.