SlideShare a Scribd company logo
Architectural Patterns Multi-Tier, MVC, MVP, MVVM, IoC, DI, SOA Svetlin Nakov Telerik Corporation www.telerik.com
Table of Contents What is Software Architecture? Client-Server Architecture 3-Tier / Multi-Tier Architectures MVC (Model-View-Controller) MVP (Model-View-Presenter) MVVM (Model-View-ViewModel) IoC (Inversion of Control) and DI (Dependency Injection) Architectural Principals SOA (Service-Oriented Architecture)
What is Software Architecture?
Software Architecture Software architecture  is a technical blueprint explaining how the system will be structured The  system architecture   describes : How the system will be decomposed into subsystems (modules) Responsibilities of each module Interaction between the modules Platforms and technologies Each module could also implement a certain architectural model / pattern
System Architecture Diagram – Example
Example of Multi-Tier Software Architecture
Client-Server Architecture The Classical Client-Server Model
Client-Server Architecture The client-server model consists of: Server  – a single machine / application that provides services to multiple clients Could be IIS based Web server Could be WCF based service Could be a services in the cloud Clients  –software applications that provide UI (front-end) to access the services at the server Could be WPF, HTML5, Silverlight, ASP.NET, …
The Client-Server Model Server Desktop Client Mobile Client Client Machine network connection network connection network connection
Client-Server Model – Examples Web server (IIS) – Web browser (Firefox) FTP server (ftpd) – FTP client (FileZilla) EMail server (qmail) – email client (Outlook) SQL Server – SQL Server Management Studio BitTorrent Tracker – Torrent client ( μ Torrent) DNS server (bind) – DNS client (resolver) DHCP server (wireless router firmware) – DHCP client (mobile phone /Android DHCP client/) SMB server (Windows) – SMB client (Windows)
3-Tier / Multi-Tier Architectures Classical Layered Structure of Software Systems
The 3-Tier Architecture The  3-tier architecture  consists of the following tiers (layers): Front-end  (client layer) Client   software – provides the UI of the system Middle tier  (business layer) Server software – provides the core system logic Implements the business processes / services Back-end  (data layer) Manages the data of the system (database / cloud)
The 3-Tier Architecture Model Business Logic Desktop Client Mobile Client Client Machine network network network Database Data Tier (Back-End) Middle Tier (Business Tier) Client Tier (Front-End)
Typical Layers of the Middle Tier The middle tier usually has parts related to the front-end, business logic and back-end: Presentation Logic Implements the UI of the application (HTML5, Silverlight, WPF, …) Business Logic Implements the core processes / services of the application Data Access Logic Implements the data access functionality (usually ORM framework)
Multi-Tier Architecture DB ORM WCF ASP .NET HTML
MVC (Model- View-Controller) What is MVC and How It Works?
Model-View-Controller (MVC) Model-View-Controller (MVC)  architecture  Separates the business logic from application data and presentation Model Keeps the application state (data) View Displays the data to the user (shows UI) Controller Handles the interaction with the user
MVC Architecture Blueprint
MVC-Based Frameworks .NET ASP.NET MVC, MonoRail Java JavaServer Faces (JSF), Struts, Spring Web MVC, Tapestry, JBoss Seam, Swing PHP CakePHP, Symfony, Zend ,  Joomla ,  Yii, Mojavi Python Django, Zope Application Server, TurboGears Ruby on Rails
MVC and Multi-Tier Architecture MVC does not replace the multi-tier architecture Both are usually used together Typical multi-tier architecture can use MVC To separate logic, data and presentation Model (Data) Data Access Logic Views (Presentation) Controllers (Business Logic)
MVP (Model-View-Presenter) What is MVP Architecture and How it Works?
Model-View-Presenter (MVP) Model-View-Presenter (MVP)  is UI design pattern similar to MVC Model Keeps application data (state) View Presentation – displays the UI and handles UI events (keyboard, mouse, etc.) Presenter Presentation logic (prepares data taken from the model to be displayed in certain format)
Presentation-Abstraction-Control (PAC) What is PAC and How It Works?
Presentation-Abstraction-Control (PAC) Presentation-Abstraction-Control (PAC)  interaction-oriented architectural pattern Similar to MVC but is hierarchical (like HMVC) Presentation Prepares data for the UI (similar to  View ) Abstraction Retrieves and processes data (similar to  Model ) Control Flow-control and communication (similar to  Controller )
Presentation-Abstraction-Control (PAC) – Hierarchy
MVVM ( Model-View-ViewModel ) What is MVVM and How It Works?
Model-View- ViewModel  (MVVM) Model-View-ViewModel  (MVVM)  is architectural pattern for modern UI development Invented by Microsoft for use in WPF and Silverlight Based on  MVC ,  MVP  and Martin Fowler's  Presentation Model  pattern Officially published in the Prism project (Composite Application Guidance for WPF and Silverlight) Separates the " view layer " (state and behavior) from the rest of the application
MVVM Structure Model Keeps the application data / state representation E.g. data access layer or ORM framework View UI elements of the application Windows, forms, controls, fields, buttons, etc. ViewModel Data binder and converter that changes the  Model  information into  View  information Exposes  commands  for binding in the  Views
MVVM in WPF / Silverlight View  – implemented by XAML code + code behind C# class Model  – implemented by WCF services / ORM framework / data access classes ViewModel   – implemented by C# class and keeps data (properties), commands (code), notifications
MVVM Architecture MVVM is typically used in XAML applications (WPF, Silverlight, WP7) and supports unit testing
MVP vs. MVVM Patterns MVVM is like MVP but leverages the platform's build-in bi-directional  data binding  mechanisms
IoC (Inversion of Control) and DI (Dependency Injection) Architectural Principals or Design Patterns?
Inversion of Control (IoC) Inversion of Control (IoC)  is an abstract principle in software design in which The flow of control of a system is inverted compared to procedural programming The main control of the program is inverted, moved away from you to the framework Basic IoC principle: Implementations typically rely on callbacks Don't call us, we'll call you!
Procedural Flow Control – Example private void DoSomeTransactionalWork(IDbSesion) { … } IDbSession session = new DbSession(); session.BeginTransaction();  try { DoSomeTransactionalWork(session); session.CommitTransaction(); } catch (Exception) { session.RollbackTransaction(); throw; } Step by step execution
Inverted Flow Control – Example private static void ExecuteInTransaction( Action<IDbSession> doSomeTransactionalWork) { IDbSession session = new DbSession(); session.BeginTransaction(); try { doSomeTransactionalWork(session); session.CommitTransaction(); } catch (Exception) { session.RollbackTransaction(); throw; } } ExecuteInTransaction(DoSomeTransactionalWork); Inverted flow control
Dependency Inversion Principle Dependency inversion principle Decouples high-level components from low-level components To allow reuse with different low-level component implementations Design patterns implementing the dependency inversion principle: Dependency Injection Service Locator
Highly Dependent Components Example of highly dependent components: The  LogsDAO  class is highly-coupled (dependent) to  DbSession  class public class LogsDAO { private void AppendToLogs(string message) { DbSession session = new DbSession(); session.ExecuteSqlWithParams(&quot;INSERT INTO &quot; +  &quot;Logs(MsgDate, MsgText) VALUES({0},{1})&quot;, DateTime.Now, message); } }
Decoupled Components public class LogsDAO { private IDbSession session; public LogsDAO(IDbSession session) { this.session = session; } private void AppendToLogs(string message) { session.ExecuteSqlWithParams(&quot;INSERT INTO &quot; +  &quot;Logs(MsgDate, MsgText) VALUES({0},{1})&quot;, DateTime.Now, message); } } The  LogsDAO  and  DbSession  are now decoupled
Decoupling Components LogsDAO DbSession depends on LogsDAO IDbSession depend on DbSession Highly-coupled components: Decoupled components:
Dependency Injection (DI) Dependency Injection (DI)  is the main method to implement Inversion of Control (IoC) pattern DI and IoC are considered the same concept DI separates behavior from dependency resolution and thus decouples highly dependent components Dependency injection means passing or setting of dependencies into a software component Instead of components having to request dependencies, they are passed (injected) into the component
Types of Injection Dependency Injection (DI) usually runs with  IoC Container  (also called  DI Container ) Types of dependency injection: Constructor injection  – a dependency is passed to the constructor as a parameter Setter injection  –  a dependency is injected into the dependent object through a property setter Interface injection  –  an interface is used to inject a dependency into the dependent object IoC containers can inject dependencies automatically at run-time
IoC Container – Example IoC containers have two main functions Register injectable classes Can be done declaratively (with XML or attributes) or programmatically (in C# code) Resolve already registered classes Done in C# code at runtime Dependency injection could be done automatically with no code E.g.  autowire  in Spring framework
IoC Container – Example (2) Consider the following code: We want to use IoC container to resolve the dependency between our code and the logger public interface ILogger { void LogMessage(string msg); } public class ConsoleLogger : ILogger { public void LogMessage(string msg) { Console.WriteLine(msg); } }
IoC Container – Example (3) Consider the IoC container provides the following methods: Registering the logger: Using the registered logger: IoC.Register<ILogger>(new ConsoleLogger()); ILogger logger = IoC.Resolve<ILogger>(); logger.LogMessage(&quot;Hello, world!&quot;);
IoC Containers for .NET Microsoft ObjectBuilder; Microsoft Unity Open-source projects at CodePlex Part of Patterns & Practices Enterprise Library Spring.NET –  www.springframework.net .NET port of the famous Spring framework from the Java world (currently owned by VMware) Castle Windsor – www.castleproject.org Open-source IoC container, part of the Castle project
Microsoft Prism Patterns and Practices: Prism Patterns For Building Composite Applications With WPF and Silverlight Composite applications – consists of loosely coupled modules discoverable at runtime Prism components Prism Library Stock Trader Reference Implementation  MVVM Reference Implementation QuickStarts
Managed Extensibility Framework (MEF) Managed Extensibility Framework (MEF) Simplifies the design of extensible applications and components Official part of .NET Framework 4 Allows developers to discover and use extensions with no configuration at runtime lets extension developers easily encapsulate code and avoid fragile hard dependencies
SOA (Service-Oriented Architecture) SOA and Cloud Computing
What is SOA? Service-Oriented Architecture (SOA)  is a concept for development of software systems Using reusable building blocks (components) called &quot;services&quot; Services in SOA are: Autonomous, stateless business functions Accept requests and return responses Use well-defined, standard interface
SOA Services Autonomous Each service operates autonomously Without any awareness that other services exist Statelessa Have no memory, do not remember state Easy to scale Request-response model Client asks, server returns answer
SOA Services (2) Communication through standard protocols XML, SOAP, JSON, RSS, ATOM, ... HTTP, FTP, SMTP, RPC, ... Not dependent on OS, platforms, programming languages Discoverable Service registries Could be hosted &quot;in the cloud&quot; (e.g. in Azure)
What is Cloud Computing? Cloud computing  is a modern approach in the IT infrastructure that provides : Software applications, services, hardware and system resources Hosts the applications and user data in remote servers called &quot;the cloud&quot; Cloud computing models : IaaS – infrastructure as a service (virtual servers) PaaS – platform as a service (full stack of technologies for UI , application logic, data storage) SaaS – software as a service (e.g. Google Docs)
Loose Coupling Loose coupling  is the main concept of SOA Loosely coupled components: Exhibits single function Independent of other functions Through a well-defined interface Loose coupling programming evolves: Structural programming Object-oriented programming Service-oriented architecture (SOA)
SOA Design Patterns SOA Patterns –  www.soapatterns.org Inventory Foundation, Logical Layer, Implementation, Governance Patterns Service Foundational, Implementation, Security, Contract ,  Governance ,  Messaging Patterns Legacy Encapsulation Patterns Capability Composition Patterns Composition Implementation Patterns Transformation Patterns Common Compound Design Patterns
Architectural Patterns Questions?
Ad

More Related Content

What's hot (20)

Introduction à React JS
Introduction à React JSIntroduction à React JS
Introduction à React JS
Abdoulaye Dieng
 
Introduction à spring boot
Introduction à spring bootIntroduction à spring boot
Introduction à spring boot
Antoine Rey
 
Design Pattern - MVC, MVP and MVVM
Design Pattern - MVC, MVP and MVVMDesign Pattern - MVC, MVP and MVVM
Design Pattern - MVC, MVP and MVVM
Mudasir Qazi
 
Architectures distribuées
Architectures distribuéesArchitectures distribuées
Architectures distribuées
Franck SIMON
 
Support de cours angular
Support de cours angularSupport de cours angular
Support de cours angular
ENSET, Université Hassan II Casablanca
 
Java para dispositivos móveis
Java para dispositivos móveisJava para dispositivos móveis
Java para dispositivos móveis
João Gabriel Lima
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right way
Thibaud Desodt
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
Brad Genereaux
 
WPF
WPFWPF
WPF
Vishwa Mohan
 
Domain object model
Domain object modelDomain object model
Domain object model
university of education,Lahore
 
Support Java Avancé Troisième Partie
Support Java Avancé Troisième PartieSupport Java Avancé Troisième Partie
Support Java Avancé Troisième Partie
ENSET, Université Hassan II Casablanca
 
Initiation à ASP.NET 4.0
Initiation à ASP.NET 4.0Initiation à ASP.NET 4.0
Initiation à ASP.NET 4.0
Jean-Baptiste Vigneron
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
Tareq Hasan
 
Creational pattern
Creational patternCreational pattern
Creational pattern
Himanshu
 
Traitement distribue en BIg Data - KAFKA Broker and Kafka Streams
Traitement distribue en BIg Data - KAFKA Broker and Kafka StreamsTraitement distribue en BIg Data - KAFKA Broker and Kafka Streams
Traitement distribue en BIg Data - KAFKA Broker and Kafka Streams
ENSET, Université Hassan II Casablanca
 
Introduction aux systèmes répartis
Introduction aux systèmes répartisIntroduction aux systèmes répartis
Introduction aux systèmes répartis
Heithem Abbes
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
Purbarun Chakrabarti
 
Présentation Angular 2
Présentation Angular 2 Présentation Angular 2
Présentation Angular 2
Cynapsys It Hotspot
 
Design patterns tutorials
Design patterns tutorialsDesign patterns tutorials
Design patterns tutorials
University of Technology
 
Introduction à React JS
Introduction à React JSIntroduction à React JS
Introduction à React JS
Abdoulaye Dieng
 
Introduction à spring boot
Introduction à spring bootIntroduction à spring boot
Introduction à spring boot
Antoine Rey
 
Design Pattern - MVC, MVP and MVVM
Design Pattern - MVC, MVP and MVVMDesign Pattern - MVC, MVP and MVVM
Design Pattern - MVC, MVP and MVVM
Mudasir Qazi
 
Architectures distribuées
Architectures distribuéesArchitectures distribuées
Architectures distribuées
Franck SIMON
 
Java para dispositivos móveis
Java para dispositivos móveisJava para dispositivos móveis
Java para dispositivos móveis
João Gabriel Lima
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right way
Thibaud Desodt
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
Brad Genereaux
 
Creational pattern
Creational patternCreational pattern
Creational pattern
Himanshu
 
Introduction aux systèmes répartis
Introduction aux systèmes répartisIntroduction aux systèmes répartis
Introduction aux systèmes répartis
Heithem Abbes
 

Similar to Architectural Patterns and Software Architectures: Client-Server, Multi-Tier, MVC, MVP, MVVM, IoC, DI, SOA, Cloud Computing (20)

MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
Anton Krasnoshchok
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
alkuzaee
 
Building an enterprise app in silverlight 4 and NHibernate
Building an enterprise app in silverlight 4 and NHibernateBuilding an enterprise app in silverlight 4 and NHibernate
Building an enterprise app in silverlight 4 and NHibernate
bwullems
 
MVC
MVCMVC
MVC
akshin
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
Surbhi Panhalkar
 
Swiz DAO
Swiz DAOSwiz DAO
Swiz DAO
devaraj ns
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Julia Vi
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
Daniel Bryant
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Phuc Le Cong
 
Crafted Design - ITAKE 2014
Crafted Design - ITAKE 2014Crafted Design - ITAKE 2014
Crafted Design - ITAKE 2014
Sandro Mancuso
 
Ppt of Basic MVC Structure
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC Structure
Dipika Wadhvani
 
CG_CS25010_Lecture
CG_CS25010_LectureCG_CS25010_Lecture
CG_CS25010_Lecture
Connor Goddard
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
Hamid Ghorbani
 
MVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,MobileMVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,Mobile
naral
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
AHM Pervej Kabir
 
MVC in PHP
MVC in PHPMVC in PHP
MVC in PHP
Vineet Kumar Saini
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
codeinmotion
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
 
Apachecon 2002 Struts
Apachecon 2002 StrutsApachecon 2002 Struts
Apachecon 2002 Struts
yesprakash
 
Month 2 report
Month 2 reportMonth 2 report
Month 2 report
PRIYANKA FNU
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
Anton Krasnoshchok
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
alkuzaee
 
Building an enterprise app in silverlight 4 and NHibernate
Building an enterprise app in silverlight 4 and NHibernateBuilding an enterprise app in silverlight 4 and NHibernate
Building an enterprise app in silverlight 4 and NHibernate
bwullems
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Julia Vi
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
Daniel Bryant
 
Crafted Design - ITAKE 2014
Crafted Design - ITAKE 2014Crafted Design - ITAKE 2014
Crafted Design - ITAKE 2014
Sandro Mancuso
 
Ppt of Basic MVC Structure
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC Structure
Dipika Wadhvani
 
MVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,MobileMVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,Mobile
naral
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
AHM Pervej Kabir
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
codeinmotion
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
 
Apachecon 2002 Struts
Apachecon 2002 StrutsApachecon 2002 Struts
Apachecon 2002 Struts
yesprakash
 
Ad

More from Svetlin Nakov (20)

AI and the Future of Devs: Nakov @ Techniverse (Nov 2024)
AI and the Future of Devs: Nakov @ Techniverse (Nov 2024)AI and the Future of Devs: Nakov @ Techniverse (Nov 2024)
AI and the Future of Devs: Nakov @ Techniverse (Nov 2024)
Svetlin Nakov
 
AI за ежедневието - Наков @ Techniverse (Nov 2024)
AI за ежедневието - Наков @ Techniverse (Nov 2024)AI за ежедневието - Наков @ Techniverse (Nov 2024)
AI за ежедневието - Наков @ Techniverse (Nov 2024)
Svetlin Nakov
 
AI инструменти за бизнеса - Наков - Nov 2024
AI инструменти за бизнеса - Наков - Nov 2024AI инструменти за бизнеса - Наков - Nov 2024
AI инструменти за бизнеса - Наков - Nov 2024
Svetlin Nakov
 
AI Adoption in Business - Nakov at Forbes HR Forum - Sept 2024
AI Adoption in Business - Nakov at Forbes HR Forum - Sept 2024AI Adoption in Business - Nakov at Forbes HR Forum - Sept 2024
AI Adoption in Business - Nakov at Forbes HR Forum - Sept 2024
Svetlin Nakov
 
Software Engineers in the AI Era - Sept 2024
Software Engineers in the AI Era - Sept 2024Software Engineers in the AI Era - Sept 2024
Software Engineers in the AI Era - Sept 2024
Svetlin Nakov
 
Най-търсените направления в ИТ сферата за 2024
Най-търсените направления в ИТ сферата за 2024Най-търсените направления в ИТ сферата за 2024
Най-търсените направления в ИТ сферата за 2024
Svetlin Nakov
 
BG-IT-Edu: отворено учебно съдържание за ИТ учители
BG-IT-Edu: отворено учебно съдържание за ИТ учителиBG-IT-Edu: отворено учебно съдържание за ИТ учители
BG-IT-Edu: отворено учебно съдържание за ИТ учители
Svetlin Nakov
 
Programming World in 2024
Programming World in 2024Programming World in 2024
Programming World in 2024
Svetlin Nakov
 
AI Tools for Business and Startups
AI Tools for Business and StartupsAI Tools for Business and Startups
AI Tools for Business and Startups
Svetlin Nakov
 
AI Tools for Scientists - Nakov (Oct 2023)
AI Tools for Scientists - Nakov (Oct 2023)AI Tools for Scientists - Nakov (Oct 2023)
AI Tools for Scientists - Nakov (Oct 2023)
Svetlin Nakov
 
AI Tools for Entrepreneurs
AI Tools for EntrepreneursAI Tools for Entrepreneurs
AI Tools for Entrepreneurs
Svetlin Nakov
 
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
Svetlin Nakov
 
AI Tools for Business and Personal Life
AI Tools for Business and Personal LifeAI Tools for Business and Personal Life
AI Tools for Business and Personal Life
Svetlin Nakov
 
Дипломна работа: учебно съдържание по ООП - Светлин Наков
Дипломна работа: учебно съдържание по ООП - Светлин НаковДипломна работа: учебно съдържание по ООП - Светлин Наков
Дипломна работа: учебно съдържание по ООП - Светлин Наков
Svetlin Nakov
 
Дипломна работа: учебно съдържание по ООП
Дипломна работа: учебно съдържание по ООПДипломна работа: учебно съдържание по ООП
Дипломна работа: учебно съдържание по ООП
Svetlin Nakov
 
Свободно ИТ учебно съдържание за учители по програмиране и ИТ
Свободно ИТ учебно съдържание за учители по програмиране и ИТСвободно ИТ учебно съдържание за учители по програмиране и ИТ
Свободно ИТ учебно съдържание за учители по програмиране и ИТ
Svetlin Nakov
 
AI and the Professions of the Future
AI and the Professions of the FutureAI and the Professions of the Future
AI and the Professions of the Future
Svetlin Nakov
 
Programming Languages Trends for 2023
Programming Languages Trends for 2023Programming Languages Trends for 2023
Programming Languages Trends for 2023
Svetlin Nakov
 
IT Professions and How to Become a Developer
IT Professions and How to Become a DeveloperIT Professions and How to Become a Developer
IT Professions and How to Become a Developer
Svetlin Nakov
 
GitHub Actions (Nakov at RuseConf, Sept 2022)
GitHub Actions (Nakov at RuseConf, Sept 2022)GitHub Actions (Nakov at RuseConf, Sept 2022)
GitHub Actions (Nakov at RuseConf, Sept 2022)
Svetlin Nakov
 
AI and the Future of Devs: Nakov @ Techniverse (Nov 2024)
AI and the Future of Devs: Nakov @ Techniverse (Nov 2024)AI and the Future of Devs: Nakov @ Techniverse (Nov 2024)
AI and the Future of Devs: Nakov @ Techniverse (Nov 2024)
Svetlin Nakov
 
AI за ежедневието - Наков @ Techniverse (Nov 2024)
AI за ежедневието - Наков @ Techniverse (Nov 2024)AI за ежедневието - Наков @ Techniverse (Nov 2024)
AI за ежедневието - Наков @ Techniverse (Nov 2024)
Svetlin Nakov
 
AI инструменти за бизнеса - Наков - Nov 2024
AI инструменти за бизнеса - Наков - Nov 2024AI инструменти за бизнеса - Наков - Nov 2024
AI инструменти за бизнеса - Наков - Nov 2024
Svetlin Nakov
 
AI Adoption in Business - Nakov at Forbes HR Forum - Sept 2024
AI Adoption in Business - Nakov at Forbes HR Forum - Sept 2024AI Adoption in Business - Nakov at Forbes HR Forum - Sept 2024
AI Adoption in Business - Nakov at Forbes HR Forum - Sept 2024
Svetlin Nakov
 
Software Engineers in the AI Era - Sept 2024
Software Engineers in the AI Era - Sept 2024Software Engineers in the AI Era - Sept 2024
Software Engineers in the AI Era - Sept 2024
Svetlin Nakov
 
Най-търсените направления в ИТ сферата за 2024
Най-търсените направления в ИТ сферата за 2024Най-търсените направления в ИТ сферата за 2024
Най-търсените направления в ИТ сферата за 2024
Svetlin Nakov
 
BG-IT-Edu: отворено учебно съдържание за ИТ учители
BG-IT-Edu: отворено учебно съдържание за ИТ учителиBG-IT-Edu: отворено учебно съдържание за ИТ учители
BG-IT-Edu: отворено учебно съдържание за ИТ учители
Svetlin Nakov
 
Programming World in 2024
Programming World in 2024Programming World in 2024
Programming World in 2024
Svetlin Nakov
 
AI Tools for Business and Startups
AI Tools for Business and StartupsAI Tools for Business and Startups
AI Tools for Business and Startups
Svetlin Nakov
 
AI Tools for Scientists - Nakov (Oct 2023)
AI Tools for Scientists - Nakov (Oct 2023)AI Tools for Scientists - Nakov (Oct 2023)
AI Tools for Scientists - Nakov (Oct 2023)
Svetlin Nakov
 
AI Tools for Entrepreneurs
AI Tools for EntrepreneursAI Tools for Entrepreneurs
AI Tools for Entrepreneurs
Svetlin Nakov
 
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
Svetlin Nakov
 
AI Tools for Business and Personal Life
AI Tools for Business and Personal LifeAI Tools for Business and Personal Life
AI Tools for Business and Personal Life
Svetlin Nakov
 
Дипломна работа: учебно съдържание по ООП - Светлин Наков
Дипломна работа: учебно съдържание по ООП - Светлин НаковДипломна работа: учебно съдържание по ООП - Светлин Наков
Дипломна работа: учебно съдържание по ООП - Светлин Наков
Svetlin Nakov
 
Дипломна работа: учебно съдържание по ООП
Дипломна работа: учебно съдържание по ООПДипломна работа: учебно съдържание по ООП
Дипломна работа: учебно съдържание по ООП
Svetlin Nakov
 
Свободно ИТ учебно съдържание за учители по програмиране и ИТ
Свободно ИТ учебно съдържание за учители по програмиране и ИТСвободно ИТ учебно съдържание за учители по програмиране и ИТ
Свободно ИТ учебно съдържание за учители по програмиране и ИТ
Svetlin Nakov
 
AI and the Professions of the Future
AI and the Professions of the FutureAI and the Professions of the Future
AI and the Professions of the Future
Svetlin Nakov
 
Programming Languages Trends for 2023
Programming Languages Trends for 2023Programming Languages Trends for 2023
Programming Languages Trends for 2023
Svetlin Nakov
 
IT Professions and How to Become a Developer
IT Professions and How to Become a DeveloperIT Professions and How to Become a Developer
IT Professions and How to Become a Developer
Svetlin Nakov
 
GitHub Actions (Nakov at RuseConf, Sept 2022)
GitHub Actions (Nakov at RuseConf, Sept 2022)GitHub Actions (Nakov at RuseConf, Sept 2022)
GitHub Actions (Nakov at RuseConf, Sept 2022)
Svetlin Nakov
 
Ad

Recently uploaded (20)

"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical DebtBuckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Lynda Kane
 
Hands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordDataHands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordData
Lynda Kane
 
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your UsersAutomation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Lynda Kane
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
Lynda Kane
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Datastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptxDatastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
kaleeswaric3
 
Buckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug LogsBuckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug Logs
Lynda Kane
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Rock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning JourneyRock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning Journey
Lynda Kane
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical DebtBuckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Lynda Kane
 
Hands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordDataHands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordData
Lynda Kane
 
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your UsersAutomation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Lynda Kane
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
Lynda Kane
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Datastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptxDatastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
kaleeswaric3
 
Buckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug LogsBuckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug Logs
Lynda Kane
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Rock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning JourneyRock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning Journey
Lynda Kane
 

Architectural Patterns and Software Architectures: Client-Server, Multi-Tier, MVC, MVP, MVVM, IoC, DI, SOA, Cloud Computing

  • 1. Architectural Patterns Multi-Tier, MVC, MVP, MVVM, IoC, DI, SOA Svetlin Nakov Telerik Corporation www.telerik.com
  • 2. Table of Contents What is Software Architecture? Client-Server Architecture 3-Tier / Multi-Tier Architectures MVC (Model-View-Controller) MVP (Model-View-Presenter) MVVM (Model-View-ViewModel) IoC (Inversion of Control) and DI (Dependency Injection) Architectural Principals SOA (Service-Oriented Architecture)
  • 3. What is Software Architecture?
  • 4. Software Architecture Software architecture is a technical blueprint explaining how the system will be structured The system architecture describes : How the system will be decomposed into subsystems (modules) Responsibilities of each module Interaction between the modules Platforms and technologies Each module could also implement a certain architectural model / pattern
  • 6. Example of Multi-Tier Software Architecture
  • 7. Client-Server Architecture The Classical Client-Server Model
  • 8. Client-Server Architecture The client-server model consists of: Server – a single machine / application that provides services to multiple clients Could be IIS based Web server Could be WCF based service Could be a services in the cloud Clients –software applications that provide UI (front-end) to access the services at the server Could be WPF, HTML5, Silverlight, ASP.NET, …
  • 9. The Client-Server Model Server Desktop Client Mobile Client Client Machine network connection network connection network connection
  • 10. Client-Server Model – Examples Web server (IIS) – Web browser (Firefox) FTP server (ftpd) – FTP client (FileZilla) EMail server (qmail) – email client (Outlook) SQL Server – SQL Server Management Studio BitTorrent Tracker – Torrent client ( μ Torrent) DNS server (bind) – DNS client (resolver) DHCP server (wireless router firmware) – DHCP client (mobile phone /Android DHCP client/) SMB server (Windows) – SMB client (Windows)
  • 11. 3-Tier / Multi-Tier Architectures Classical Layered Structure of Software Systems
  • 12. The 3-Tier Architecture The 3-tier architecture consists of the following tiers (layers): Front-end (client layer) Client software – provides the UI of the system Middle tier (business layer) Server software – provides the core system logic Implements the business processes / services Back-end (data layer) Manages the data of the system (database / cloud)
  • 13. The 3-Tier Architecture Model Business Logic Desktop Client Mobile Client Client Machine network network network Database Data Tier (Back-End) Middle Tier (Business Tier) Client Tier (Front-End)
  • 14. Typical Layers of the Middle Tier The middle tier usually has parts related to the front-end, business logic and back-end: Presentation Logic Implements the UI of the application (HTML5, Silverlight, WPF, …) Business Logic Implements the core processes / services of the application Data Access Logic Implements the data access functionality (usually ORM framework)
  • 15. Multi-Tier Architecture DB ORM WCF ASP .NET HTML
  • 16. MVC (Model- View-Controller) What is MVC and How It Works?
  • 17. Model-View-Controller (MVC) Model-View-Controller (MVC) architecture Separates the business logic from application data and presentation Model Keeps the application state (data) View Displays the data to the user (shows UI) Controller Handles the interaction with the user
  • 19. MVC-Based Frameworks .NET ASP.NET MVC, MonoRail Java JavaServer Faces (JSF), Struts, Spring Web MVC, Tapestry, JBoss Seam, Swing PHP CakePHP, Symfony, Zend , Joomla , Yii, Mojavi Python Django, Zope Application Server, TurboGears Ruby on Rails
  • 20. MVC and Multi-Tier Architecture MVC does not replace the multi-tier architecture Both are usually used together Typical multi-tier architecture can use MVC To separate logic, data and presentation Model (Data) Data Access Logic Views (Presentation) Controllers (Business Logic)
  • 21. MVP (Model-View-Presenter) What is MVP Architecture and How it Works?
  • 22. Model-View-Presenter (MVP) Model-View-Presenter (MVP) is UI design pattern similar to MVC Model Keeps application data (state) View Presentation – displays the UI and handles UI events (keyboard, mouse, etc.) Presenter Presentation logic (prepares data taken from the model to be displayed in certain format)
  • 24. Presentation-Abstraction-Control (PAC) Presentation-Abstraction-Control (PAC) interaction-oriented architectural pattern Similar to MVC but is hierarchical (like HMVC) Presentation Prepares data for the UI (similar to View ) Abstraction Retrieves and processes data (similar to Model ) Control Flow-control and communication (similar to Controller )
  • 26. MVVM ( Model-View-ViewModel ) What is MVVM and How It Works?
  • 27. Model-View- ViewModel (MVVM) Model-View-ViewModel (MVVM) is architectural pattern for modern UI development Invented by Microsoft for use in WPF and Silverlight Based on MVC , MVP and Martin Fowler's Presentation Model pattern Officially published in the Prism project (Composite Application Guidance for WPF and Silverlight) Separates the &quot; view layer &quot; (state and behavior) from the rest of the application
  • 28. MVVM Structure Model Keeps the application data / state representation E.g. data access layer or ORM framework View UI elements of the application Windows, forms, controls, fields, buttons, etc. ViewModel Data binder and converter that changes the Model information into View information Exposes commands for binding in the Views
  • 29. MVVM in WPF / Silverlight View – implemented by XAML code + code behind C# class Model – implemented by WCF services / ORM framework / data access classes ViewModel – implemented by C# class and keeps data (properties), commands (code), notifications
  • 30. MVVM Architecture MVVM is typically used in XAML applications (WPF, Silverlight, WP7) and supports unit testing
  • 31. MVP vs. MVVM Patterns MVVM is like MVP but leverages the platform's build-in bi-directional data binding mechanisms
  • 32. IoC (Inversion of Control) and DI (Dependency Injection) Architectural Principals or Design Patterns?
  • 33. Inversion of Control (IoC) Inversion of Control (IoC) is an abstract principle in software design in which The flow of control of a system is inverted compared to procedural programming The main control of the program is inverted, moved away from you to the framework Basic IoC principle: Implementations typically rely on callbacks Don't call us, we'll call you!
  • 34. Procedural Flow Control – Example private void DoSomeTransactionalWork(IDbSesion) { … } IDbSession session = new DbSession(); session.BeginTransaction(); try { DoSomeTransactionalWork(session); session.CommitTransaction(); } catch (Exception) { session.RollbackTransaction(); throw; } Step by step execution
  • 35. Inverted Flow Control – Example private static void ExecuteInTransaction( Action<IDbSession> doSomeTransactionalWork) { IDbSession session = new DbSession(); session.BeginTransaction(); try { doSomeTransactionalWork(session); session.CommitTransaction(); } catch (Exception) { session.RollbackTransaction(); throw; } } ExecuteInTransaction(DoSomeTransactionalWork); Inverted flow control
  • 36. Dependency Inversion Principle Dependency inversion principle Decouples high-level components from low-level components To allow reuse with different low-level component implementations Design patterns implementing the dependency inversion principle: Dependency Injection Service Locator
  • 37. Highly Dependent Components Example of highly dependent components: The LogsDAO class is highly-coupled (dependent) to DbSession class public class LogsDAO { private void AppendToLogs(string message) { DbSession session = new DbSession(); session.ExecuteSqlWithParams(&quot;INSERT INTO &quot; + &quot;Logs(MsgDate, MsgText) VALUES({0},{1})&quot;, DateTime.Now, message); } }
  • 38. Decoupled Components public class LogsDAO { private IDbSession session; public LogsDAO(IDbSession session) { this.session = session; } private void AppendToLogs(string message) { session.ExecuteSqlWithParams(&quot;INSERT INTO &quot; + &quot;Logs(MsgDate, MsgText) VALUES({0},{1})&quot;, DateTime.Now, message); } } The LogsDAO and DbSession are now decoupled
  • 39. Decoupling Components LogsDAO DbSession depends on LogsDAO IDbSession depend on DbSession Highly-coupled components: Decoupled components:
  • 40. Dependency Injection (DI) Dependency Injection (DI) is the main method to implement Inversion of Control (IoC) pattern DI and IoC are considered the same concept DI separates behavior from dependency resolution and thus decouples highly dependent components Dependency injection means passing or setting of dependencies into a software component Instead of components having to request dependencies, they are passed (injected) into the component
  • 41. Types of Injection Dependency Injection (DI) usually runs with IoC Container (also called DI Container ) Types of dependency injection: Constructor injection – a dependency is passed to the constructor as a parameter Setter injection – a dependency is injected into the dependent object through a property setter Interface injection – an interface is used to inject a dependency into the dependent object IoC containers can inject dependencies automatically at run-time
  • 42. IoC Container – Example IoC containers have two main functions Register injectable classes Can be done declaratively (with XML or attributes) or programmatically (in C# code) Resolve already registered classes Done in C# code at runtime Dependency injection could be done automatically with no code E.g. autowire in Spring framework
  • 43. IoC Container – Example (2) Consider the following code: We want to use IoC container to resolve the dependency between our code and the logger public interface ILogger { void LogMessage(string msg); } public class ConsoleLogger : ILogger { public void LogMessage(string msg) { Console.WriteLine(msg); } }
  • 44. IoC Container – Example (3) Consider the IoC container provides the following methods: Registering the logger: Using the registered logger: IoC.Register<ILogger>(new ConsoleLogger()); ILogger logger = IoC.Resolve<ILogger>(); logger.LogMessage(&quot;Hello, world!&quot;);
  • 45. IoC Containers for .NET Microsoft ObjectBuilder; Microsoft Unity Open-source projects at CodePlex Part of Patterns & Practices Enterprise Library Spring.NET – www.springframework.net .NET port of the famous Spring framework from the Java world (currently owned by VMware) Castle Windsor – www.castleproject.org Open-source IoC container, part of the Castle project
  • 46. Microsoft Prism Patterns and Practices: Prism Patterns For Building Composite Applications With WPF and Silverlight Composite applications – consists of loosely coupled modules discoverable at runtime Prism components Prism Library Stock Trader Reference Implementation MVVM Reference Implementation QuickStarts
  • 47. Managed Extensibility Framework (MEF) Managed Extensibility Framework (MEF) Simplifies the design of extensible applications and components Official part of .NET Framework 4 Allows developers to discover and use extensions with no configuration at runtime lets extension developers easily encapsulate code and avoid fragile hard dependencies
  • 48. SOA (Service-Oriented Architecture) SOA and Cloud Computing
  • 49. What is SOA? Service-Oriented Architecture (SOA) is a concept for development of software systems Using reusable building blocks (components) called &quot;services&quot; Services in SOA are: Autonomous, stateless business functions Accept requests and return responses Use well-defined, standard interface
  • 50. SOA Services Autonomous Each service operates autonomously Without any awareness that other services exist Statelessa Have no memory, do not remember state Easy to scale Request-response model Client asks, server returns answer
  • 51. SOA Services (2) Communication through standard protocols XML, SOAP, JSON, RSS, ATOM, ... HTTP, FTP, SMTP, RPC, ... Not dependent on OS, platforms, programming languages Discoverable Service registries Could be hosted &quot;in the cloud&quot; (e.g. in Azure)
  • 52. What is Cloud Computing? Cloud computing is a modern approach in the IT infrastructure that provides : Software applications, services, hardware and system resources Hosts the applications and user data in remote servers called &quot;the cloud&quot; Cloud computing models : IaaS – infrastructure as a service (virtual servers) PaaS – platform as a service (full stack of technologies for UI , application logic, data storage) SaaS – software as a service (e.g. Google Docs)
  • 53. Loose Coupling Loose coupling is the main concept of SOA Loosely coupled components: Exhibits single function Independent of other functions Through a well-defined interface Loose coupling programming evolves: Structural programming Object-oriented programming Service-oriented architecture (SOA)
  • 54. SOA Design Patterns SOA Patterns – www.soapatterns.org Inventory Foundation, Logical Layer, Implementation, Governance Patterns Service Foundational, Implementation, Security, Contract , Governance , Messaging Patterns Legacy Encapsulation Patterns Capability Composition Patterns Composition Implementation Patterns Transformation Patterns Common Compound Design Patterns