At Synetec we have a passion for technologies and love breaking our comfort zone by learning new ones which benefits to upskill the engineers but also helps the company to move forward. We make sure that we can keep on track with our clients’ requirements.
This article exposes a real-life example. We are currently working on a project which consists of improving an old application written with Web forms. The big challenge at the beginning of the project has been to find a way to write a solution that we could deliver in a short period of time without rewriting the entire application. The approach was obvious, we had to rewrite step by step the application by extracting one responsibility at a time. For that we had to think about the technology to use, a technology that all engineers would be able to maintain and also a technology that wouldn’t need to be changed in a year’s time. .Net Core has been the chosen one for different reasons:
• .NET Core is one of the newest technologies therefore it brings better performances due to the code optimisation at compilation
• Less code is needed which means more readable by other engineers.
• Less code means that the application is easier to maintain
• .NET Core is cross platform. You can now use Microsoft technologies to write application for any device on any platform
• .NET Core is Open Source which means that any developer can contribute to improve the language anywhere in the world
Great we will write a .NET Core Api for various reason. Here are some points that motivated our decision:
• An Api can be consumed by any other application so it allows the features to be reusable
• We can have a better separation of concern. The front-end part of application should be separated from the back end and the back end should be composed of several modules each handling one responsibility
• With an Api first approach it can massively help a business diversifying its activities. With a good design it can help to build a good product base
• Once the application up and running it is a lot easier to add new features
The language is not everything though. A technology like .NET Core is not enough to build an amazing application. You have to think about your architecture as well. We deal with more and more data every day which is the reason why it is really important to make sure that you can write a scalable application. It is a way easier to improve and adapt an application created on solid foundations (without any bad wordplay ) .
We had to think about the architecture of the new Api carefully. The decision made was to implement a unit of work on top of a generic repository pattern. The reason is that the application is highly transactional and the unit of work is a good pattern for that kind of application. As for the generic repository it is a great way to bring an abstraction between your data access layer and your business logic.
As explained earlier in the article the project is an upgrade of an existing application which means that the data model is already existing. It was then a no brainer that Entity Framework Core was the way to go for the data access layer as it allows to create your entities with a simple line in a command prompt.
All the technologies listed in this article would each deserve at least a book so it is not possible to talk about them in details but don’t worry more will come where each will be detailed so make sure you follow us to receive our latest news.
As a conclusion we would just give a simple piece of advice “make sure to understand what you want to achieve with your application”. Answering the later question will definitely help you making the right decision.
Written by Tarik Miri