calrissian / mango

Common utilities for rapid application development
Apache License 2.0
17 stars 7 forks source link

BaseEvent's timestamp should be stored as a regular attribute #176

Closed cjnolet closed 9 years ago

cjnolet commented 9 years ago

This would make the event interoperable as an entity but could impose some confusing restrictions on its use. I'd like to get this in a pull request to optimize it first.

cjnolet commented 9 years ago

Still going back and forth on this one- in one case, it allows an event to act exactly as an entity and be placed in all the entity stores. In another case, it adds complexity, more possibility for bugs, and lowers the performance a tad (more housekeeping operations that involve copying immutable structures to change them, etc...).

eawagner commented 9 years ago

I tend to agree. Maybe instead of making the timestamp always an attribute, you could make a utility function, that does the work of adding the appropriate attribute only when you actually want to use it.

My biggest concern with that approach however, is that you have to know that you always need to convert to/from an event whereever do that. So my idea isn't the greatest, but hopefully will trigger another idea that would be a better alternative to always treating the timestamp as a specialized field at the domain object level.

cjnolet commented 9 years ago

Yes. I share your concerns about the second approach as well- There are too many things that go wrong and put the event into an inconsitent state.

I think maybe we should close this PR for now and keep the branch around just in case we find a use for this at a later time.

The other thing to note is that doing this still would not allow the graph store to be any more accessible to storing events because the timestamp is part of the event's identifier. If the type/uuid are only being used then the event is not being indexed consistently with other stores (therefore the properties of uniqueness are not going to be the same and users will get confused).

On Sat, Mar 14, 2015 at 1:16 PM, eawagner notifications@github.com wrote:

I tend to agree. Maybe instead of making the timestamp always an attribute, you could make a utility function, that does the work of adding the appropriate attribute only when you actually want to use it.

My biggest concern with that approach however, is that you have to know that you always need to convert to/from an event whereever do that. So my idea isn't the greatest, but hopefully will trigger another idea that would be a better alternative to always treating the timestamp as a specialized field at the domain object level.

— Reply to this email directly or view it on GitHub https://github.com/calrissian/mango/issues/176#issuecomment-80602891.