Skip to content
This repository was archived by the owner on Mar 19, 2019. It is now read-only.
This repository was archived by the owner on Mar 19, 2019. It is now read-only.

Improve the developer experience of using cortex #4

@Lawouach

Description

@Lawouach

With the recent mapping in TS of the model entities and relationships, we now can nicely tests and that's a great win.

However, much like path expressions are direct translation of the model behind it, the TS interfaces are very much coupled to cortex too. For instance, to send a DM when a Kube pod failed, this is what we need to write in the handler:

const pod: Pod = event.root()
pod.uses().isTagged().onCommit().author().of().hasChatIdentity().id()

which can unfurl to:

const pod: Pod = event.root()
const container = pod.uses()
const tag = container.isTagged()
const commit = tag.onCommit()
const author = commit.author()
const person = author.of()
const chatIdentity = person.hasChatIdentity()
const chatId = chatIdentity.id()

Although this looks more readable, it's not really intuitive nor transparent:

  • an user doesn't know the model
  • some things make sense in a graph theory point of view but their reality in the TS programming model are not intuitive. I mean, you expect person.hasChatIdentity() to return a boolean but it returns an object.
  • the developer experience suffers from this I believe. Also, the risk is that the model cannot change without all the depending rugs to be updated.

I think we should benefit greatly if we created a TS interface that makes sense for the user and transparently map those calls to what the model requires. For instance:

pod.project().channel().id()

This really makes more sense and abstracts away the model. This can be TS only building on top of the cortex interfaces.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions