Skip to content

Conversation

@aslakhellesoy
Copy link
Contributor

do not merge - this should stay on a branch. the purpose of the PR is just to gather feedback

I wrote this to get more insight into patterns that can be used for push and collaborative applications.

I've refactored the codebase to turn this into a real-time collaborative TODO app. The real-time infrastructure is based on Automerge - a JSON CRDT, using plain HTTP POST and EventSource for communication. To simplify some of the plumbing, I've introduced a small Automerge helper library.

This introduces some architectural changes:

There is no longer a HTTPTodoList, as HTTP is no longer used to
transport TODOs, but Automerge CRDT messages.

The DataBaseTodoList has also been removed, as its API no longer
made sense in the context of collaborative editing. It may be
reintroduced later.

MemoryTodoList is renamed to TodoList and is now part of the
application. There is one instance in each client, and one in the
server. Automerge takes care of synchronising them all.

The Cucumber step definitions have parameter types for the
context/action/outcome todo lists.

The scenarios have been changed to introduce people, allowing us
to express the collaborative nature of the application.

This introduces some architectural changes:

There is no longer a HTTPTodoList, as HTTP is no longer used to
transport TODOs, but Automerge CRDT messages.

The DataBaseTodoList has also been removed, as its API no longer
made sense in the context of collaborative editing. It may be
reintroduced later.

MemoryTodoList is renamed to TodoList and is now part of the
application. There is one instance in each client, and one in the
server. Automerge takes care of synchronising them all.

The Cucumber step definitions have parameter types for the
context/action/outcome todo lists.

The scenarios have been changed to introduce people, allowing us
to express the collaborative nature of the application.
@aslakhellesoy aslakhellesoy requested a review from joshski October 18, 2017 06:51
Copy link
Contributor

@joshski joshski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!


Given('there is/are already {int} todo(s)', async function(count) {
const todoList = await this.contextTodoList()
Given('{contextTodoList} has added {int} todo(s)', async function(todoList, count) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a nice solution to the "choosing the right todo list" problem 👍

this._truncate = true
const todoListCollection = new TodoListCollection()

// TODO: Start in Before, make factory methods sync
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants