Becoming a software developer – episode VIII

Becoming a software developer – episode VIII

Welcome to the eighth episode of my course “Becoming a software developer”, which does focus on the good patterns and practices used on a daily basis in the world of the software development.

All of the materials including videos and sample projects can be downloaded from here.


 

Scope

  • Good patterns and practices
  • Design patterns

Abstract

Good patterns and practices

There are a lot of good patterns in the world of the software development and I’d like you to beware especially of the following ones:

  • KISS (Keep It Simple Stupid) – whatever you do, especially when you write a code, tend to create the small and granular methods, do not name them or variable using meaningless names or single characters, focus only on what’s important and do not introduce complexity if it’s completely unnecessary.
  • DRY (Don’t Repeat Yourself) – if there’s a duplicated code (or whenever you see the same code in the N different places) it means that it should be refactored and put into a single class or method. By doing so, you will have just a single place that will need to be maintained (in terms of further development or potential issues).
  • YAGNI (You Aren’t Gonna Need It) – we, being the programmers quite often tend to think about the features that might be needed in the future. Not only this, but we tend to write a code, that is currently not needed (and probably won’t be needed for a long time, or maybe even at all). Remember to focus on delivering the features that are part of the current scope, cause the scope of the application tends to change rather often and you don’t want to spend time on something that will have to be completed removed later on.
  • SOLID – this one is big, as it stand for a 5 very important practices, which have been greatly covered by many articles and tutorials, so just take a loot at it on your own.

Design patterns

There are tons of patterns, and honestly, I remember just a small part of them that I’m using on a daily basis. Anyway, whenever I need to look for some sophisticated solution and can’t figure it on my own, I would look for a specialized pattern that would help me solve my problem. I do encourage you to get familiar with the design patterns in general, yet do not be afraid if you can’t memorize them all at once, it doesn’t really matter. Once you get enough experience as a software developer, you will quickly realize, that writing a proper and well-designed code is something that comes naturally, and some of these patterns will be applied to your source code even without thinking about it.

However, there a few patterns that are my favorites, so take a look at the following:

  • Dependency Injection – part of Inversion of Control using IoC Container, where you can declare a specific interfaces and classes that do implement them that shall be injected by the library into the other parts of your code.
  • Strategy Pattern – a way to distinguish between different implemtantations of the particular interface (e.g. SQLDatabase, InMemoryDatabase etc.), works great with DI.
  • CQS – command & query segregation, I did describe it already here.
  • Commands – I also did describe it already here.
  • Events – guess what, I also described it already here.

For sure there is a lot more of them such as factory, proxy, wrapper or humble object.

Resources

Next

In the next episode, we’ll finally start working on the application. We’ll also discuss the way that the work will be done in terms of managing tasks and so on.

9 Comments Becoming a software developer – episode VIII

  1. Pingback: Dew Drop - March 16, 2017 (#2441) - Morning Dew

  2. Pingback: Becoming a software developer – episode VIII – Patryk Huzarski | Personal Blog

  3. Johny

    Super!

    Fajny odcinek. Zwróć tylko uwagę na to że w tym odcinku praktycznie nie słychać pytań Patryka.

    Reply
  4. tk

    Odcinek jak i cały kurs bardzo dobry.
    Mam pytanie odnośnie CQS, mając metode która wykonuje zapis do bazy danych,
    czy może ona zgodnie z zasadą CQS po sprawdzeniu czy jakiś np. produkt istnieje w bazie tylko edytować jego wartości lub jeśli nie to utworzyć nowy?

    Reply
    1. Piotr Gankiewicz

      Tak, tylko tutaj powinieneś mieć 3 operacje – pobranie, stworzenia, edycja i tworzysz po prostu odpowiednią logikę typu pobierz->if/else->stwórz albo aktualizuj.

      Reply
  5. Kuchi

    Cześć,
    Świetny odcinek, chciałem się dowiedzieć o jakich ćwiczeniach na GutHubie mówił Patryk w sesji Q&A ? Po każdym odcinku kursu staram się coś tam wymyślić i się “pobawić” kodem, ale trochę brakuje mi właśnie cwiczeń o różnej długości do rozwiązania. Łapie się na tym, że np. trenuje sobie delegaty i Eventy i wzystko spoko, ale np za dwa tygodnie zapominam skladni, robie błędy itd. Jednym słowem nie przetrenowałem tego wystarczająco i nie weszło mi to w krew.

    Kursy na Udemy albo pluralSight dają duzą dawkę wiedzy ale znowu – cieżko mi czasami wymyślić jakies adekwatne zadanie do tego (co prawda są kursy – “Budowa aplikacji w oparciu ASP.net + Entity Framework i Angular” ale myślę, że na to przyjdzie czas. Możecie coś poradzić, skąd czerpać inspiracje, a najlepiej ćwiczenia?

    Reply
    1. Piotr Gankiewicz

      Jak dla mnie najlepszym ćwiczeniem jest stworzenie jakiegoś projektu od zera, potem można go rozbudować lub zrobić kolejny itd. Inspiracje zazwyczaj czerpałem z własnej wyobraźni, nie mam tutaj niestety lepszej odpowiedzi :).

      Reply
      1. Kuchi

        Dzięki 🙂 Pomysły mam, tylko nie wiem czy przy obecnym stanie wiedzy uda się je zrealizować 🙂

        Reply
  6. Ariel

    Cześć Piotrek!
    Mam dwa pytania :
    1. Czy uważasz, że aktualnie warto rozpoczynać przygodę ze wzorcami od książki Bandy Czworga? Leży ona u mnie już sporo czasu i w końcu powinienem ją odkurzyć..
    2. Czy Twój kurs że Strefy kursów lub Packta może być traktowany jako rozwinięcie tego kursu?
    Pozdrawiam!

    Reply

Leave a Reply to Piotr Gankiewicz Cancel reply

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