DEV Community

Chris
Chris

Posted on

Experience with rewriting a complete application

Hello friends of programming,

in this post I am going to tell you my experiences of rewriting a working application from scratch.

But first, which application?

I have done a lots of work for my tool for the Remarkable tablet called Slithin. But there were some problems. I have not known that the application would be so complex and big. So I started programming without any plan. Later there were some problems and I have decided to use an IOC-Container to fix the dependency hell. But for some reason now there are such a big amount of code smells from the old synchronisation algorithm that cannot be easily removed and the dependency problem is not complete solved.

Because I have worked most of my time on my programming language I leaved the focus on this project but since I had the idea of making a framework for modular applications I had decided to rewrite Slithin with my custom framework. The application structure is now modular. You can simply replace them and they are seperated by other modules.

But what is a module?

A module consist of two assemblies. One for the logic and the other for the models. A module can register services that other modules can interact with but it can also invoke custom logic with a OnStart method.

Modules can communicate without any dependencies. Every module has an Inbox and an Outbox to send/receive messages. You can simply send data or trigger some actions on specific kind of messages. So modules can be loosly coupled.

A module can also have sub-actions that can be scheduled. A module can invoke for example writing the log cache to file every 10 minutes.

Because the modulesystem is so flexible you can create a model to specify the contract you can implement different modules for different providers like different databases.

The framework has some loosly coupled services/modules implemeted by default for example for logging with different logging frameworks.

So back to slithin:

Slithin has now only a bootstrapper executable that loads the modules and start them. Each functionality is now splitted into it's own module. The userinterface, the file synchronisation, the communication with the device and the communication with the filesystem for example. This modularity gives the opportunity to handle dependencies easily. The only thing I have to think of is which modules have to be loaded first to register the services that other modules need.

I have learned so much with this project and for the future I am going to make a plan for new applications (requirements and code architecture).

If you want to take a look here are the repositories:
Slithin

AuroraModularis - framework for modular applications

This was my little story.

Top comments (0)