Tag : ASP.NET Core (13)

Building Distributed Applications with Dapr

17.09.2023

Today, the development of distributed systems has become an increasingly essential need. However, due to the complexity of these systems, developing and managing such applications presents challenges for us developers. Matters like communication between services and state management are not easy tasks. This is where Dapr (Distributed Application Runtime) comes into play, assisting us developers.

Dapr is a platform designed to make developing distributed applications easier and faster. With its provided features, we can perform tasks like communication between services, state management, and event publishing/listening more effortlessly. It even simplifies actor programming.

Read more

Actor Model - Microsoft Orleans

17.09.2023
ChatGPT is used in this post to correct the text and make it more fluent.

Object-oriented programming (OOP) is based on four fundamental concepts. These are: encapsulation, abstraction, inheritance, and polymorphism. Of these, encapsulation is the most important. It means that the internal data of an object can't be accessed from outside.

Imagine a product object with a stock property. To decrease the stock, we will need a DecreaseStock method. The stock cannot be manipulated from outside, and will be decreased using the DecreaseStock method, which has business rules. But what happens if multiple threads enter the DecreaseStock method at the same time? No one knows how much stock will be decreased.

The reason for this is the shared memory problem, which is the biggest disadvantage of OOP. Of course, there are many ways and approaches to overcome this. The classic method is the locking mechanism, but since it is a very costly operation, it is necessary to avoid it. The Actor model not only saves us from the locking cost, but also allows us to develop in a distributed environment as if it were not distributed. But how does it do this?

Read more

Domain Driven Design - Tactical Patterns

27.10.2022

DDD is an approach for software that have high complexity. This approach eliminates the complexities within the process of developing software. DDD is broken down into two categories, strategical and tactical. Strategic pattern is the main component of DDD. But we will not be talking about strategic pattern in this post. Tactical Pattern deals with architecture. It is about how classes, methods and dependencies should be. So we can call it clean architecture. Lets start then.

Read more

Test Driven Development

30.06.2022
TDD Workshop

TDD Cycle

TDD tells that a test case should be written first, then the code should be written.

TDD is a cyclical process and includes three stages: RED, GREEN, REAFTOR. In the RED stage, a test case is written and executed. The test case fails. In the GREEN stage, first code is written for the test case to pass. The code doesn't need to be clean. The main goal is to write the simplest code for the test case to pass. The test case is run again. If the test is successful, the REFACTOR stage is started. At this stage, if the code can be refactored, it is done. The test case is run again. If the test case fails, the code is refactored. This cycle is continued until the code becomes desired.

Read more

What is Modular Monolith?

29.03.2022

Traditional Monolith

Firstly, let's talk about Traditional Monolith approach. This approach focuses on layers. It includes three layers, UI, Business and Data. All features in a project are vertically separated into these layers. Among those three layers, the business layer is the one that contains business logics of all features. Each feature knows business logic of other features, which is a fact we call tightly coupled.

Traditional Monolith
Read more

ASP.NET Core Feature Management

26.03.2022

Feature Management provides feature management in .NET Core applications. It allows the management and querying of the active / passive status of the features of the application. For example, you can ensure that a feature you have just developed is active in a certain date range. To give another example, you can ensure that a feature you have developed is active with a certain percentage. Like A/B testing.

Read more

Event Sourcing with ASP.NET Core - 02 Messaging

07.11.2022

1. Introduction

Since this article is second part of the article below, I recommend you to read the following article before starting. We will continue with the sample project in the article below.

Event Sourcing with ASP.NET Core - 01 Store
1. Introduction I recommend you to read the article below before applying this example tutorial. In the article I have mentioned above, I had formed…

In the previous article, we made the example of Kanban Board. By creating a RESTful API, we wrote the create, assign, move and complete endpoints. We recorded the requests coming to these endpoints as an event in the Event Store. So we focused on the store part of the Event Store. In this article, we will focus on with the messaging part.

We will include the following endpoint in our RESTful API endpoints.

[GET] api/tasks/{id}

Read more

Event Sourcing with ASP.NET Core - 01 Store

07.11.2022

1. Introduction

I recommend you to read the article below before applying this example tutorial.

What is Event Sourcing?
Previously, our services would be as follows. This service consisted of hundreds of lines of code. To get rid of this confusion, we split our…

In the article I have mentioned above, I had formed a sentence as follows.

In this article, we will deal with the store section of the Event Store. In other words, we will deal with the database feature where we can save events. In the next article, we will deal with the messaging part.

As an sample application, I chose the classic Kanban Board sample.

Our RESTful API endpoints will be as follows.

[POST] api/tasks/{id}/create
[PATCH] api/tasks/{id}/assign
[PATCH] api/tasks/{id}/move
[PATCH] api/tasks/{id}/complete

Read more

Couchbase GeoSearch with ASP.NET Core

26.03.2022

The subject of this article will be about how to do "GeoSearch" by using Couchbase.

1. Installing the Couchbase

For this purpose, we create Couchbase cluster with the docker by running the command below.

    docker run -d --name couchbase -p 8091-8094:8091-8094 -p 11210:11210 couchbase

When Couchbase is up, it will start broadcasting at the address below.

http://localhost:8091/

We create the cluster by clicking the "Setup New Cluster" button. We define the password as "123456".

Create New Cluster
Create New Cluster

You can make adjustment according to your current memory status. You can turn off "Analytics". We complete the cluster installation by clicking the "Save & Finish" button.

Read more

Publishing Docker Image as Serverless on GCP

12.07.2022

1. Introduction

With the serverless approach, the problem about the server that the software developer confronts with has disappeared. Now we write our code and call the provider to run it. We are not dealing with server configurations, scalings etc. And pay as you go. This is a great opportunity.

AWS's Lambda, GCP's Cloud Function, Azure's Azure Function etc., these services provide us this service. But this time, different kind of problem appears. These services do not support all languages. Even if it supports the language we want, it may not support the version we want. For example, AWS Lambda does not support the upper versions of .NET Core 2.1 yet. This is a problem. Nobody can restrict us :)

The Cloud Run service that Google built on Knative completely solves this problem. We give Cloud Run a docker image and Cloud Run runs our serverless service from this image. So whether we develop in PHP or .NET Core, it doesn't matter. There is no limit as long as we can make dockerize. This is awesome.

Read more
Made with ASP.NET Core