Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin...

49
Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science

Transcript of Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin...

Page 1: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Introduction to .NET

Florin Olariu

“Alexandru Ioan Cuza”, University of Iași

Department of Computer Science

Page 2: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Agenda

Recap

Bridge to our current course

What is Fitness Function?

What is architectural Fitness Function?

Demo 1

Demo 2

Page 3: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Architectural patterns

Page 4: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Architectural patterns – hexagonal

architecture

Page 5: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Architectural patterns – onion

architecture

Page 6: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Architectural patterns –Clean

Architecture

Page 7: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Architectural patterns –Clean

Architecture

Page 8: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

The big picture of Clean Architecture

Page 9: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture rules

Page 10: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture rules

The application Core contains the Domain

Page 11: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture rules

The application Core contains the Domain

All the projects depends on the Core

Page 12: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture rules

The application Core contains the Domain

All the projects depends on the Core

All the inner projects defines interfaces with the desired behavior and all the

other projects implements those interfaces

Page 13: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture rules

The application Core contains the Domain

All the projects depends on the Core

All the inner projects defines interfaces with the desired behavior and all the

other projects implements those interfaces

We should avoid the direct dependencies on the Infrastructure project

(Startup is the only compromise in .NET Core)

Page 14: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture features

Page 15: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture features

Framework independent

Page 16: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture features

Framework independent

Database independent

Page 17: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture features

Framework independent

Database independent

UI independent

Page 18: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture features

Framework independent

Database independent

UI independent

Testable

Page 19: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Page 20: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Domain

Page 21: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Domain

Interfaces

Page 22: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Domain

Interfaces

Domain events and events handlers

Page 23: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Domain

Interfaces

Domain events and events handlers

Entities(value objects/aggregate roots)

Page 24: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Domain

Interfaces

Domain events and events handlers

Entities(value objects/aggregate roots)

Domain services

Page 25: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Domain

Interfaces

Domain events and events handlers

Entities(value objects/aggregate roots)

Domain services

Exceptions

Page 26: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Infrastructure

Page 27: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Infrastructure

Repositories

Page 28: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Infrastructure

Repositories

DbContext (EF Core)

Page 29: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Infrastructure

Repositories

DbContext (EF Core)

Adapters (Logging)

Page 30: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Infrastructure

Repositories

DbContext (EF Core)

Adapters (Logging)

Interfaces

Page 31: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Application

Page 32: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Applications

Commands, Commands handlers

Page 33: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Applications

Commands, Commands handlers

Queries, Queries handlers

Page 34: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Clean Architecture details

Applications

Commands, Commands handlers

Queries, Queries handlers

Common – implementations for exceptions, mappings

Page 35: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Bridge to our current course

Page 36: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Bridge to our current course

WebUI Infrastructure

Core(Domain +

Application)

Page 37: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Bridge to our current course

WebUI Infrastructure

Core(Domain +

Application)

Functional

testing

Integration

Testing

Unit testing

Page 38: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Bridge to our current course

WebUI Infrastructure

Core(Domain +

Application)

Functional

testing

Integration

Testing

Unit testing

Page 39: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

What is Fitness Function?

Page 40: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

What is Fitness Function?

“A fitness function is an objective function used to summarize how close a

prospective design solution is to achieving the set aims. In evolutionary

computing, the fitness function determines whether an algorithm has

improved over time.”

Source: Ford, Neal; Parsons, Rebecca; Kua, Patrick. Building Evolutionary

Architectures

Page 41: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

What is Fitness Function?

“In other words, as each variant of an algorithm is generated, the fitness

functions determine how “fit” each variant is based on how the designer of

the algorithm defined “fit.””

Source: Ford, Neal; Parsons, Rebecca; Kua, Patrick. Building Evolutionary

Architectures

Page 42: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

What is architectural Fitness Function?

Page 43: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

What is architectural Fitness Function?

“Architectural fitness functions allow decisions in the context of the

organization’s needs and business functions, while making the basis for those

decisions explicit and testable.”

Source: Ford, Neal; Parsons, Rebecca; Kua, Patrick. Building Evolutionary

Architectures: Support Constant Change (Kindle Locations 303-304). O'Reilly

Media. Kindle Edition.

Page 44: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Demo 1

Page 45: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Demo 1

https://www.ben-morris.com/writing-archunit-style-tests-for-net-and-c-for-

self-testing-architectures/

Page 46: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Demo 2

Page 47: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Bibliography

Pluralsight

Clean Architecture – Uncle Bob

Evolutionary Architecture – Neal Ford

Page 48: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Questions

Do you have any other questions?

Page 49: Introduction To .NET Core 1adiftene/Scoala/2020/ASET/Courses/ASET… · Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science.

Thanks!

See you next time!