This document provides an overview of a presentation on Domain Driven Design (DDD), Command Query Responsibility Segregation (CQRS), and testing with ASP.Net MVC. It introduces the presenter and gives an outline of the topics to be covered, including implementing DDD with ASP.Net MVC and Entity Framework, using a mediator pattern for CQRS, and unit testing models, queries, and commands. References are given to other authors and resources that influenced the approaches and implementations discussed in the presentation.
8 - OpenShift - A look at a container platform: what's in the box
Many already have some familiarity with containers, and maybe even with Kubernetes. But what's the difference between those and a container platform? In this session the goal is to look at OpenShift, Red Hat's container platform based on Kubernetes. We see what it's made out of, what makes it tick, and what the future of OpenShift & Kubernetes holds.
Docker allows building, shipping, and running applications in portable containers. It packages an application with all its dependencies into a standardized unit for software development. Major cloud providers and companies support and use Docker in production. Containers are more lightweight and efficient than virtual machines, providing faster launch times and allowing thousands to run simultaneously on the same server. Docker simplifies distributing applications and ensures a consistent environment.
Building on top of his talk at DockerCon 2015, Jana Radhakrishnan, Lead Software Engineer at Docker, does a deep dive into Docker Networking with additional demos and insights on the product roadmap.
This document provides an introduction to Docker. It begins by explaining the differences between bare metal servers, virtualization, and containerization. It then discusses how Docker uses containerization to package applications with their dependencies in lightweight containers that can run on any infrastructure. Key Docker concepts covered include images, containers, and the Docker engine. The document also briefly outlines Docker's history and commercial editions.
This document introduces Docker Compose, which allows defining and running multi-container Docker applications. It discusses that Docker Compose uses a YAML file to configure and run multi-service Docker apps. The 3 steps are to define services in a Dockerfile, define the app configuration in a Compose file, and run the containers with a single command. It also covers topics like networking, environment variables, and installing Docker Compose. Hands-on labs are provided to learn Compose through examples like WordPress.
This document discusses Docker containers and provides an introduction. It begins with an overview of Docker and how it uses containerization technology like Linux containers and namespaces to provide isolation. It describes how Docker images are composed of layers and how containers run from these images. The document then explains benefits of Docker like portability and ease of scaling. It provides details on Docker architecture and components like images, registries and containers. Finally, it demonstrates how to simply run a Docker container with a command.
This document summarizes a presentation about monitoring Elasticsearch in OpenShift. It discusses the challenges of running Elasticsearch in OpenShift due to limited resources, and how Prometheus and Grafana are used to monitor Elasticsearch metrics. It also describes the Elasticsearch Operator which manages Elasticsearch clusters through custom resource definitions. Skilled personnel are needed to maintain the cluster through upgrades and troubleshooting.
The document discusses using Terraform to automate deployment of resources in Oracle Cloud Infrastructure (OCI). It begins with an introduction to Terraform and its components like providers, modules, and backends. It then covers initial steps for setting up Terraform for OCI including installing Terraform, configuring the OCI provider, and running basic commands. The document outlines next steps like using Terraform to build small OCI infrastructures and combining configurations. It introduces using modules to define reusable infrastructure components. Finally, it provides an example of a Trivadis module for deploying a training lab environment on OCI.
Ansible is simple open source IT engine which automates application deployment,intra service orchestration,cloud provisioning and many other IT tools.we will discuss what is ansible ,its feature ,architecture,writing ansible playbook,ansible role and ansible vs chef.
There are many different approaches to how you let your microservices communicate between one another. Be it asynchronous or synchronous, choreographed or orchestrated, eventual consistent or distributedly transactional, fault tolerant or just a mess! In this session I will provide an overview on different concepts of microservice communication and their pros & cons. On the way I'll try to throw in some anecdotes, success stories and failures I learned from so that you can hopefully take something home with you.
Quarkus - a next-generation Kubernetes Native Java framework
For years, the client-server architecture has been the de-facto standard to build applications. But a major shift happened. The one model rules them all age is over. A new range of applications and architectures has emerged and impacts how code is written and how applications are deployed and executed. HTTP microservices, reactive applications, message-driven microservices, and serverless are now central players in modern systems.
Quarkus has been designed with this new world in mind and provides first-class support for these different paradigms. Developers using the Red Hat build of Quarkus can now choose between deploying natively compiled code or JVM-based code depending on an application’s needs. Natively compiled Quarkus applications are extremely fast and memory-efficient, making Quarkus a great choice for serverless and high-density cloud deployments.
Speakers
1) Shanna Chan, Senior Solutions Architect at Red Hat
2) Mark Baker, Senior Solutions Architect at Red Hat
Speaker Bios
Shanna Chan - Shanna is passionate about how open source solutions help others in their journey of application modernization and transformation of their business into cloud infrastructures. Her background includes application developments, DevOps, and architecting solutions for large enterprises. More about Shanna at http://linkedin.com/in/shanna-chan
Mark Baker - Mark’s experiences coalesce around solution /business architecture and leadership bringing together people in both post / pre-sales software projects bridging traditional legacy systems (i.e. Jakarta (JEE) MVC) with Cloud tolerant and Cloud native open source in the journey of modernization and transformation. More about Mark at http://linkedin.com/in/markwbaker-tsl
Finite-State Queries in Lucene:
* Background, improvement/evolution of MultiTermQuery API in 2.9 and Flex
* Implementing existing Lucene queries with NFA/DFA for better performance: Wildcard, Regex, Fuzzy
* How you can use this Query programmatically to improve relevance (I'll use an English test collection/English examples)
Quick overview of other Lucene features in development, such as:
* Flexible Indexing
* "More-Flexible" Scoring: challenges/supporting BM25, more vector-space models, field-specific scoring, etc.
* Improvements to analysis
Bonus:
* Lucene / Solr merger explanation and future plans
About the presenter:
Robert Muir is a super-active Lucene developer. He works as a software developer for Abraxas Corporation. Robert received his MS in Computer Science from Johns Hopkins and BS in CS from Radford University. For the last few years Robert has been working on foreign language NLP problems - "I really enjoy working with Lucene, as it's always receptive to better int'l/language support, even though everyone seems to be a performance freak... such a weird combination!"
마이크로서비스 스타일로 만들어진 시스템을 모노리틱 스타일로 이관한 사례와 함께 스프링을 이용해 모듈형 모노리스(modular monoliths)를 만든 경험을 바탕으로 모노리틱/마이크로서비스 보다 본질적인 문제를 제기하고, 문제 해결을 위한 생각을 공유합니다.
https://github.com/arawn/building-modular-monoliths-using-spring
Join Red Hat and Vodafone for an exciting presentation on the benefits of Quarkus over competing technologies. Hear from Vodafone's experts about their successful transition to Quarkus from Spring and discover how Quarkus can help your organization cut cloud costs, improve cluster stability, and achieve better performance.
A live demo will showcase the power of Quarkus through examples of HTTP requests, security approaches, exception handling, logging, and more.
In summary, this informative session will provide you valuable insights into the benefits of using Quarkus while also getting real world performance and development time numbers from Vodafone, information which can and should influence your next decisions on what Server Side Java technology to choose!
The document discusses hexagonal architecture, also known as ports and adapters architecture. It is an alternative to traditional multi-layer architectures that aims to decouple the application core from external influences like databases, web frameworks, and other dependencies. The core domain logic is separated from external influences by defining application programming interfaces (APIs) called "ports" that external "adapters" implement. This allows the core to be developed and tested in isolation. The document provides an example implementation of a ticket management system using this architecture.
Technologie ASP.NET MVC je rozšiřitelnější než se na první pohled může zdát! Pokročilejší přednáška pro ty, kteří už ASP.NET MVC někdy viděli, ukazuje, jak jednoduše upravit vestavěné routování, volání akčních metod, vyhledávání views, model binding, filtry... Na praktických příkladech bude ukázáno, jak využitím této rozšiřitelnosti dosáhnout elegantnějšího a čistšího kódu.
Este documento describe el diseño orientado a dominio (DDD), un estilo arquitectónico que separa la aplicación en capas lógicas centradas en el dominio del negocio. Explica que la capa del dominio contiene la lógica y reglas del negocio, mientras que las capas de interfaz de usuario, aplicación e infraestructura se encargan de la presentación, coordinación y almacenamiento respectivamente. También discute patrones como entidades, objetos de valor, repositorios y servicios que ayudan a modelar el dominio
The document summarizes Mohamed Meligy's presentation on the Razor view engine for ASP.NET MVC. It discusses basic Razor syntax elements and helpers, themes, compiled views, and tips for using Razor. Resources provided include links to documentation on Razor and ASP.NET helpers, sample applications, and profiles of key people involved in Razor's development.
This document discusses F# and how it compares to C#. It provides examples of how common programming tasks like defining classes, dependency injection, unit testing, mocking, and debugging are simpler in F#. F# is statically typed, functional-first, object-oriented, open source, and runs on .NET. Examples show how F# code for these tasks is shorter, easier to read, easier to refactor, and contains fewer bugs than equivalent C# code. The document promotes resources for learning more about F# and provides contact information.
The document discusses best practices for testing Rails controllers. It recommends writing declarative tests that focus on authentication, authorization, resource presence, and responses. Shared examples should be used to DRY up tests for these "small details". Tests for "big actions" like fetching a resource can be simple. Business logic belongs in models, not controllers. ActiveModel makes it easy to extract logic out of controllers and into reusable classes. Overall, the goal is to keep controllers simple and focused on their main responsibilities by writing declarative, well-factored tests.
First stab at some talk about testing in microsoft stuffs at enterprise companies without too much experience in TDD etc.
Images are all pilfered from google with no rights, if anybody wants to issue a takedown just ping me and I'll replace them with another.
This document provides an overview and introduction to ASP.NET MVC 3 training. It discusses the evolution of ASP.NET, key concepts of MVC like models, views, and controllers, how MVC works, and differences between MVC and web forms. The training will build a simple ASP.NET MVC application and cover controllers, models, views, routing, and action results.
Developing Event-driven Microservices with Event Sourcing & CQRS (gotoams)
The document discusses how to develop event-driven microservices using event sourcing and Command Query Responsibility Segregation (CQRS). It describes event sourcing, where events are stored instead of the current application state. Services update their own state by subscribing to events. CQRS is used to separate read models from write models so that queries can be optimized with materialized views of aggregated data. Implementing queries in an event-sourced application involves using separate query-side microservices to update and retrieve materialized views based on domain events from the event store.
Lars Thorup presents on unit testing JavaScript applications with the MVC pattern and QUnit testing framework. He discusses testing views, controllers, models, and services. The document recommends setting up tests for each component in isolation by injecting stubs for their dependencies. Asynchronous testing is also covered, including techniques like stopping/starting to synchronize async calls in tests. The MVC pattern with dependency injection is advocated to make the code more modular and testable.
The document discusses three "laws of test automation framework":
1) Test frameworks will continue growing unless changes are made, leading to complex step definitions and refactoring issues.
2) The more complex ("messy") a test framework becomes, the more effort is required to maintain it.
3) Changes to test frameworks can cause pushback from business and technical issues like merge conflicts and build failures.
The document promotes a Model-View-Controller approach to structure Cucumber tests to improve code quality and maintainability. Declarative styles are preferable to imperative to make tests more robust to business changes. Regular monitoring, desk checks, and appropriate timing of changes can help address challenges.
Blog post: http://WakeUpAndCode.com/asp-net-core-testing
Learn all about automated unit testing in ASP.NET Core 1.0 (formerly known as ASP.NET 5) and how you can set up Visual Studio so that you can quickly test your apps in the real world.
Este documento resume los conceptos clave del Domain-Driven Design (DDD), una metodología de desarrollo de software centrada en el dominio. Explica que DDD se enfoca en hacer que el modelo del dominio sea la parte central de la aplicación. También describe conceptos como el Lenguaje Ubícuo, la Ignorancia a la Persistencia, los Servicios del Dominio y los Repositorios. Finalmente, incluye una propuesta de arquitectura básica para implementar DDD con entidades, valores, agregados y factorías.
This document discusses Domain-Driven Design (DDD) and how it can be applied to ASP.NET MVC projects. It covers DDD concepts like ubiquitous language, bounded contexts, entities, value objects, domain services, and domain events. It also discusses how to structure an MVC project to separate the domain model from the rest of the application using patterns like layered architecture and ports and adapters. The document argues that DDD can provide benefits like flexibility, manageable complexity, and centralized business logic, though it may require more time and effort to implement.
A pattern language for microservices (#gluecon #gluecon2016)
This document discusses a pattern language for microservices. It begins by introducing the speaker and agenda. The core patterns of monolithic architecture and microservices architecture are described. Microservices address drawbacks of monolithic architecture by decomposing into independent services, though this introduces complexity. The document then discusses patterns for distributed data management with microservices like database per service, event-driven architecture using event sourcing, and command query responsibility segregation for queries. It concludes that patterns are useful for thinking about, discussing, and applying technology like microservices.
10 years after the release of the original book Domain Driven Design by Eric Evans we are seeing more and more applications built on the core concepts of DDD. Still, there is a long way to go before we fully grasp all its potential. First we need to change the way we do things in our projects. In this session I will show a possible implementation in C# that I've been using in many projects.
Microservices + Events + Docker = A Perfect Trio (dockercon)
Microservices are an essential enabler of agility but developing and deploying them is a challenge. In order for microservices to be loosely coupled,each service must have its own datastore. This makes it difficult to maintain data consistency across services.
Deploying microservices is also a complex problem since an application typically consists of 10s or 100s of services, written in a variety of languages and frameworks. In this presentation, you will learn how to solve these problems by using an event-driven architecture to maintain data consistency and by using Docker to simplify deployment.
This document provides an introduction to Docker and discusses how it helps address challenges in the modern IT landscape. Some key points:
- Applications are increasingly being broken up into microservices and deployed across multiple servers and environments, making portability and scalability important.
- Docker containers help address these issues by allowing applications to run reliably across different infrastructures through package dependencies and resources together. This improves portability.
- Docker provides a platform for building, shipping and running applications. It helps bridge the needs of developers who want fast innovation and operations teams who need security and control.
Jenkins is the leading open source continuous integration tool. It builds and tests our software continuously and monitors the execution and status of remote jobs, making it easier for team members and users to regularly obtain the latest stable code.
This document outlines the curriculum for an introduction to containerization presentation. It includes slides and hands-on exercises on installing Docker, building Docker images, running containers, viewing processes inside containers, and experimenting with resource isolation using cgroups and namespaces. Attendees will build a Docker image for a sample Flask application, run the container, view logs and processes, and push the image to Docker Hub. The presentation covers definitions of key containerization concepts and the benefits of using containers.
8 - OpenShift - A look at a container platform: what's in the boxKangaroot
Many already have some familiarity with containers, and maybe even with Kubernetes. But what's the difference between those and a container platform? In this session the goal is to look at OpenShift, Red Hat's container platform based on Kubernetes. We see what it's made out of, what makes it tick, and what the future of OpenShift & Kubernetes holds.
Docker allows building, shipping, and running applications in portable containers. It packages an application with all its dependencies into a standardized unit for software development. Major cloud providers and companies support and use Docker in production. Containers are more lightweight and efficient than virtual machines, providing faster launch times and allowing thousands to run simultaneously on the same server. Docker simplifies distributing applications and ensures a consistent environment.
Docker Online Meetup #22: Docker NetworkingDocker, Inc.
Building on top of his talk at DockerCon 2015, Jana Radhakrishnan, Lead Software Engineer at Docker, does a deep dive into Docker Networking with additional demos and insights on the product roadmap.
This document provides an introduction to Docker. It begins by explaining the differences between bare metal servers, virtualization, and containerization. It then discusses how Docker uses containerization to package applications with their dependencies in lightweight containers that can run on any infrastructure. Key Docker concepts covered include images, containers, and the Docker engine. The document also briefly outlines Docker's history and commercial editions.
This document introduces Docker Compose, which allows defining and running multi-container Docker applications. It discusses that Docker Compose uses a YAML file to configure and run multi-service Docker apps. The 3 steps are to define services in a Dockerfile, define the app configuration in a Compose file, and run the containers with a single command. It also covers topics like networking, environment variables, and installing Docker Compose. Hands-on labs are provided to learn Compose through examples like WordPress.
This document discusses Docker containers and provides an introduction. It begins with an overview of Docker and how it uses containerization technology like Linux containers and namespaces to provide isolation. It describes how Docker images are composed of layers and how containers run from these images. The document then explains benefits of Docker like portability and ease of scaling. It provides details on Docker architecture and components like images, registries and containers. Finally, it demonstrates how to simply run a Docker container with a command.
This document summarizes a presentation about monitoring Elasticsearch in OpenShift. It discusses the challenges of running Elasticsearch in OpenShift due to limited resources, and how Prometheus and Grafana are used to monitor Elasticsearch metrics. It also describes the Elasticsearch Operator which manages Elasticsearch clusters through custom resource definitions. Skilled personnel are needed to maintain the cluster through upgrades and troubleshooting.
The document discusses using Terraform to automate deployment of resources in Oracle Cloud Infrastructure (OCI). It begins with an introduction to Terraform and its components like providers, modules, and backends. It then covers initial steps for setting up Terraform for OCI including installing Terraform, configuring the OCI provider, and running basic commands. The document outlines next steps like using Terraform to build small OCI infrastructures and combining configurations. It introduces using modules to define reusable infrastructure components. Finally, it provides an example of a Trivadis module for deploying a training lab environment on OCI.
Ansible is simple open source IT engine which automates application deployment,intra service orchestration,cloud provisioning and many other IT tools.we will discuss what is ansible ,its feature ,architecture,writing ansible playbook,ansible role and ansible vs chef.
Communication in a Microservice ArchitecturePer Bernhardt
There are many different approaches to how you let your microservices communicate between one another. Be it asynchronous or synchronous, choreographed or orchestrated, eventual consistent or distributedly transactional, fault tolerant or just a mess! In this session I will provide an overview on different concepts of microservice communication and their pros & cons. On the way I'll try to throw in some anecdotes, success stories and failures I learned from so that you can hopefully take something home with you.
Quarkus - a next-generation Kubernetes Native Java frameworkSVDevOps
For years, the client-server architecture has been the de-facto standard to build applications. But a major shift happened. The one model rules them all age is over. A new range of applications and architectures has emerged and impacts how code is written and how applications are deployed and executed. HTTP microservices, reactive applications, message-driven microservices, and serverless are now central players in modern systems.
Quarkus has been designed with this new world in mind and provides first-class support for these different paradigms. Developers using the Red Hat build of Quarkus can now choose between deploying natively compiled code or JVM-based code depending on an application’s needs. Natively compiled Quarkus applications are extremely fast and memory-efficient, making Quarkus a great choice for serverless and high-density cloud deployments.
Speakers
1) Shanna Chan, Senior Solutions Architect at Red Hat
2) Mark Baker, Senior Solutions Architect at Red Hat
Speaker Bios
Shanna Chan - Shanna is passionate about how open source solutions help others in their journey of application modernization and transformation of their business into cloud infrastructures. Her background includes application developments, DevOps, and architecting solutions for large enterprises. More about Shanna at http://linkedin.com/in/shanna-chan
Mark Baker - Mark’s experiences coalesce around solution /business architecture and leadership bringing together people in both post / pre-sales software projects bridging traditional legacy systems (i.e. Jakarta (JEE) MVC) with Cloud tolerant and Cloud native open source in the journey of modernization and transformation. More about Mark at http://linkedin.com/in/markwbaker-tsl
Finite-State Queries in Lucene:
* Background, improvement/evolution of MultiTermQuery API in 2.9 and Flex
* Implementing existing Lucene queries with NFA/DFA for better performance: Wildcard, Regex, Fuzzy
* How you can use this Query programmatically to improve relevance (I'll use an English test collection/English examples)
Quick overview of other Lucene features in development, such as:
* Flexible Indexing
* "More-Flexible" Scoring: challenges/supporting BM25, more vector-space models, field-specific scoring, etc.
* Improvements to analysis
Bonus:
* Lucene / Solr merger explanation and future plans
About the presenter:
Robert Muir is a super-active Lucene developer. He works as a software developer for Abraxas Corporation. Robert received his MS in Computer Science from Johns Hopkins and BS in CS from Radford University. For the last few years Robert has been working on foreign language NLP problems - "I really enjoy working with Lucene, as it's always receptive to better int'l/language support, even though everyone seems to be a performance freak... such a weird combination!"
마이크로서비스 스타일로 만들어진 시스템을 모노리틱 스타일로 이관한 사례와 함께 스프링을 이용해 모듈형 모노리스(modular monoliths)를 만든 경험을 바탕으로 모노리틱/마이크로서비스 보다 본질적인 문제를 제기하고, 문제 해결을 위한 생각을 공유합니다.
https://github.com/arawn/building-modular-monoliths-using-spring
Join Red Hat and Vodafone for an exciting presentation on the benefits of Quarkus over competing technologies. Hear from Vodafone's experts about their successful transition to Quarkus from Spring and discover how Quarkus can help your organization cut cloud costs, improve cluster stability, and achieve better performance.
A live demo will showcase the power of Quarkus through examples of HTTP requests, security approaches, exception handling, logging, and more.
In summary, this informative session will provide you valuable insights into the benefits of using Quarkus while also getting real world performance and development time numbers from Vodafone, information which can and should influence your next decisions on what Server Side Java technology to choose!
The document discusses hexagonal architecture, also known as ports and adapters architecture. It is an alternative to traditional multi-layer architectures that aims to decouple the application core from external influences like databases, web frameworks, and other dependencies. The core domain logic is separated from external influences by defining application programming interfaces (APIs) called "ports" that external "adapters" implement. This allows the core to be developed and tested in isolation. The document provides an example implementation of a ticket management system using this architecture.
Technologie ASP.NET MVC je rozšiřitelnější než se na první pohled může zdát! Pokročilejší přednáška pro ty, kteří už ASP.NET MVC někdy viděli, ukazuje, jak jednoduše upravit vestavěné routování, volání akčních metod, vyhledávání views, model binding, filtry... Na praktických příkladech bude ukázáno, jak využitím této rozšiřitelnosti dosáhnout elegantnějšího a čistšího kódu.
Este documento describe el diseño orientado a dominio (DDD), un estilo arquitectónico que separa la aplicación en capas lógicas centradas en el dominio del negocio. Explica que la capa del dominio contiene la lógica y reglas del negocio, mientras que las capas de interfaz de usuario, aplicación e infraestructura se encargan de la presentación, coordinación y almacenamiento respectivamente. También discute patrones como entidades, objetos de valor, repositorios y servicios que ayudan a modelar el dominio
The document summarizes Mohamed Meligy's presentation on the Razor view engine for ASP.NET MVC. It discusses basic Razor syntax elements and helpers, themes, compiled views, and tips for using Razor. Resources provided include links to documentation on Razor and ASP.NET helpers, sample applications, and profiles of key people involved in Razor's development.
This document discusses F# and how it compares to C#. It provides examples of how common programming tasks like defining classes, dependency injection, unit testing, mocking, and debugging are simpler in F#. F# is statically typed, functional-first, object-oriented, open source, and runs on .NET. Examples show how F# code for these tasks is shorter, easier to read, easier to refactor, and contains fewer bugs than equivalent C# code. The document promotes resources for learning more about F# and provides contact information.
The document discusses best practices for testing Rails controllers. It recommends writing declarative tests that focus on authentication, authorization, resource presence, and responses. Shared examples should be used to DRY up tests for these "small details". Tests for "big actions" like fetching a resource can be simple. Business logic belongs in models, not controllers. ActiveModel makes it easy to extract logic out of controllers and into reusable classes. Overall, the goal is to keep controllers simple and focused on their main responsibilities by writing declarative, well-factored tests.
Focus on the outside, testing in ASP.NET MVCRob Ashton
First stab at some talk about testing in microsoft stuffs at enterprise companies without too much experience in TDD etc.
Images are all pilfered from google with no rights, if anybody wants to issue a takedown just ping me and I'll replace them with another.
This document provides an overview and introduction to ASP.NET MVC 3 training. It discusses the evolution of ASP.NET, key concepts of MVC like models, views, and controllers, how MVC works, and differences between MVC and web forms. The training will build a simple ASP.NET MVC application and cover controllers, models, views, routing, and action results.
Developing Event-driven Microservices with Event Sourcing & CQRS (gotoams)Chris Richardson
The document discusses how to develop event-driven microservices using event sourcing and Command Query Responsibility Segregation (CQRS). It describes event sourcing, where events are stored instead of the current application state. Services update their own state by subscribing to events. CQRS is used to separate read models from write models so that queries can be optimized with materialized views of aggregated data. Implementing queries in an event-sourced application involves using separate query-side microservices to update and retrieve materialized views based on domain events from the event store.
Unit Testing in JavaScript with MVC and QUnitLars Thorup
Lars Thorup presents on unit testing JavaScript applications with the MVC pattern and QUnit testing framework. He discusses testing views, controllers, models, and services. The document recommends setting up tests for each component in isolation by injecting stubs for their dependencies. Asynchronous testing is also covered, including techniques like stopping/starting to synchronize async calls in tests. The MVC pattern with dependency injection is advocated to make the code more modular and testable.
The document discusses three "laws of test automation framework":
1) Test frameworks will continue growing unless changes are made, leading to complex step definitions and refactoring issues.
2) The more complex ("messy") a test framework becomes, the more effort is required to maintain it.
3) Changes to test frameworks can cause pushback from business and technical issues like merge conflicts and build failures.
The document promotes a Model-View-Controller approach to structure Cucumber tests to improve code quality and maintainability. Declarative styles are preferable to imperative to make tests more robust to business changes. Regular monitoring, desk checks, and appropriate timing of changes can help address challenges.
Blog post: http://WakeUpAndCode.com/asp-net-core-testing
Learn all about automated unit testing in ASP.NET Core 1.0 (formerly known as ASP.NET 5) and how you can set up Visual Studio so that you can quickly test your apps in the real world.
Este documento resume los conceptos clave del Domain-Driven Design (DDD), una metodología de desarrollo de software centrada en el dominio. Explica que DDD se enfoca en hacer que el modelo del dominio sea la parte central de la aplicación. También describe conceptos como el Lenguaje Ubícuo, la Ignorancia a la Persistencia, los Servicios del Dominio y los Repositorios. Finalmente, incluye una propuesta de arquitectura básica para implementar DDD con entidades, valores, agregados y factorías.
This document discusses Domain-Driven Design (DDD) and how it can be applied to ASP.NET MVC projects. It covers DDD concepts like ubiquitous language, bounded contexts, entities, value objects, domain services, and domain events. It also discusses how to structure an MVC project to separate the domain model from the rest of the application using patterns like layered architecture and ports and adapters. The document argues that DDD can provide benefits like flexibility, manageable complexity, and centralized business logic, though it may require more time and effort to implement.
A pattern language for microservices (#gluecon #gluecon2016)Chris Richardson
This document discusses a pattern language for microservices. It begins by introducing the speaker and agenda. The core patterns of monolithic architecture and microservices architecture are described. Microservices address drawbacks of monolithic architecture by decomposing into independent services, though this introduces complexity. The document then discusses patterns for distributed data management with microservices like database per service, event-driven architecture using event sourcing, and command query responsibility segregation for queries. It concludes that patterns are useful for thinking about, discussing, and applying technology like microservices.
10 years after the release of the original book Domain Driven Design by Eric Evans we are seeing more and more applications built on the core concepts of DDD. Still, there is a long way to go before we fully grasp all its potential. First we need to change the way we do things in our projects. In this session I will show a possible implementation in C# that I've been using in many projects.
Microservices are an essential enabler of agility but developing and deploying them is a challenge. In order for microservices to be loosely coupled,each service must have its own datastore. This makes it difficult to maintain data consistency across services.
Deploying microservices is also a complex problem since an application typically consists of 10s or 100s of services, written in a variety of languages and frameworks. In this presentation, you will learn how to solve these problems by using an event-driven architecture to maintain data consistency and by using Docker to simplify deployment.
Developing microservices with aggregates (SpringOne platform, #s1p)Chris Richardson
The Domain Model pattern is a great way to develop complex business logic. Unfortunately, a typical domain model is a tangled, birds nest of classes. It can’t be decomposed into microservices. Moreover, business logic often relies on ACID transactions to maintain consistency.
Fortunately, there is a solution to this problem: aggregates. An aggregate is an often overlooked modeling concept from the must read book Domain Driven Design. In this talk you will learn how aggregates enable you to develop business logic for the modern world of microservices and NoSQL. We will describe how to use aggregates to design modular business logic that can be partitioned into microservices. You will learn how aggregates enable you to use eventual consistency instead of ACID. We will describe the design of a microservice that is built using aggregates, and Spring Cloud.
CQRS and Event Sourcing are popular architectural patterns that allow you to build effective event-driven micro-services.
The basic idea of these patterns is to record each event that changes the state of the domain model into the event-storage.
This approach allows you to reduce service latency for any data scale, as well as be able to restore the system without losing any data.
Getting started with MVC 5 and Visual Studio 2013Thomas Robbins
The ASP.NET MVC Framework provides a powerful Model View Controller (MVC) approach to building web applications and provides separation of concerns, control over HTML output, intuitive URLs, and increased testability. We will start by looking at the what and why of ASP.NET MVC. Then we will explore the various pieces of ASP.NET MVC including routes, controllers, actions, and views. If you are looking to get started with MVC then don’t miss this session.
This document introduces Luis Majano and provides an overview of Model-View-Controller (MVC) patterns and the ColdBox framework. It discusses the problems with traditional ColdFusion code using a single CFM page and the benefits of separating concerns using MVC. ColdBox is introduced as a HMVC framework that follows conventions and addresses common infrastructure needs. It describes how ColdBox works using routed URLs and handlers, and shows examples of handler, model, layout, and view code. The rendering process and use of the request context and private request context are also summarized.
The document discusses ASP.NET MVC and some of its key concepts and advantages over traditional ASP.NET Web Forms. It notes that MVC enables clean separation of concerns, extensibility, clean URLs and HTML. Some key aspects of MVC covered include controllers, actions, routes, models, views, HTML helpers, validation, and areas. It emphasizes that MVC exposes the stateless nature of HTTP and makes the framework more testable compared to Web Forms.
Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...Alex Maclinovsky
The paper presented on Cloud slam 2014 cloud computing conference. It is based on the work I have done while working as a Technology Principal and Cloud Innovation Lead at Global Technology Consulting Firm. It describes unique challenges encountered during the development of a Cloud Broker. Designed to provide seamless and uniform user experience as well as additional enterprise-level capabilities over a broad range of public and private cloud platforms, the broker had to work with a wide variety of diverse cloud APIs. And, in order to allow rapid onboarding of new target clouds, we had to design the system to operate in a generic cloud-agnostic way. We have reviewed and tried quite a few of available cloud integration technologies, both commercial and open-source as a foundation for our cloud abstraction and mediation layer. Couple seemed to be a good choice and, in theory, should have served all our needs, but in the course of development we found that the problem was far more complex than we (and the rest of the market) had anticipated. As we were building our system, we discovered that there was not just one, but 3 different levels of mediation required to build a truly cloud-agnostic solution: syntactic, semantic and idiosyncratic and even the best off-the-shelf solution will not be able to give us that last two out of the box. The final part of the presentation describes the architecture that allows to realize our goals and build the universal broker.
This document provides an overview of ASP.NET MVC 2.0, covering topics such as routing, controllers, action methods, views, validation, and filters. It introduces the MVC framework's basic structure and components, and explains how to build a sample Todo application using ASP.NET MVC to manage tasks. The document also outlines some advanced features in ASP.NET MVC 2.0 like areas and asynchronous controllers, as well as new capabilities in ASP.NET MVC 3 Beta such as the Razor view engine and improved dependency injection support.
This document discusses microservices using Node.js and JavaScript. It covers building an HTTP microservice with Express including routing, structure, database integration, logging and testing. It also discusses building command-based microservices with Seneca including patterns, plugins, and queueing. Finally, it discusses containerization with Docker, API gateways, testing, process management with PM2, and some considerations around when microservices may not be the best solution.
The document provides information on ASP.NET MVC, including:
- ASP.NET MVC is a framework for building web apps in .NET using C# or VB.NET that follows the MVC pattern.
- MVC stands for Model-View-Controller, with models containing data, views presenting user interfaces, and controllers coordinating data retrieval and user input.
- ASP.NET MVC provides separation of concerns, testability, and more control over HTML compared to ASP.NET Web Forms.
The document provides an overview of ASP.NET MVC, including:
- ASP.NET MVC is a framework for building web apps using Model-View-Controller (MVC) pattern on the .NET platform.
- MVC separates an app into three main components: Models for data, Views for presentation, and Controllers for logic/app flow.
- Key advantages include easier management of complexity, testability, and control over HTML.
Asp.net mvc presentation by Nitin SawantNitin Sawant
The document provides an introduction to ASP.NET MVC, including definitions of MVC and its components. It discusses the pros and cons of traditional ASP.NET WebForms compared to MVC. Key aspects of MVC like models, views, controllers, routing and HTML helpers are described at a high level. Popular MVC frameworks for different programming languages are also listed.
The document introduces Test Driven Development (TDD), Continuous Integration (CI), Inversion of Control (IoC), and Aspect Oriented Programming (AOP). It discusses TDD principles and tools for writing tests first before code. CI aims to integrate code changes frequently to prevent integration problems. IoC and dependency injection improve software design by reducing coupling between components. AOP allows cross-cutting concerns like logging to be coded separately from the main program logic.
This talk lays out the elements of an extension including the content model, JS API, Web Scripts, Content Policies, Action Executors, Web Scripts and more. This will draw on years of experience delivering extensions to various projects.
There is a code sample in github: https://github.com/rmknightstar/devcon2018
You can see the presentation as given at the Alfresco Developer Conference here : https://youtu.be/CKRswhh-jHE?list=PLyJdWuUHM3igOUt49uiFqs-6DCQAgJ1vs&t=0
The document discusses various topics related to Entity Framework (EF) and ORM usage in .NET development. It provides a brief history of ORM tools for .NET, examines common developer opinions on EF, discusses some performance and other technical issues with EF, and provides tips and examples for optimizing EF usage and queries. The document aims to help .NET developers understand both the benefits and challenges of using an ORM like EF in their projects.
Con MongoDB 3.6, podrá avanzar al ritmo que marcan sus datos. Los plazos de lanzamiento de las nuevas aplicaciones se acelerarán, y estas funcionarán de forma segura y fiable en entornos de cualquier tamaño, además de aportar información útil en tiempo real. https://www.mongodb.com/mongodb-3.6
You can find the first part of this presentation here: https://www.slideshare.net/secret/pAvK8Qd9f07oa
This presentation takes a deep dive into how the Million Song Library, a microservices-based application, was built using the Netflix Stack, Cassandra and Datastax.
To learn more about Million Song Library and its components visit the project on GitHub: https://github.com/kenzanlabs/million-song-library
Lea
Apache Cayenne is an open source object-relational mapping framework for Java. It has been an Apache project since 2006 and has over 17 committers and 9 project management committee members. Cayenne provides tools for mapping database schemas to Java objects and vice versa, as well as tools for querying, caching query results, and handling object lifecycles. It aims to simplify working with relational databases for Java developers in a similar way to how Enterprise Objects Framework simplified it for Objective-C developers.
El camino a las Cloud Native Apps - IntroductionPlain Concepts
The document discusses serverless computing and Azure Functions. It provides examples of how to model common patterns like function chaining, fan-out/fan-in, and human interaction with timeouts using Durable Functions. Durable Functions allow writing long-running orchestrations as single functions and handling state management automatically. This simplifies complex workflows that would otherwise require managing state across many functions.
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...CodeMill digital skills
Details
Alexandra Carter - Callcredit, Numero and Microsoft: Containerisation Hack of a Legacy Software Solution
This is the story of how we took a legacy solution and pushed it into containers on windows in just three days. This was also a great chance to work with Microsoft at the cutting edge of their work on containerisation, VSTS and Azure. Moving on from our Hackathon, we have continued adding new components, experimenting with orchestration and showcasing our work. I’ll talk you through the prep work, the 3 day hack and the subsequent work; what it means for the product roadmap, the experimentation we have done and how stakeholders are responding. Finally, we’ll look ahead to next steps.
Case study: https://microsoft.github.io/techcasestudies/devops/2017/06/16/Callcredit_DevOps.html
Alex Carter
"I have worked in IT, Marketing, Software Support and Software Delivery before moving into my current System Build (DevOps) role within Callcredit. I live and breathe DevOps and am currently focussing on anything around containerisation in Windows. A day without Metal and motor racing is a dull one."
@smileandeliver (https://twitter.com/smileandeliver)
From CodeMill digital skills meetup https://www.meetup.com/CodeMill-Digital-Skills/events/243110732/
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfjackson110191
These fighter aircraft have uses outside of traditional combat situations. They are essential in defending India's territorial integrity, averting dangers, and delivering aid to those in need during natural calamities. Additionally, the IAF improves its interoperability and fortifies international military alliances by working together and conducting joint exercises with other air forces.
Quality Patents: Patents That Stand the Test of TimeAurora Consulting
Is your patent a vanity piece of paper for your office wall? Or is it a reliable, defendable, assertable, property right? The difference is often quality.
Is your patent simply a transactional cost and a large pile of legal bills for your startup? Or is it a leverageable asset worthy of attracting precious investment dollars, worth its cost in multiples of valuation? The difference is often quality.
Is your patent application only good enough to get through the examination process? Or has it been crafted to stand the tests of time and varied audiences if you later need to assert that document against an infringer, find yourself litigating with it in an Article 3 Court at the hands of a judge and jury, God forbid, end up having to defend its validity at the PTAB, or even needing to use it to block pirated imports at the International Trade Commission? The difference is often quality.
Quality will be our focus for a good chunk of the remainder of this season. What goes into a quality patent, and where possible, how do you get it without breaking the bank?
** Episode Overview **
In this first episode of our quality series, Kristen Hansen and the panel discuss:
⦿ What do we mean when we say patent quality?
⦿ Why is patent quality important?
⦿ How to balance quality and budget
⦿ The importance of searching, continuations, and draftsperson domain expertise
⦿ Very practical tips, tricks, examples, and Kristen’s Musts for drafting quality applications
https://www.aurorapatents.com/patently-strategic-podcast.html
How RPA Help in the Transportation and Logistics Industry.pptxSynapseIndia
Revolutionize your transportation processes with our cutting-edge RPA software. Automate repetitive tasks, reduce costs, and enhance efficiency in the logistics sector with our advanced solutions.
Best Practices for Effectively Running dbt in Airflow.pdfTatiana Al-Chueyr
As a popular open-source library for analytics engineering, dbt is often used in combination with Airflow. Orchestrating and executing dbt models as DAGs ensures an additional layer of control over tasks, observability, and provides a reliable, scalable environment to run dbt models.
This webinar will cover a step-by-step guide to Cosmos, an open source package from Astronomer that helps you easily run your dbt Core projects as Airflow DAGs and Task Groups, all with just a few lines of code. We’ll walk through:
- Standard ways of running dbt (and when to utilize other methods)
- How Cosmos can be used to run and visualize your dbt projects in Airflow
- Common challenges and how to address them, including performance, dependency conflicts, and more
- How running dbt projects in Airflow helps with cost optimization
Webinar given on 9 July 2024
The DealBook is our annual overview of the Ukrainian tech investment industry. This edition comprehensively covers the full year 2023 and the first deals of 2024.
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionBert Blevins
Cybersecurity is a major concern in today's connected digital world. Threats to organizations are constantly evolving and have the potential to compromise sensitive information, disrupt operations, and lead to significant financial losses. Traditional cybersecurity techniques often fall short against modern attackers. Therefore, advanced techniques for cyber security analysis and anomaly detection are essential for protecting digital assets. This blog explores these cutting-edge methods, providing a comprehensive overview of their application and importance.
Mitigating the Impact of State Management in Cloud Stream Processing SystemsScyllaDB
Stream processing is a crucial component of modern data infrastructure, but constructing an efficient and scalable stream processing system can be challenging. Decoupling compute and storage architecture has emerged as an effective solution to these challenges, but it can introduce high latency issues, especially when dealing with complex continuous queries that necessitate managing extra-large internal states.
In this talk, we focus on addressing the high latency issues associated with S3 storage in stream processing systems that employ a decoupled compute and storage architecture. We delve into the root causes of latency in this context and explore various techniques to minimize the impact of S3 latency on stream processing performance. Our proposed approach is to implement a tiered storage mechanism that leverages a blend of high-performance and low-cost storage tiers to reduce data movement between the compute and storage layers while maintaining efficient processing.
Throughout the talk, we will present experimental results that demonstrate the effectiveness of our approach in mitigating the impact of S3 latency on stream processing. By the end of the talk, attendees will have gained insights into how to optimize their stream processing systems for reduced latency and improved cost-efficiency.
Support en anglais diffusé lors de l'événement 100% IA organisé dans les locaux parisiens d'Iguane Solutions, le mardi 2 juillet 2024 :
- Présentation de notre plateforme IA plug and play : ses fonctionnalités avancées, telles que son interface utilisateur intuitive, son copilot puissant et des outils de monitoring performants.
- REX client : Cyril Janssens, CTO d’ easybourse, partage son expérience d’utilisation de notre plateforme IA plug & play.
Implementations of Fused Deposition Modeling in real worldEmerging Tech
The presentation showcases the diverse real-world applications of Fused Deposition Modeling (FDM) across multiple industries:
1. **Manufacturing**: FDM is utilized in manufacturing for rapid prototyping, creating custom tools and fixtures, and producing functional end-use parts. Companies leverage its cost-effectiveness and flexibility to streamline production processes.
2. **Medical**: In the medical field, FDM is used to create patient-specific anatomical models, surgical guides, and prosthetics. Its ability to produce precise and biocompatible parts supports advancements in personalized healthcare solutions.
3. **Education**: FDM plays a crucial role in education by enabling students to learn about design and engineering through hands-on 3D printing projects. It promotes innovation and practical skill development in STEM disciplines.
4. **Science**: Researchers use FDM to prototype equipment for scientific experiments, build custom laboratory tools, and create models for visualization and testing purposes. It facilitates rapid iteration and customization in scientific endeavors.
5. **Automotive**: Automotive manufacturers employ FDM for prototyping vehicle components, tooling for assembly lines, and customized parts. It speeds up the design validation process and enhances efficiency in automotive engineering.
6. **Consumer Electronics**: FDM is utilized in consumer electronics for designing and prototyping product enclosures, casings, and internal components. It enables rapid iteration and customization to meet evolving consumer demands.
7. **Robotics**: Robotics engineers leverage FDM to prototype robot parts, create lightweight and durable components, and customize robot designs for specific applications. It supports innovation and optimization in robotic systems.
8. **Aerospace**: In aerospace, FDM is used to manufacture lightweight parts, complex geometries, and prototypes of aircraft components. It contributes to cost reduction, faster production cycles, and weight savings in aerospace engineering.
9. **Architecture**: Architects utilize FDM for creating detailed architectural models, prototypes of building components, and intricate designs. It aids in visualizing concepts, testing structural integrity, and communicating design ideas effectively.
Each industry example demonstrates how FDM enhances innovation, accelerates product development, and addresses specific challenges through advanced manufacturing capabilities.
An invited talk given by Mark Billinghurst on Research Directions for Cross Reality Interfaces. This was given on July 2nd 2024 as part of the 2024 Summer School on Cross Reality in Hagenberg, Austria (July 1st - 7th)
Are you interested in dipping your toes in the cloud native observability waters, but as an engineer you are not sure where to get started with tracing problems through your microservices and application landscapes on Kubernetes? Then this is the session for you, where we take you on your first steps in an active open-source project that offers a buffet of languages, challenges, and opportunities for getting started with telemetry data.
The project is called openTelemetry, but before diving into the specifics, we’ll start with de-mystifying key concepts and terms such as observability, telemetry, instrumentation, cardinality, percentile to lay a foundation. After understanding the nuts and bolts of observability and distributed traces, we’ll explore the openTelemetry community; its Special Interest Groups (SIGs), repositories, and how to become not only an end-user, but possibly a contributor.We will wrap up with an overview of the components in this project, such as the Collector, the OpenTelemetry protocol (OTLP), its APIs, and its SDKs.
Attendees will leave with an understanding of key observability concepts, become grounded in distributed tracing terminology, be aware of the components of openTelemetry, and know how to take their first steps to an open-source contribution!
Key Takeaways: Open source, vendor neutral instrumentation is an exciting new reality as the industry standardizes on openTelemetry for observability. OpenTelemetry is on a mission to enable effective observability by making high-quality, portable telemetry ubiquitous. The world of observability and monitoring today has a steep learning curve and in order to achieve ubiquity, the project would benefit from growing our contributor community.
7 Most Powerful Solar Storms in the History of Earth.pdfEnterprise Wired
Solar Storms (Geo Magnetic Storms) are the motion of accelerated charged particles in the solar environment with high velocities due to the coronal mass ejection (CME).
Coordinate Systems in FME 101 - Webinar SlidesSafe Software
If you’ve ever had to analyze a map or GPS data, chances are you’ve encountered and even worked with coordinate systems. As historical data continually updates through GPS, understanding coordinate systems is increasingly crucial. However, not everyone knows why they exist or how to effectively use them for data-driven insights.
During this webinar, you’ll learn exactly what coordinate systems are and how you can use FME to maintain and transform your data’s coordinate systems in an easy-to-digest way, accurately representing the geographical space that it exists within. During this webinar, you will have the chance to:
- Enhance Your Understanding: Gain a clear overview of what coordinate systems are and their value
- Learn Practical Applications: Why we need datams and projections, plus units between coordinate systems
- Maximize with FME: Understand how FME handles coordinate systems, including a brief summary of the 3 main reprojectors
- Custom Coordinate Systems: Learn how to work with FME and coordinate systems beyond what is natively supported
- Look Ahead: Gain insights into where FME is headed with coordinate systems in the future
Don’t miss the opportunity to improve the value you receive from your coordinate system data, ultimately allowing you to streamline your data analysis and maximize your time. See you there!
Measuring the Impact of Network Latency at TwitterScyllaDB
Widya Salim and Victor Ma will outline the causal impact analysis, framework, and key learnings used to quantify the impact of reducing Twitter's network latency.
2. Just to introduce myself…
• I’m Andy Butland
• Blog (sporadically) at http://web-matters.blogspot.it/
• Find here a copy of slides and links to various resources
• Contact: abutland73@gmail.com / @andybutland
• I work for Zone – www.thisiszone.com - a digital agency
where I’m head of .NET development
• We develop web sites and applications using ASP.Net
MVC and CMS platforms such as Umbraco and EPiServer
• We’re primarily UK based, in London and Bristol
• But I’m lucky enough to live…
4. And what are we talking about…
• We’ll be discussing some practices I follow when building
web applications using ASP.Net MVC
• Digested and adapted from various opinions
• Adopting best practices but in a practical way
• For me at least… leads to a nicely organised, testable and
maintainable code base
5. Standing on the shoulders…
• Much of what follows comes from various speakers,
bloggers and writers in the .Net community
• Finally read “Domain Driven Design” by Eric Evans
• Rob Conery questioned some of practices around use of
repositories
• Blog series on DDD, CQRS and other MVC practices from Jimmy
Bogard and Gabriel Schenker at lostechies.com
• Julie Lerman’s articles on DDD with Entity Framework at MSDN
• Adam Tibi’s implementation of a CQRS pattern using the IoC
container Ninject was heavily borrowed for my own use
6. Contents
1
2
3
4
DDD with ASP.Net MVC
and Entity Framework
CQRS using a mediator
pattern
Wrap up and Q&A
Unit testing our model,
queries and commands
8. Domain driven design (DDD)
• Close replication of the real-world, business problem
• Focussed on an appropriate area of application
responsibility – the “bounded context”
• Sharing of domain knowledge and vocabulary between
business experts, developers and, importantly, the
software itself – the “ubiquitous language”
9. A rich domain model
• In essence, a DDD approach looks to push more logic
and behaviour to the application’s core model classes
• Contrasted with an “anaemic” domain model
• Consider the domain as an “API” that you provide to the rest of the
application – providing appropriate access points and retaining
control
• Lean more on code and less on SQL/data access
• More expressive, easier to write and maintain – and test
• But careful balance needed as can’t forget performance
10. Control via the constructor
• Avoid a public, parameterless, default constructor
• Prevents the instantiation of invalid objects by application code via
the {} syntax, e.g.
var product = new Product { Name = “Test product” };
11. private Question()
{
Options = new List<QuestionOption>();
}
public Question(string code, string text, int orderInSection,
QuestionSection section, QuestionType type)
: this()
{
Code = code;
Text = text;
OrderInSection = orderInSection;
Section = section;
Type = type;
}
EF requires a
parameter-less
constructor, but it can
be private.
By requiring the rest of the application to
only call this constructor, we can ensure we
have a valid initialisation of an instance.
12. Control of property access
• Use private property setters to prevent direct access to
properties
• Prevents the modification of an instance into an invalid state
• Instead provide validated methods to allow related property values
to be set together, ensuring a consistent state is maintained
13. public int? NumericalMin { get; private set; }
public int? NumericalMax { get; private set; }
public void SetNumericalRange(int min, int max)
{
if (min > max)
{
throw new ArgumentException(
“Max parameter must be greater than the min parameter.");
}
NumericalMin = min;
NumericalMax = max;
}
Properties can’t be set
directly
Instead a method must be called, which
can validate and ensure related properties
are populated together.
14. Move behaviour into the model
• Where possible implement business logic in the domain
model objects
• Object graph must be populated sufficiently to support the behaviour
• Being POCO classes, there are no dependencies that complicate
unit testing
15. public int GetMaximumAvailableScore()
{
if (Type.Id == (int)QuestionTypeId.MultipleSelect)
{
return Options.Sum(x => x.Score);
}
else if (Type.Id == (int)QuestionTypeId.SingleSelect)
{
return Options.Max(x => x.Score);
}
else
{
return 0;
}
}
Logic can be
encapsulated in
methods…
18. Command Query Responsibility Segregation
• In essence, CQRS involves a separation between read
and write operations in an application
• At scale we may have separate models – one highly
cached and de-normalised for reads, and a strict,
validated model for writes
• Related concepts – “event sourcing”, “eventual
consistency” – may be appropriate in certain situations
• Even for small to medium scale applications though,
CQRS has benefits over a more typical CRUD style
19. Benefits of CQRS
• “Slices over layers” – breaking down application by
features rather than technical tiers
• More meaningful data operations over CRUD using the
“ubiquitous language”
• e.g. “ShipOrderCommand” versus “SaveOrder(Order
order)”
• Single, discrete transactions with the ORM
• More… but smaller, more focussed and single
responsibility principle adhering classes
20. MVC CQRS Pattern:
Reads
CONTROLLER VIEW
VIEW
MODEL
VIEW MODEL
QUERY
HANDLER
VIEW MODEL
QUERY
DATABASE
Retrieve domain model objects
via the Entity Framework
context
Map to view model using
AutoMapper
View model passed to
strongly typed view
Query passed as a GET parameter
to the controller action method:
• Might be a simple Id
• Or something more complex for
a search feature
QUERY
DISPATCHER
Controller calls query dispatcher
passing query.
Appropriate query handler is found
from view model and query types
(using Ninject)
21. MVC CQRS Pattern:
Writes
CONTROLLER
COMMAND
RESULT
COMMAND
HANDLER
COMMAND
DATABASE
Retrieve and update domain
model objects
and persist via the EF context
Simple command result is
returned (success flag,
error message and -
sometimes - return data).
Command may be POSTed as a
parameter to the controller action
method or created within the method
COMMAND
DISPATCHER
Controller calls command dispatcher
passing command.
Appropriate command handler is found
from command type
(using Ninject)
22. MVC CQRS Pattern:
Validated Writes
CONTROLLER
COMMAND
RESULT
COMMAND
HANDLER
COMMAND
DATABASE
Map to domain model objects
and persist via the Entity
Framework context
Simple command result is
returned
Validated view model is mapped to command
COMMAND
DISPATCHER
Controller calls command dispatcher
passing command.
Appropriate command handler is found
from command type
(using Ninject)
VIEW
MODEL
VIEW
View model is model bound to controller action
method from form POST and validated.
In case of validation error, view model
is re-populated and returned to view.
23. public abstract class BaseController : Controller
{
public BaseController(IQueryDispatcher queryDispatcher,
ICommandDispatcher commandDispatcher)
{
QueryDispatcher = queryDispatcher;
CommandDispatcher = commandDispatcher;
}
}
Base controller has injected
dependencies for dispatching queries
and commands.
All controllers inherit from this.
24. private static void RegisterServices(IKernel kernel)
{
kernel.Bind<IQueryDispatcher>().To<QueryDispatcher>();
kernel.Bind<ICommandDispatcher>().To<CommandDispatcher>();
kernel.Bind(x => x
.FromAssembliesMatching(“MyApplication.dll")
.SelectAllClasses().InheritedFrom(typeof(IQueryHandler<,>))
.BindAllInterfaces());
kernel.Bind(x => x
.FromAssembliesMatching(“MyApplication.dll")
.SelectAllClasses().InheritedFrom(typeof(ICommandHandler<>))
.BindAllInterfaces());
}
Resolved using Ninject IoC container
Which also handles the convention
based matching of the appropriate
handler to each query and command
25. public interface IQueryDispatcher
{
Task<TResult> Dispatch<TParameter, TResult>(TParameter query)
where TParameter : IQuery
where TResult : IQueryResult;
}
The query dispatcher has a single
method that takes two type
parameters: the query definition
and the query result.
It takes the query definition as the
argument and asynchronously
returns the result.
26. public class QueryDispatcher : IQueryDispatcher
{
private readonly IKernel _kernel;
public QueryDispatcher(IKernel kernel)
{
_kernel = kernel;
}
public async Task<TResult> Dispatch<TParameter, TResult>
(TParameter query)
where TParameter : IQuery
where TResult : IQueryResult
{
var handler = _kernel.Get<IQueryHandler<TParameter, TResult>>();
return await handler.Retrieve(query);
}
}
The implementation retrieves the
appropriate handler based on the
type parameters from the services
registered with the Ninject IoC
container.
27. public interface ICommandDispatcher
{
Task<CommandResult> Dispatch<TParameter>(TParameter command)
where TParameter : ICommand;
}
Similarly the command dispatcher
has a single method that takes a
single type parameters: the
command definition.
It takes the command definition as
the argument, asynchronously
process it and return a status result.
28. public class CommandDispatcher : ICommandDispatcher
{
private readonly IKernel _kernel;
public CommandDispatcher(IKernel kernel)
{
_kernel = kernel;
}
public async Task<CommandResult> Dispatch<TParameter>
(TParameter command)
where TParameter : ICommand
{
var handler = _kernel.Get<ICommandHandler<TParameter>>();
return await handler.Execute(command);
}
}
The implementation retrieves
the appropriate handler based
on the type parameter from the
services registered with the
Ninject IoC container.
29. public class CommandResult
{
public bool Success { get; set; }
public string Message { get; set; }
public object Data { get; set; }
}
The simple command result usually
just returns the status of the
command.
On occasion it’s useful to return
some data, most often the Id of a
newly generated record.
30. public async Task<ViewResult> Details(DetailsViewModelQuery query)
{
var vm = await QueryDispatcher.Dispatch<DetailsViewModelQuery,
DetailsViewModel>(query);
return View("Details", vm);
}
The controller action method is very
thin, delegating immediately to the
query dispatcher to create the view
model.
The query definition may
be as simple as the Id of
the record to retrieve.
31. public class DetailsViewModelQueryHandler :
IQueryHandler<DetailsViewModelQuery, DetailsViewModel>
{
public async Task<DetailsViewModel> Retrieve
(DetailsViewModelQuery query)
{
ValidateArguments();
Context = Context ?? new ApplicationDbContext();
var result = new DetailsViewModel();
var question = await Context.Questions
.SingleOrDefaultAsync(x => x.Id == query.Id);
Mapper.Map(question, result);
return result;
}
Query handler queries the EF context
and maps the domain model object
to the view model.
EF context is
instantiated or passed in
via the constructor for
testing.
32. [HttpPost]
[ValidateAntiForgeryToken]
public async Task<RedirectToRouteResult> SignUpForActivity
(SignUpParticipantCommand command)
{
command.ParticipantId =
User.Identity.GetUserId();
command.AddedOn = DateTime.Now;
var commandResult = await CommandDispatcher.Dispatch(command);
if (commandResult.Success)
{
TempData["SignUpMessage"] = "Thank you for signing up. ";
}
else
{
// Handle failure of operation
}
return RedirectToAction("Details", new {id = command.ActivityId, });
}
Command is model bound
from form post, with
additional details set in code.
Again controller action method
delegates to the command
dispatcher execute the
command.
33. public class SignUpParticipantCommandHandler :
ICommandHandler<SignUpParticipantCommand>
{
public async Task<CommandResult> Execute
(SignUpParticipantCommand command)
{
ValidateArguments(command);
Context = Context ?? new ApplicationDbContext();
var result = new CommandResult();
var activity = await Context.Activities
.SingleOrDefaultAsync(x => x.Id == command.ActivityId);
var participant = await Context.Participants
.SingleOrDefaultAsync(x => x.Id == command.ParticipantId);
if (activity != null && participant != null)
{
...
Related entity details are
retrieved.
34. if (Context.ActivityParticipants
.SingleOrDefault(x => x.Activity.Id == command.ActivityId &&
x.Participant.Id == command.ParticipantId) == null)
{
if (activity.NumberOfPlaces > Context.ActivityParticipants
.Count(x => x.Activity.Id == command.ActivityId))
{
var activityParticipant = new ActivityParticipant(activity,
participant, command.AddedOn);
Context.ActivityParticipants.Add(activityParticipant);
await Context.SaveChangesAsync();
result.Success = true;
}
else
{
result.Success = false;
result.Message = "There are not enough places remaining";
}
...
Further checks are made on
the validity of the command
before execution.
35. }
else
{
result.Success = false;
result.Message = "Participant is already signed up";
}
}
else
{
result.Success = false;
result.Message = "Participant and/or activity not found";
}
return result;
}
}
Appropriate results with
status and error details are
provided to the calling code.
36. [HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Edit(EditViewModel vm)
{
if (ModelState.IsValid)
{
var command = new AddOrEditCommand();
Mapper.Map(vm, command);
var commandResult = await CommandDispatcher.Dispatch(command);
if (commandResult.Success)
{
var newId = (int)commandResult.Data;
// Do stuff with the generated Id of if we need to...
return RedirectToAction("Index");
}
}
return View("Edit", vm);
}
View model is model
bound and validated.
If something fails,
return to view.
If validation passes, map
the view model to a
command object.
38. Applying unit testing
• By moving logic into our domain model we’ve already
made that easier to test
• These have no dependencies so can simply be instantiated
with a known state before performing the operations under
test
• With the use of the CQRS mediator pattern, our thin
controllers mean there’s little value in testing them
• But we still have a logic that we should put under test in
our query and command handlers
• These handlers are closely tied to data access code,
specifically the use of Entity Framework
39. Unit testing Entity Framework
• Testing with a database
• Slow
• Brittle - as hard to maintain a known, isolated data set for
tests
• Testing with in-memory objects
• Of limited value as LINQ to Objects != LINQ to Entities
• Using Effort – an in-memory database generated on the
fly - written and maintained by Tamas Flamich
• http://effort.codeplex.com/
• Fast
• Mimics true behaviour of EF very closely
40. Unit testing with Effort
• Install via NuGet: PM> Install-Package Effort
• Instantiate an empty, memory backed EF context
• Seed the context with a known set of data
• Can use EF API for this
• Or for faster tests and with less code, load from CSV files
• Create an instance of the query or command handler,
passing in the in-memory context
• Execute the query or command
• Assert the query result is as expected or the command
operations have persisted
41. [TestClass]
public class RoomViewModelQueryHandlerTests : BaseDataTest
{
[TestMethod]
public void SampleTest()
{
// Arrange
SetUpContextAndTestData();
var handler = new RoomViewModelQueryHandler(Context);
var query = new RoomViewModelQuery { Id = 1 };
// Act
var result = handler.Retrieve(query).Result;
// Assert
Assert.AreEqual("Kitchen", result.RoomDescription);
}
}
Instantiate handler passing
in in-memory, seeded
context
Retrieve the result
(the view model).
Assert the view model properties
42. public abstract class BaseDataTest
{
protected ProductEntities Context { get; private set; }
protected void SetUpContextAndTestData()
{
InitContext();
SeedData();
}
private void InitContext()
{
var connection =
Effort.EntityConnectionFactory
.CreateTransient("name=ProductEntities");
Context = new ProductEntities(connection);
}
...
Connection to in-memory
representation of EDMX meta-
data created.
An alternative method supports
the code-first approach
43. private void SeedData()
{
var categories = new List<Category>
{
new Category { Id = 1, Description = "Kitchens", },
new Category { Id = 2, Description = "Bedrooms", },
};
Context.Categories.AddRange(categories);
Context.SaveChanges();
}
}
Data seeded using EF API
(or CSV files can be used)
45. In summary
• Even with a “light-touch” of architectural patterns we
have an application that provides
• Rich domain model or core
• Data access separated into discrete read and write
operations, adhering to the single responsibility principle
• Testable logic and data access code
• Whilst these patterns can be taken a lot further where
warranted, even for small-medium scale applications
there’s value in their use
46. Lastly, some thanks…
• To my colleagues at Zone
• Numerous discussions, questions and advice as we’ve
evolved techniques and technologies over the years
• To everyone sharing knowledge, opinions and
techniques
• Blogs, forum threads, talks and other community
contributions that have influenced the thinking behind our
work and this presentation
• Looking forward to more discussions this afternoon!
47. Provided as Creative Commons 3.0 Share Alike:
http://creativecommons.org/licenses/by-nc-sa/3.0/