Focus on business value: Open source framework vs. building your own

Before you build your own framework, you should read this.

Previously,  we discussed whether or not to even use a framework at all – and explored how often you may already be using a large variety of them without even questioning it.

But now, we’re digging deeper into the advantages of using an open source framework like the Axon Framework (AF) as opposed to building your own framework to support Command Query Responsibility Separation (CQRS) and Event Sourcing (ES).

Choosing a framework does not have to be forever

Before we really get into it, let’s dive into a major concern often associated with using a framework – especially in the instances of applications that are expected to last a long time. What happens if the framework being used no longer serves your needs – or worse, what happens if it’s no longer maintained?

That’s a valid question.

Axon Framework minimizes these concerns by looking at the way the framework code integrates with your own code.

The parts of your application that contain business logic receive limited impact due in part to the fact AF largely operates through annotations, which can easily be removed, still leaving you with usable code.

For example: when looking at a typical implementation of an aggregate with AF, you’ll notice when you remove Axon’s annotations, you’re mostly left with a clean command model. As such, AF shapes your code to a limited degree, leaving you with more agency to do so when integrating Axon into it. 

There is one difficulty, however.

When removing a framework such as Axon from your applications, you’ll need to replace all of its functionality with something else – most likely a DIY framework. That brings us back to the core topic of this blog: Should you build your own CQRS/ES framework or simply use an existing one?

Smoothen your DDD, CQRS, and ES journey with our open source framework

For some, the theories behind Domain-Driven Design (DDD), CQRS, and ES may be very familiar from years of working with them. Those individuals likely won’t need much guidance in implementing this.

But if you’re one of the many who’ve just started your journey in this space, some of these concepts may be difficult to grasp since they are different from what you are used to.

Insert Axon Framework once again. AF can assist you here by providing the tools to implement these concepts without worrying too much about the details initially – allowing you to focus on the application’s business logic. Once you advance your knowledge and experience, the open-sourced nature of AF provides a great deal of flexibility for tweaking this behavior. This way, it can actually reduce the learning curve for developers new to these designs and methodologies, despite the need to learn the framework.

But even if you’re already very experienced with DDD, CQRS, and ES, you’ll probably realize building your own framework is time-consuming. The basics may come quickly, but advanced requirements can lead to more and more time spent on the development and maintenance of just your own framework. 
In these cases, relying  on others to deal with all these complexities can be a more efficient option, which has been the mission of  Axon Framework for years – enabling you to spend more time on the parts of your application that actually do add business value.

open source framework

You’re not alone, learn from others

That all said, no framework is perfect for every single use case, and there may come a time when you need help. Perhaps it’s some trivial configuration tweak; perhaps it’s a larger customization of the framework – afterall, AF is an open source framework, so you can bend it to your will.

If and when that time comes, with a DIY framework, you’d have to rely exclusively on the knowledge inside your own organization, while AF provides two additional paths you can take.

With AF being a popular open-source framework with millions of downloads, we have a pretty massive community of users. Numerous questions and customization requests pour in daily. For that, we thankfully have platforms like AxonIQ Discuss. Crowd-sourced knowledge forums like that can greatly simplify your journey.

But sometimes, you may want further support. That’s why we at AxonIQ offer additional support when needed, both in the design of your applications as well as in the usage of Axon Framework (and Axon Server). We have years of experience working with everyone from small startups to some of the world’s largest corporations, helping them become successful in their project endeavors.

open source framework

Leverage an extensive feature set

The reality is that the longer the lifespan of your application, the more likely it’s going to demand additional requirements, especially inside your core domain where applications tend to become larger and more complex than applications in your supporting domains. This can range from improving the loading times of your aggregates following an increase in events to be consumed when rehydrating them, to tweaking how you consume events to scale your query model, to customizing error handling for your event handling, and beyond.

A DIY framework will need additional support to be built for each of these features when the time comes. And you know how it always goes: you will be able to do so given enough time, but often this functionality needed to be ready yesterday.

That’s where the features of AF can spare you a headache and lots of useful time. We’ve seen it all throughout the years, and thus, we’ve incorporated the vast majority of functionality you’d need such as snapshots, event processor configuration, distributed message handling, and cryptographic erasure of event data through the Data Protection Module, and more.

Should you not need any of this, then you can forego these features entirely and simply work with the core of the framework alone.

open source framework

Seamless integration with your Event Store and messaging infrastructure

A final infrastructure component on which we can all agree that you shouldn’t build yourself, is the Event Store. We, at AxonIQ, recommend you use a dedicated solution for this, such as Axon Server.  You can always build your own connector to this event store, but the integration between Axon Framework and Axon Server is seamless and does not require any code or configuration – which again, saves you valuable time that can be refocused on adding business value.

You’re not done after writing your own support for the publication and consumption of events in your DIY framework either, since communication consists of more than just events. How do you use this to route a command? Or a query? These other types of messages require different routing strategies, so for these we cannot entirely reuse the code we wrote to handle events. Once again, AxonIQ has you covered, both through AF and through AS, the latter of which isn’t just an event store, but also a dedicated message router.

Conclusion

Circling back to the central question of this blog, should you use a custom-built or simply use an open source framework?

It’s virtually impossible to provide a definitive answer to this since all cases are so unique, but we can say this: choosing to work with the purpose-built Axon Framework to build your DDD, CQRS, and ES application over building your own framework can provide a great return in value.

Axon Framework can reduce the learning curve for new developers, reallocate precious time for adding business value, capitalize on its extensive feature set, and provide various resources when you come across a technical challenge. Furthermore, you can further simplify your infrastructure, configuration, and life by seamlessly integrating it with Axon Server.

Again – nothing’s perfect, and everything comes with a list of pros & cons, but the way we see it: time’s the only resource you can’t get back. Save it and choose a purpose-built framework like Axon. 

 

Christian Vermorken
Software Engineer. For Axon Framework and an advocate for DDD, CQRS and event sourcing. Christian advocates the event-driven approach to free up organisations to focus on working for their customers.
Christian Vermorken

Share: