Becoming a software developer – episode XVII

Becoming a software developer – episode XVII

Welcome to the seventeenth episode of my course “Becoming a software developer” in which we will mostly talk about the boundaries and responsibilities of the application services. Eventually, we will implement some helper code to automatically assign the authenticated user id to the given command.

All of the materials including videos and sample projects can be downloaded from here.
The source code repository is being hosted on GitHub.



  • Boundaries
  • AuthenticatedCommand



Defining the boundaries of the application services is not an easy task. We have to keep in mind that accordingly to the SRP (Single Responsibility Principle) and ISP (Interface Segregation Principle) we should define our interfaces to revolve around the particular topic (e.g. managing users, defining routes, finding location etc.). If our service defines additional responsibilities, which are not a part of its scope, most likely we should implement a separate class.

Let’s take a look at the IDriverRouteService which is all about managing available routes for the drivers and passengers.

Even though the route requires the actual address (e.g. fetched from some specific API like Google Maps) and the distance between nodes in order to create a valid Route object, it does not do it on its own. Instead, it makes use of the available service defined as IRouteManager which exposes the required methods:

If our IDriverRouteService would require additional workflow that is not particularly tied to the route itself (such as fetching the address), we could simply define additional interfaces and inject them via constructor in order to extend the business logic.


Let’s say, we would like to have automatically assigned user id, whenever there’s a command which requires the user to be authenticated. It can be done easily in 3 steps:

At first, we need to create an interface which marks the given command as the one that requires user to be authenticated, and then we can implement a brand new DispatchAsync method that will assign the user id to the incoming request. Finally, we can use it like this:


In the next episode, we will write more and more business logic and also create a custom middleware for handling the exceptions.

6 Comments Becoming a software developer – episode XVII

  1. Pingback: Dew Drop - May 18, 2017 (#2482) - Morning Dew

  2. Bilal

    Is there an English version of those videos. I wish I understand your language but I’m sure the material is great.



Leave A Comment

Your email address will not be published. Required fields are marked *