Getting a better understanding of the Event Sourcing mechanics by implementing them from scratch.
- In a programming language of your choice, implement one of the following use cases (or your own)
- Implement and use event sourcing to record state changes.
- Provide a working, self-contained code example that uses your implementation
to build a contacts list with some contacts in it, for example as
- A CLI script
- A dynamic CLI application
- A test suite
- Provide a README with instructions on how to run the example. Don't assume that everybody has the programming language installed on their Computer or knows how to use the code example. A docker image is probably the safest choice.
Please note that these use cases and the proposed features are meant only to give you an idea on what could be required - they are not required in the scope of this challenge. Remember: this is for you, not for anybody else!
Imagine that you want to manage a club (or a company) and want to track changes that happen with an within the club, for example:
- A club can be founded, and there can be more than one club.
- A person can apply for membership in a club.
- A person can be approved or denied a membership.
- A membership can be terminated, by the club or by the member.
- There can be different kind of memberships (e.g., free, paid, sponsored) and each kind of membership has different perks.
This use case has been suggested by Kasey Speakman on dev.to.
Your college wants to manage its students and courses and asks you to create an application that handles, for example, the following features:
- The college provides courses.
- A course is held in the scope of a semester.
- A course has dates in a week on which it is held.
- The same course can be held in multiple semesters.
- A student can attend and withdraw from a course.
- A student receives a grade after completing a course.
- A student receives a grade after completing a semester.
- Course grades are factored into the final grade, but also the number of courses that students have attended or withdrawn from.
Imagine you want to manage a business contacts list and want to track relevant changes of a person or company, for example:
- A contacts list is a collection of contacts.
- A contact is either a natural person or a company.
- A person has a name and can be renamed.
- A company has a name and can be renamed.
- A person can enter and quite a company.
- If a person is part of a company, they have a role in that company.
Do you have an idea for a use case? Then join us on Discord or create a new issue in the repo's issue tracker and let's talk!
- Anticipate questions from developers that don't know the language and language
concepts and try to avoid them
- Prefer being explicit over being clever.
- Don't be afraid of boilerplate code.
- Try not to use "magic".
- Use meaningful names for variables and methods.
- Use as many 3rd party libraries as needed and as few as possible.
- Try not to use a full-stack framework like Symfony, Laravel, Django, Spring Boot (see: "Don't be afraid of boilerplate code").
- Be as simple or sophisticated in your implementation as you want to be - the goal is for you to get accustomed to the mechanics of Event Sourcing, not to create the next LinkedIn :).
- Start your implementation with In-memory-persistence, try not to get diverted by abstraction layers.
- If you have questions about the challenge, are stuck or want to hang around with fellow developers, we'd be happy to have you on the kreait Discord!
(These agreements are mostly meant for the developers at kreait internally, but feel free to adapt them)
- Present to your peers what you did, how you did it and why you did it the way you did it.
- Your peers will ask questions, make suggestions, discuss concepts that they think you might have misunderstood - they will do this in good faith, don't take it personally, we are all here to learn and to teach.
- There will be no evaluation of a better or worse solution.
- There will be no judgment over the used programming language.
Language | Use case(s) | Repository |
---|---|---|
Java | Contacts App | bertilmuth/code-challenge-event-sourcing |
Please start your implementation in a fresh repository and fork this repository only for a later pull request to add a link to your implementation to the table above.
Happy coding!