You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The question is how to handle the following cases with declarative object design:
A constructor parameter is a resource which we don't want to capture for unknown time, like a Cursor
We need to evaluate eagerly on a background thread before passing the object to UI thread
My only idea to handle it in the declarative object design approach is to have an Evaluated decorator for each type which would evaluate the 'properties' in the constructor. (So it can mostly only apply to types with methods without parameters.)
Any other solution I suppose would involve some other type/construct/pattern other than just declaring and decoration. I don't know what that would be. But in order to keep this declarative approach coherent and applicable ubiquitously in our code bases, I think this Evaluated decorator could serve this purpose. This means of course that they would be exempt from the no code in the constructor rule. Although, that code would never be meaningful logic, just caching values eagerly.
@dmfs What do you think? Would you accept a pull request for this?
If you didn't approve the idea, do you have any other way in mind how these cases can be handled?
The text was updated successfully, but these errors were encountered:
The question is how to handle the following cases with declarative object design:
Cursor
My only idea to handle it in the declarative object design approach is to have an
Evaluated
decorator for each type which would evaluate the 'properties' in the constructor. (So it can mostly only apply to types with methods without parameters.)Any other solution I suppose would involve some other type/construct/pattern other than just declaring and decoration. I don't know what that would be. But in order to keep this declarative approach coherent and applicable ubiquitously in our code bases, I think this
Evaluated
decorator could serve this purpose. This means of course that they would be exempt from the no code in the constructor rule. Although, that code would never be meaningful logic, just caching values eagerly.@dmfs What do you think? Would you accept a pull request for this?
If you didn't approve the idea, do you have any other way in mind how these cases can be handled?
The text was updated successfully, but these errors were encountered: