Becoming a software developer – episode IX

Becoming a software developer – episode IX

Welcome to the ninth episode of my course “Becoming a software developer”, which is the beginning of creating HTTP RESTful backend application based on ASP.NET Core framework.

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


 

Scope

  • Overview
  • Architecture

Abstract

Overview

We’ll be creating the web application which acts as an HTTP RESTful API that can be understood as a gateway to our whole system. We won’t focus on the front-end part at all, instead, we’ll build a web service API that can be consumed literally by and end user able to perform HTTP request (web application, mobile or desktop application and so on).
Application will be based on the latest version of ASP.NET Core framework, that is great choice either for creating HTTP API (like we will) or also the web applications that can return HTML views (by using Razor engine). During the course, we will explore both features and possibilities that are baked into this powerful framework.

Application is named Passenger, and it will allow e.g. to register a new driver, that goes from point A to B (for example to his workplace) and there will be passengers, who can ask a particular driver to pick them up at the specific location, and if he accepts their requests, all of them will share the same vehicle in order to reduce the costs related to travelling.

Source code will be available at our GitHub repository, thus you need to have a very basic knowledge of using Git in order to get the latest version of source code. Alternatively, you can click on the “Download ZIP” button in order to get the latest changes without using Git at all.

We will use a built-in issues and the extension named ZenHub in order to have a board that will help to organize the list of tasks and we will also use the so-called smart commits containing messages referencing to the particular tasks by their identifiers (e.g. “Fixed user service #15”).

Architecture

We will make use of the Onion Architecture which may look difficult at the first sight, yet it’s actually simple and still sophisticated enough in terms of layering, maintainability, extensibility, loose coupling and high cohesion. We will apply some of the core concepts of Domain Driven Design (DDD) and other good patterns and practices, that can be successfully used whether you’re building the small or large-scale applications.

Passenger projects structure.

Passenger projects structure.

  • Passenger.Api – actual HTTP API based on ASP.NET Core. References Infrastructure.
  • Passenger.Core – core which is the actual domain of our application. Does not reference any other project.
  • Passenger.Infrastructure – application services, implementation of domain models, repositories and so on. References Core.
  • Passenger.Tests – unit tests.
  • Passenger.Tests.EndToEnd – integration tests.

Resources

Next

In the next episode, we’ll create our first domain models, repository, application service and a simple controller returning the user account.

15 Comments Becoming a software developer – episode IX

  1. Pingback: Becoming a software developer – episode IX – Patryk Huzarski | Personal Blog

  2. Pingback: Dew Drop - March 23, 2017 (#2446) - Morning Dew

  3. Pingback: Wzd #3 – Daj się poznać – Daj se spokój – Wojciech Guzik | blog

  4. Johny

    Gratuluje!! Oglądałem wiele kursów ale ten jest jedyny w swoim rodzaju! Od zawsze szukałem właśnie takiego startera do porządnego programowania!

    Rozważasz w przyszłości możliwość rozszerzenia grona osób mogących robić commity do projektu? Mega zazdroszczę Patrykowi takiej szansy.

    Pozdrawiam.

    Reply
    1. Piotr Gankiewicz

      Dzięki, super słyszeć :).
      Wiesz co, niestety nie dałbym rady ogarnąć większej ilości osób, musiałbym chyba nie pracować i po prostu sprawdzać kod innych, a na to niestety nie mogę sobie aktualnie pozwolić.
      Pozdrawiam

      Reply
  5. Paweł

    Ekstra sprawa! Zgadzam się w całości ze wszystkimi powyższymi komentarzami. Idealnie wpasowuje się w to co wiem, czego szukam i co chcę poznać, a nie umiem ogarnąć samemu 🙂 Fantastycznie, to co robisz dla całego community jest najwyższych lotów. Już się nie mogę doczekać kiedy pochłonę całość, a widziałem, że w planach jest płatna Aurelia. Jak na razie mogą dla mnie nie istnieć żadne seriale haha:) Przy okazji – Aurelia operuje na podobnych rzeczach co Core, z tego co do tej pory ogarnąłem (ale nie dużo tego było). Jeszcze raz – świetna robota!
    PS. Tak myślę, że gdyby pod epizodem był button do następnego odcinka, to by uprzyjemniło flow, bo youtube nie do końca tak działa.
    pozdrawiam

    Reply
    1. Piotr Gankiewicz

      Dzięki za bardzo miły komentarz, na dobry serial też warto znaleźć trochę czasu ;).
      Odnośnie przycisku pod koniec filmu to faktycznie ma sens, w razie czego wszystko jest na “playliście”. Co do Aurelii – to tak, aktualnie mój ulubiony framework i w sumie jest trochę podobieństw :).

      Reply
  6. Sebastian

    Witam serdecznie
    Jestem początkującym programistą i pewnie dlatego już na samym początku spotkałem się z problemem. Postępując zgodnie z Twoimi instrukcjami utworzyłem odpowiednią strukturę katalogów i plików przy użyciu yeoman generator. Zgodnie z instrukcjami zaimplementowałem zależnościw (w plikach .csproj). Następnie w kroku: dotnet restore (wykonane z katalogu głównego zawierającego poszczególne solucje) pojawia się komunikat:
    MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
    Jeżeli opis problemu daje taką możliwość to proszę o podpowiedź gdzie szukać rozwiązania.
    Pracuje w środowisku:
    Windows 10,
    Netcoreapp1.1,
    Netstandard1.6.
    Pozdrawiam

    Reply
  7. Bartosz

    Cześć,
    mógłbyś zrobić jakąś aktualizację do .NET Cora 2.* w formie wpisu lub video z tworzenia projektów, najlepiej z dodatkowym opisem plików które się tworzą, bo obecnie struktura plików różni się od tej opisywanej w video, a nie jestem pewny czy yo aspnet tworzy projekty z aktualnymi wersjami pakietów. Ogólnie to nie wiem dokładnie jakie pliki do czego służą i co znaczą wpisy w nich zawarte.
    Przykładowo w pliku *.Api.csproj mam wpis:

    netcoreapp1.0

    który rozumiem, że używana jest wersja 1.0 .NET Cora, a w pliku global.json również jest chyba powtórzona ta informacja:
    {
    “sdk”: {
    “version”: “1.0.0-rc4-004771”
    }
    }
    i trochę tego nie mogę zrozumieć, dlaczego w dwóch miejscach jest taka informacja i co w przypadku jeśli chciałbym np. zmienić wersję to w którym pliku ją zmienić.
    I teraz jeszcze zauważyłem, że w projektach np Infrastructure (yo aspnet -> Class Library) w plikach *.csproj jest wpis netstandard1.4 zamiast netcoreapp1.0:
    netstandard1.4
    Wiem, że to trochę dziwne ale nie daje mi to spokoju, gdy widzę różne dziwne rzeczy których nie rozumiem lub nie zgadzają się z tym co widzę w kursie.
    Pozdrawiam

    Reply
    1. Piotr Gankiewicz

      Cześć, w .NET Core 2.0 wszystko tworzysz poprzez dotnet CLI np. nowy projekt typu WebAPI za pomocą dotnet new webapi, a to co zostało nagrane dotyczyło poprzedniej wersji platformy.

      Reply
      1. Michał

        Cześć!
        Mam identyczną sytuację jak opisuje Sebastian. Jak rozpoczynałem kurs to zainstalowałem .NET Core 2.0 i na tym odcinku zaczęły się problemy z przejściem do dalszych etapów kursu. Zrozumiałem, że winą może być wersja .NET Core, więc odinstalowałem 2.0 i zainstalowałem .NET Core SDK 1.0.1 z nadzieją, że teraz będę mógł w 100% odtworzyć przebieg kursu. Utworzyłem poszczególne projekty zgodnie z filmem, ale nadal mam sytuację jak opisana przez Sebastiana. Piotrze, czy możesz podpowiedzieć w jaki sposób obecnie można powtórzyć wszystko zgodnie z nagranym kursem? Yeoman obecnie tworzy inny szablon plików w projektach i nie wiem jak to rozwiązać… :/

        Reply
        1. Piotr Gankiewicz

          Tak jak napisałem powyżej – po prostu tworzysz projekty za pomocą dotnet new np. dotnet new webapi -n Passenger.Api, a referencje i całą resztę dodajesz po staremu. Używaj .NET Core 2.0 i będzie ok, poza tym nie ma większych zmian.

          Reply

Leave A Comment

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