Support chat for http://getprooph.org/ - official announcement: https://www.sasaprolic.com/2018/08/the-future-of-prooph-components.html
prolic on v1.10.3
prolic on master
update changelog (compare)
prolic on master
fix restarting projection durin… respect lock in memory resetting projection and 12 more (compare)
Hey, I'm thinking about a revival of prooph/event-sourcing but in a totally new way and it would be nice to get some feedback regarding the idea:
@sandrokeil had the idea to create a plugin for Cody (https://youtu.be/0FAgsPNqUV4) that generates framework agnostic domain model code: aggregates, value objects, messages, handlers, ... from a prooph board event map.
One reason to abandon prooph/event-sourcing was that it creates a framework dependency in your business logic. Something you don't really want. So instead you should use the package as inspiration only. But what if you could have a code generator, that generates all the glue code for you in the namespace of your choice?
One can then connect the result with the framework of their choice. We think about prooph/event-store and Ecotone packages that can be used in combination to also generate framework related glue code (e.g. repository implementation, PHP8 attributes for Ecotone, ...)
Would you be interested in such a package?
@darrylhein good point. The context is super important. For companies with multiple teams all working with the same basic set up and maintaining software over a long period of time, framework decoupling is much more important than for smaller single team projects. A framework often influence the way how problems are solved in code. what works good today, can become a huge problem tomorrow when you want to scale (technically and in teams size)
Another good reason for decoupling is much cleaner business logic that is easier to understand and change over time.
But a framework agnostic domain model means:
more glue code required to make it work with your current framework of choice. But if you automate glue code generation as well as parts of the domain model code itself then you have a win-win situation.
if it is possible to have a generator that can update the code with my changes mixed in later, I'd probably be more interested
that's actually the case. It works like rector or a code sniffer. In rector you have those rules to upgrade parts of the code to a new PHP version. It also modifies your code without destroying it. Cody can do the same. If a VO exists already, Cody does not touch it! But if you want to add a new interface and/or method to all VOs, Cody can easily do that while keeping the original implementation in place.
we are maintaining a single low-time project (ever since starting to use prooph :)), so no need to upgrade multiple things, just making sure things keep on running / evolve with least effort :) ( Also, no hostility meant, I am being honest but not judging, there absolutely is a value of what you suggest)
when I talk about magic, I mean magic in code. I like stupid code. I like obvious code. I spent way too much time of my life debugging / figuring out why something magically does not work (any kind of magic routing / loading / ... ). I prefer repetitive over magic.
When we (team) implement new features, the basic setup is the stuff that takes the least time. Setting up read models / projections is what takes the most time (although repetitive but way more time consuming). That's the place where I personally would like to cut effort (esp since we use json functions and these are a PITA).
@silviuvoicu
maybe not just some opinionated suggestion are what you need, but also an mvp, working example, you know, go to your customer and ask/communicate with them :), either company or developers.
yeah, that's the point.
We're in direct exchange with our customers and we demonstrated one real world result of what is possible with prooph board + Cody in a live demo session at EventSourcing.Live last year. BTW the recording is now available on youtube: https://www.youtube.com/watch?v=lKB8-l9MEvs
There you can see the potential incl. fully working FE and BE code generation.
We could release the Cody implementation used in the live demo as an example. But my fear is that people would think it's the only way to work with Cody:
Cody itself is an API. It gives you access to your design on prooph board. Now it is up to you, what you want to do with that information. Generate some boilerplate code, scenario tests or a fully working low-code platform.
Is this too low-level for developers? Because it requires too much learning effort?
I'd love to share the excitement with you. But I try to figure out what would be the best way to do that.
Validation:
We translate metadata on prooph board to JSON Schema. I've skipped validation in the video to save some time but here are two examples from the same app:
{
"shorthand": true,
"ns": "/Common",
"voNamespace": "/Common",
"schema": {
"userId": "string",
"givenName": "string",
"familyName": "string",
"roles": "/Common/Roles",
"email": "string|format:email"
}
}
It's metadata for a UserInfo
VO. As you can see the shorthand version of json schema is used (our own creation, we have a translator to real json schema) and we can type hint properties with definitions (other VOs in the code) and define json schema validation like "email": "string|format:email"
{
"shorthand": false,
"ns": "/Expose",
"voNamespace": "/Expose",
"schema": {
"type": "string",
"pattern": "^((eigentumswohnung(en)?-)|(condominiums-))[üäöÜÄÖßA-Za-z0-9-]+$"
}
}
how do you handle logic?
As mentioned by @sandrokeil the code generation layer is designed in a way that it can modify existing code without breaking it. Thanks to PHP Parser AST. That said, the goal is not to define everything on prooph board. You design the flow of information, document structures and responsibilities. But business logic insight aggregates or read model logic insight projections is still done by the developer. Cody supports developers with boring tasks. It's a code monkey :) You should really try it! It's so nice to have all the boilerplate in place and just focus on the challenging parts like complex aggregate logic. Messages, VOs, API all ready to use. And the documentation is already in place! And can be used as a starting point for the next design iteration! All the litte things add up quickly to huge time saver. It's not only the one hour saved, by not writing boilerplate code by hand.
The feature in the video works out-of-the box because the Cody implementation used is designed for Event Engine and it generates some common defaults that make it possible to have the whole thing working without touching the code itself. But others features of that app also have hand written parts in use.
how does the board handle "branches"
above you see a feature tagged as "planned". It appears yellow on the board. That's how we design new features in an existing system. We also mark changed information or messages with hot spots and write down what will change.
I know the code generated is on our git, but it still breaks established workflows. any plans to bring the board as a self-hosted / run version?
Two things:
And yes, we also offer self-hosted options. But they are more expensive.
ideally as something I can define as a dependency on the project and start like "any other code generator" (just with a graphical UI instead of CLI).. running locally also would be preferred from a security & confidentiality perspective
@fritz-gerneth That exists! Cody is open source and can be installed via composer. The free version of prooph board is hosted on github and requires no login at all! Everything that you do there happens only on your local machine within your browser. You can import/export boards etc. But without the SaaS version you cannot collaborate with your teammates (yet). We're working on making that possible in the free version as well. That should become available at some point in this quarter, but will have limitations. We still want to earn some money with the SaaS version :D
The free client is available here: https://free.prooph-board.com
@fritz-gerneth if you really want to try Cody, let me where you need support. A good starting point is the tutorial:
https://wiki.prooph-board.com/cody/php-cody-tutorial.html
It covers the absolute basics. @sandrokeil could support you in exploring the "Open Code Modeling" stuff and we could open source the Event Engine implementation shown in the video if that is of interest as well. But this is highly opinionated :D
just released: https://github.com/prooph/event-store/releases/tag/v7.7.0
special thanks for @gquemener and also thank you @netiul for reminding me to take care of this.
spread the word!