Hacker News new | past | comments | ask | show | jobs | submit login

I do OOP extensively, and I rarely allow methods to mutate the object. Whenever I have an "is => 'rw'" declaration in my code, it is always immediately followed by a comment along the lines of "XXX: hack". I always feel bad, because it is rarely the right solution.

Even when my data structures are completely immutable, I don't consider myself to be doing "functional programming". I consider it "avoiding stupid bugs".

(As an aside, when using an object database, I am a bit more liberal. You shouldn't need to rewrite every object in the system when a user changes his password, after all. This does come at a cost, though; there is no way to "go back in time" and find an old object graph. There is the current one, and that's it; hope you didn't mess it up...)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: