User loginNavigation |
Functional Object-Oriented ProgrammingI've been experimenting, in Ruby, with something that we may loosely call 'functional' object-oriented programming. I write objects with non-mutating methods -- basically, these objects are stored 'requests' of a certain type. Various values can be derived from the request on demand. If I ever decide to implement caching, well, that wouldn't be functional but it's hidden from the user. Whenever I need actual state in my application, I make sure to split it out from the classes. Instead, I pass stateful information from method call to method call until the result is complete -- saving myself the hassle of state-tracking and so forth. I'm sure there is some efficiency penalty for this approach, though it makes my life much easier (and more reproducible!). There is a similarity between what I am doing and 'continuation passing style' though I can't quite place my finger on it. What do you all think of this style of "functional object-oriented programming"? There are quite a few approaches fucntional object-oriented programming out there already, like FOOPS and Object-Gofer; but these proposals are about faking object-oriented semantics -- a stateful object -- with monads. By Jason Dusek at 2007-05-03 17:56 | LtU Forum | previous forum topic | next forum topic | other blogs | 13876 reads
|
Browse archives
Active forum topics |
Recent comments
22 weeks 6 days ago
22 weeks 6 days ago
22 weeks 6 days ago
45 weeks 12 hours ago
49 weeks 2 days ago
50 weeks 6 days ago
50 weeks 6 days ago
1 year 1 week ago
1 year 6 weeks ago
1 year 6 weeks ago