Advanced Development Techniques

2022 autumn semester

Advanced techniques of the C# language (Lambda expressions, LINQ, Entity Framework, Attributes, Reflection, DLL, Unit tests, Mock, Parallel programming (processes, threads and tasks).

official requirements


Attention!

Please make sure that you do not mix these materials with the Hungarian corresponding subject (HFT) as the topics and deadlines may differ. Also, make sure to read the README of the repository (in the root) linked below.

Codes

Sample codes, exercises and not code-related materials (eg. pdf, pptx etc.) can be found on my GitHub repository. Latter ones are located in the _other-materials folder. Codes from previous years are located under the _archived folder.

For more details please read the README.md in the root of the repository.

Lecture 00 - Intro, Requirements

Introduction to the subject, requirements discussion regarding the semester (including exams and project work).

Lecture 01 - Delegates, Lambda expressions

What are delegates, how can we use them to extend the functionality of our code. How delegates and anonymous methods are connected and what are lambda expressions.

delegate delegate as parameter multicast Func Predicate Action Comparison event anonymous methods lambda expressions outer variable trap expression lambda statement lambda

Lecture 02 - LINQ, XML

What does LINQ stands for, how can we use it together with lambda expressions. XML documents, their purpose and usage.

XML hierarchical XDocument XElement XAttribute JSON LINQ var extension methods from select where join orderby query syntax method syntax chaining IEnumerable anonymous class

Lecture 03 - DLL, Reflection

What are DLL files, how they work and how we can use them. What is reflection and how can we use it to extend our possibilities in terms of coding. What are the attributes and how can we use them together with reflection.

dll compile linking shared object windows API AppDomain meta-data reflection Type assembly MethodInfo PropertyInfo FieldInfo attribute dynamic

Lecture 04 - Databases, ORM

Database management from C# using Entity Framework Core. Direct SQL communication vs ORM based approach. How to create a code-first database. How to create a layered design for our application which has database. What are the SOLID principles and how to correspond to them.

tier layer SOLID principle ORM EFCore DbContext DbSet IQueryable fluent API annotation code first eager loading lazy loading

Lecture 05 - Layering

How a well organized and well layered application helps us to apply the SOLID principles. How a layered application should look like having the following layers: database, repository, logic and UI. What is the aim of each layer and why it is a good practice to seal the data layer behind a repository layer which can be used by the logic layer. How dependency injection can be used and why it is a good practice (must in large frameworks). What is a DTO. What are the SOLID principles and how to correspond to them.

tier layer SOLID DTO dependency injection CRUD IQueryable IList AggregateException

Lecture 06 - Unit testing

What can be considered as testing a codebase. What is testing and what is not. How to write good tests while unit testing our application, focusing on the logic part of the code.

NUnit TestFixture Setup OneTimeSetup AAA arrange act assert attribute reflection TDD fluent syntax

Lecture 07 - Mocking

How to write tests for testing our logic without destroying our live database. Instead, how to create mock objects to mock our repository layer using Moq framework. Alternatively we can create fake objects (classes) with implemented fake functionalities.

dependency inversion dependency injection constructor injection method injection tight coupling loose coupling fake objects mock objects Moq code smells

Lecture 08 - Git version control

How and why version controlling (or source control management) a must in everyday development (whether it is group work or standalone development). What is Git and how to use it. What is the difference between Git and GitHub (or alternatives) and 3rd party GUI applications.

SCM Git branch master GitHub GitKraken gitignore

Lecture 09 - Web API

What is a server-client communication, and how websites connect to this. Data serialization and deserialization to/from JSON. How rest APIs has changed the way websites build up. What is a web API, how to create and how to use them based on HTTP methods. What is API-first development approach. Why we receive CORS error.

server client request response GET POST HTTP method JSON serialization deserialization TCP UDP SOAP REST Swagger API-first CORS

Lecture 10 - DevOps basics, CI/CD

How software development progressed during the years and what key changes happened regarding the operation of the softwares. How virtual machines changed the industry of server maintenance, and how it evolved again as a big step using containerization technologies (eg. Docker) so that we have disposable infrastructures. How cloud systems assisted all these changes. What are the service levels which we can encounter as a user/developer during cloud systems (IAAS, PAAS, SAAS). What is the difference between Delivery and Deployment. What is CI (continuous integration) and CD (continuous delivery).

virtual machine Amazon cloud computing IAAS PAAS SAAS containerization Docker delivery deployment CI CD webhook Git scaling

Lecture 11 - Parallel programming I.

Introduction to the basics of parallel execution's – and parallel programming's fundamentals. Why parallelism is important in computer science and how it can be achieved. What is data decomposition. What is a pipeline system. What are the differences between multiprocessing and multithreading. What are the differences between processes and threads. How to use Process and Thread objects in .Net Core.

data decomposition pipeline Process Thread multiprocessing multithreading threadpool asynchronous background worker

Lecture 12 - Parallel programming II.

How to use Task objects in .Net Core. What are the differences between Tasks and Threads, focusing on the benefits of the former one. What is the connection between threads, tasks and threadpool. How to synchronize tasks. How to use exceptions and cancellation (using CancellationToken) together with tasks. Discussion of the following (multi-threaded phenomenons) problems and their solution: race condition, deadlock, live lock, synchronization, critical section, mutual exclusion. What is a lock object, how to use atomic operations and what is a semaphore.

Task threadpool race condition deadlock livelock starvation threadsafe synchronization critical section Interlocked lock semaphore Monitor CancellationToken AggregateException atomicity atomic operation

Lecture 13 - Parallel programming III.

What is the maximum speed increase which can be reached if we use parallel programming instead of sequential one. How to calculate this using Amdahl's law. What is granularity and load balancing. Discussion of the following topics: asynchronous methods, async-await, threadpool, data-parallelism using TPL (parallel for / foreach / invoke and parallel LINQ). Comparison of how async-await is used in C# and in JavaScript.

threadpool speedup granularity asynchronous async-await data-parallelism TPL LINQ JavaScript

Demo exercise I.

PRACTICE SIMPLE

Simple exercise using only one entity. Database usage, XML processing and populating database with entities, custom attribute usage and validation based on that using reflection, LINQ queries on database entities, creating Unit tests.

LINQ reflection validation database service-based database unit testing

Demo exercise II.

PRACTICE COMPLEX

More complex exercise using two entities in one-to-many relation. Database usage, XML processing and populating database with entities, custom attribute usage and validation based on that using reflection, LINQ queries on database entities, creating Unit tests.

one-to-many LINQ reflection validation database service-based database unit testing