SlideShare ist ein Scribd-Unternehmen logo
1 von 70
Dennis Doomenft. Jonne Kats & Peter Hesseling Software Development Practices in Practice
09:00 – 10:15Iteration 110:30 – 12:00	Iteration 212:00 – 13:00 	Lunch13:00 – 14:15	Iteration 314:30 – 15:45	Iteration 416:00 – 17:00	Iteration 5 Agenda Product Backlog Aspects of Software Quality The Demo Case Acceptance Testing Domain Driven Design  Automatic Testing Test Driven Development Mocking RefactoringPerformance Testing Behavior Driven Development Design Principles & Patterns Clean Code CQRS
Orthogonal Reversibility Feedback Iterative Development Minimal Duplication Aspects of software quality
Use Evolutionary Design & Reference Architecture Treat your code as a book Always check-in with better quality (!= software rot) Adhere to Clean Code Use Coding Guidelines Prevent duplication The Golden Rules
Don't forget YAGNI  Don't make assumptions on legacy code Use TDD or BDD Consider using DDD if applicable Refactor aggressively  Design towards patterns More Golden Rules
The Kitchen
Acceptance Testing Driven Development Jonne Kats
Breaks a complex domain into small chunks Uses highly expressive models (typically UML sketches) Intimately involves business  Understandable by everyone Promotes a loosely coupled design Provides guidelines for large organizations Domain Driven Design
Ubiquitous Language One common unambiguous language  Includes concepts and verbs Ensures collaborate understanding of the domain Originates from business Maintain a glossary (incl. translations) Apply to everything; code, tests, UI When refactoring, refactor everything Domain Driven Design
Entity Has identity in domain Identity never changes Enforces business rules on its properties Is not directly accessible Often has a functional identifier Domain Driven Design
Value Object No identity, just lightweight data Immutable Behaves like a primitive type Often reusable Examples: TimeFrame, ISBN, PostalCode, Email, Address Domain Driven Design
Aggregate Closely related entities and value objects Has global identity Only accessed through its Aggregate Root entity Ensures integrity of all entities Typically loaded and saved as one unit Loaded using a repository and (often) created using a factory Deleting the root, deletes everything in the aggregate Domain Driven Design
Domain Services Stateless Often the entry point into the model Enforce rules on multiple aggregates Implemented as methods or Commands Domain Driven Design
Strategic Design Bounded Contexts Context Maps Shared Kernel Customer/supplier development teams Conformist Anti-corruption layer Separate Ways Domain Driven Design
Unit Tests Fast in-memory tests Independent of any resources Integration Tests Access databases, files, services, I/O  End-2-End Tests  Full tests including all related systems Automated Testing
Small and focused Intention revealing Repeatable Have no side-effects Independent Have a clear name  Tests should be...
It is important not to show what is not important Use Object Mother or Test Data Builder Signal the importance of variables using 'a', 'the', 'some‘ Start small Test what you know now (and assemble the rest) Guidelines for testing
Isolate The Ugly Stuff Use Dependency Injection Prefer state-based tests Test one condition Guidelines for testing
Is a design process Great for quality tests Tests are your first users Can be your documentation If TDD hurts => you're doing it wrong Red-Green-Refactor Better for state-based tests Test Driven Development 28 May 2009 Dennis Doomen
Design Effects More client control More interfaces/factories More focused Less coupling Problems UI Persistent Data False sense of security Losing the overview More code to maintain Test Driven Development
Stubs are stand-ins with fixed values Mocks can be used for expectations Frameworks: Rhino Mocks, NMock, MOQ, TypeMock (commercial) Guidelines Don't mock chatty interfaces Don't have more than 2-3 mocks per test Only mock your nearest neigbors Mocking 28 May 2009 Dennis Doomen
Karl Seguin wrote: Refusing Getting too excited Testing everything! Integration testing Discover mocking Mocking everything Becoming effective Phases of automated testing 28 May 2009 Dennis Doomen
Safe Delete Encapsulate Field Use Base Type where Possible Replace Constructor with Factory Method Convert Extension Method to Plain Static (vv) Convert Method to Property (vv) Convert Property to Auto-Property  Extract Class from Parameters Rename Member / Type Rename / Move Namespace Extract Interface / Method / Superclass Pull Up & Down Introduce Field, Variable or Parameter Move To File (in Folder) Change Signature Refactoring
Performance Testing Peter Hesseling
Flows naturally from user storiesAs a...I want...so that into Given...when...then More behavior oriented ‘TDD Done Right’ Great for exploring the Ubiquitous Language using exploratory specs Seems easier to start with More intention revealing Difficult to implement with MSTest No single framework (yet) Behavior Driven Development
MSpec 0.3 Behavior Driven Development
Subspec Behavior Driven Development
The Kitchen Reference Architecture Dennis Doomen Application Shell Silverlight 4 Views (XAML + C#) DI MVVM Support View Models Commands Controller Kitchen Context Application Services Unity for SL DTOs WCF RIA Services Enterprise Library Kitchen Service Domain Model Domain Events Domain Services Translation Policy Injection Validation Logging DI NHibernate(+ Fluent & LINQ) Service Agents Unit of Work Repositories AutoMapper Database Backoffice Systems
The Principle of Least Surprise Single Responsiblity Principle Open Closed Principle Liskov Substitution Principle Interface Seggregation Principle Dependency Inversion Principle Law of Demeter (a.k.a. Writing Shy Code) Command Query Separation Design Principles
Patterns
Communicate design Solve common challenges Promote object-oriented design Promote loose coupling and reuse Go hand in hand with S.O.L.I.D. Purpose of Patterns
Technical Patternssingleton, factory, adapter, chain of responsibility, strategy, state, bridge, proxy, command, interpreter, mediator, memento, observer,  template, composite Architectural PatternsCQRS, layer supertype,  SOA, MVC, MVP, PM, Pipes & Filters,   Patterns Examples
Domain Patternsdomain model, transaction script, business actions, entity factory, repository, entity, value object, aggregate, domain service, domain events, specification, query objects Strategic PatternsShared Kernel, Customer/Supplier, Conformist, Anti-Coruption Layer, Separate Ways Patterns Examples
Gregg Irwin said: You use it without being aware You hear about it, read up on it, and tinker a bit You learn more and start using it explicitly, if naĂŻvely You get the fire and evangelize Something "clicks" You learn more and apply it "less naĂŻvely" and more implicitly Time passes and you see flaws You question the concept (often because you misapplied it) You either forget about it or add knowledge and experience You use it without being aware that you're using it Phases of Pattern Adoption
Only if the data and actions are available in all states! State Pattern
Domain Event Pattern
Query-by-Example Query Object Specification LINQ Query Patterns
Used in WCSF Many interaction tests Requires a lot of mocking Strong view control Model View Presenter
Few interaction tests Many state-based tests Requires less mocking No view control Presentation Model
Microsoft variant of PM Easy data binding Bi-directional synchronization Model View View-Model
Responsibilities Hides access to the DB Behaves like a collection (implements ICollection<T>) Could support Transparent Persistency Lazy loading Automatic flushing Provides optimizations such as caching Provides exception shielding Repository Pattern
Recommendations Use an ORM such as NHibernate, Entity Framework or LLGenPro One repository per DDD aggregate root Use interfaces to allow faking/stubing Implement IQueryable (LINQ) Use Query Object or Specification patterns Repository Pattern
Responsibilities Encapsulate peculiars of external systems Reduces impact of changes Facilitate single sign-on  Caching Resistant against temporary network problems Monitoring and tracing Service Agents
Recommendations Use interfaces to enable mocking/stubbing Use service agents for reporting servers and/of file I/O Use a workflow Service Agents
Clean Code
Smells Too many, output or flag  arguments Inline Comments not related to a complex algorithm Dead Code Inconsistency (solve similar problems with similar solutions) Artificial Coupling Obscured Intent Misplaced Responsibility Clean Code
Guidelines Functions Names Should Say What  They Do and Should Do One Thing and be short One Switch To Rule Them All (!) Be Precise Don' Mix Levels of Abstractions Always treat warnings as errors Clean Code
Case Study The Kitchen
US01 - Als kok wil ik recepten kunnen bijhouden met titel, beschrijving, instructies, bereidingstijd, ingredienten en moeilijkheidsgraad. US02 - Als kok wil ik kunnen zien wat de kosten van een recept bij benadering zijn (op basis van de productprijzen) US03 - Als kok wil ik per eter een profiel kunnen bijhouden met naam, adres, telefoonummer en adresgegevens. US 04 - Als kok wil ik per eter kunnen aangeven of een eter allergisch is, dat product niet lust, of liever niet eet US05 - Als kok wil ik een boodschappenlijstje kunnen genereren o.b.v. een of meerdere  recepten. User Stories Dennis Doomen
US06 - Als kok wil ik de boodschappen kunnen laten bestellen bij AH's Albert.nl US07 - Als kok wil ik dat de applicatie een willekeurig recept of weekmenu kan genereren, rekening houdend met de voorkeuren van mijn club/gezin US08 - Daarbij mogen gekochte recepten van de laatste 2 weken niet herhaald worden.??? US09 - Als kok wil ik mijn vrienden van Hyves, Facebook en mogelijk andere social networks kunnen importeren als profiel US10 - Als eter wil ik mijn waardering voor een recept kunnen opvoeren US11 - Als architect wil ik dat de applicatie op termijn met meerdere bestelservices moeten kunnen werken User Stories Dennis Doomen
US1 Als kok wil ik recepten kunnen bijhouden met titel, beschrijving, instructies, bereidingstijd, ingredienten en moeilijkheidsgraad.
US1 Domain Model
Initial Reference Architecture Dennis Doomen Views (XAML + C#) Kitchen Service Domain Model Database
US1-A Als kok wil ik recepten kunt zoeken op titel, ingredienten, moeilijkheid en bereidingstijd
US2 Als kok wil ik kunnen zien wat de kosten van een recept bij benadering zijn (op basis van de productprijzen)
US2 (onderdeel van US2 – de product beheer scherm. In dit scherm worden product-unit-prijs gegevens vastgelegd en beheerd)
US2 Domain Model
US3 Als kok wil ik per eter een profiel kunnen bijhouden met naam, email, telefoonummer en adresgegevens.
US3 Domain Model
US4 Als kok wil ik per eter kunnen aangeven of de persoon allergisch is, het product niet lust, of het product liever niet eet
US4 (onderdeel van US4 – toevoegen/wijzigen van de eter voorkeur gegevens)
US4 Domain Model
US5 Als kok wil ik een boodschappenlijstje kunnen genereren o.b.v. een of meerdere  recepten.
US6 Als kok wil ik de boodschappen kunnen laten bestellen bij AH's Albert.nl
US7 Als kok wil ik dat de applicatie een willekeurig recept of weekmenu kan genereren, rekening houdend met de voorkeuren van mijn club/gezin
US9 Als kok wil ik mijn vrienden van Hyves, Facebook en mogelijk andere social networks kunnen importeren als profiel
US9 (onderdeel van US9 – profiel import scherm, per social network)
US10 Als eter wil ik mijn waardering voor een recept kunnen opvoeren
US10 (onderdeel van US10 – als kok wil ik de mening van de eters over een recept kunnen bekijken)
The Kitchen Reference Architecture Dennis Doomen Application Shell Silverlight 4 Views (XAML + C#) DI MVVM Support View Models Commands Kitchen Context Application Services Unity for SL DTOs WCF RIA Services Unity Kitchen Service Domain Model Domain Events Domain Services Translation DI NHibernate(+ Fluent & LINQ) Service Agents Unit of Work Repositories AutoMapper Database AH, Hyves, Facebook

Weitere Àhnliche Inhalte

Was ist angesagt?

Test Driven Development (C#)
Test Driven Development (C#)Test Driven Development (C#)
Test Driven Development (C#)
Alan Dean
 
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Zohirul Alam Tiemoon
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Dhaval Dalal
 

Was ist angesagt? (20)

TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Test Driven Development (C#)
Test Driven Development (C#)Test Driven Development (C#)
Test Driven Development (C#)
 
TDD Flow: The Mantra in Action
TDD Flow: The Mantra in ActionTDD Flow: The Mantra in Action
TDD Flow: The Mantra in Action
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
Atdd half day_new_1_up
Atdd half day_new_1_upAtdd half day_new_1_up
Atdd half day_new_1_up
 
Acceptance Test Driven Development With Spec Flow And Friends
Acceptance Test Driven Development With Spec Flow And FriendsAcceptance Test Driven Development With Spec Flow And Friends
Acceptance Test Driven Development With Spec Flow And Friends
 
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Test Driven Development - Overview and Adoption
Test Driven Development - Overview and AdoptionTest Driven Development - Overview and Adoption
Test Driven Development - Overview and Adoption
 
Test-Driven Development with FLOW3
Test-Driven Development with FLOW3Test-Driven Development with FLOW3
Test-Driven Development with FLOW3
 
TDD That Was Easy!
TDD   That Was Easy!TDD   That Was Easy!
TDD That Was Easy!
 
Introduction to test programming
Introduction to test programmingIntroduction to test programming
Introduction to test programming
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
TDD vs. ATDD - What, Why, Which, When & Where
TDD vs. ATDD - What, Why, Which, When & WhereTDD vs. ATDD - What, Why, Which, When & Where
TDD vs. ATDD - What, Why, Which, When & Where
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 
A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD)
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 

Ähnlich wie Software Development Practices in Practice

Browser based testing
Browser based testingBrowser based testing
Browser based testing
Vishnu Iyengar
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databases
elliando dias
 
Writting Better Software
Writting Better SoftwareWritting Better Software
Writting Better Software
svilen.ivanov
 

Ähnlich wie Software Development Practices in Practice (20)

Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)
 
Unit Testing, TDD and the Walking Skeleton
Unit Testing, TDD and the Walking SkeletonUnit Testing, TDD and the Walking Skeleton
Unit Testing, TDD and the Walking Skeleton
 
Browser based testing
Browser based testingBrowser based testing
Browser based testing
 
Building Maintainable Android Apps (DroidCon NYC 2014)
Building Maintainable Android Apps (DroidCon NYC 2014)Building Maintainable Android Apps (DroidCon NYC 2014)
Building Maintainable Android Apps (DroidCon NYC 2014)
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for BeginnersPHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for Beginners
 
Selenium Design Patterns
Selenium Design PatternsSelenium Design Patterns
Selenium Design Patterns
 
Best practice adoption (and lack there of)
Best practice adoption (and lack there of)Best practice adoption (and lack there of)
Best practice adoption (and lack there of)
 
How to Deliver the Right Software (Specification by example)
How to Deliver the Right Software (Specification by example)How to Deliver the Right Software (Specification by example)
How to Deliver the Right Software (Specification by example)
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databases
 
Writing useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you buildWriting useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you build
 
Django Best Practices
Django Best PracticesDjango Best Practices
Django Best Practices
 
Writting Better Software
Writting Better SoftwareWritting Better Software
Writting Better Software
 
2010-07-19_rails_tdd_week1
2010-07-19_rails_tdd_week12010-07-19_rails_tdd_week1
2010-07-19_rails_tdd_week1
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
 
Products are a mess
Products are a messProducts are a mess
Products are a mess
 
Test driven development v1.0
Test driven development v1.0Test driven development v1.0
Test driven development v1.0
 
Modeling Requirements Narrated2
Modeling Requirements Narrated2Modeling Requirements Narrated2
Modeling Requirements Narrated2
 
Modeling Requirements with SysML
Modeling Requirements with SysML Modeling Requirements with SysML
Modeling Requirements with SysML
 
Pragmatic programmer
Pragmatic programmerPragmatic programmer
Pragmatic programmer
 

Mehr von Dennis Doomen

Getting a grip on your code dependencies (2023-10)
Getting a grip on your code dependencies (2023-10)Getting a grip on your code dependencies (2023-10)
Getting a grip on your code dependencies (2023-10)
Dennis Doomen
 
Tools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy codeTools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy code
Dennis Doomen
 

Mehr von Dennis Doomen (20)

Getting a grip on your code dependencies (2023-10)
Getting a grip on your code dependencies (2023-10)Getting a grip on your code dependencies (2023-10)
Getting a grip on your code dependencies (2023-10)
 
Tools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy codeTools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy code
 
What you can learn from an open-source project with 250 million downloads
What you can learn from an open-source project with 250 million downloadsWhat you can learn from an open-source project with 250 million downloads
What you can learn from an open-source project with 250 million downloads
 
Getting a grip on your code dependencies
Getting a grip on your code dependenciesGetting a grip on your code dependencies
Getting a grip on your code dependencies
 
My Laws of Test Driven Development (2023)
My Laws of Test Driven Development (2023)My Laws of Test Driven Development (2023)
My Laws of Test Driven Development (2023)
 
Design patterns for Event Sourcing in .NET
Design patterns for Event Sourcing in .NETDesign patterns for Event Sourcing in .NET
Design patterns for Event Sourcing in .NET
 
Automate Infrastructure with Pulumi and C#
Automate Infrastructure with Pulumi and C#Automate Infrastructure with Pulumi and C#
Automate Infrastructure with Pulumi and C#
 
What is the right unit in unit testing (UpdateConf 2022)
What is the right unit in unit testing (UpdateConf 2022)What is the right unit in unit testing (UpdateConf 2022)
What is the right unit in unit testing (UpdateConf 2022)
 
Slow Event Sourcing (re)projections - Just make them faster!
Slow Event Sourcing (re)projections - Just make them faster!Slow Event Sourcing (re)projections - Just make them faster!
Slow Event Sourcing (re)projections - Just make them faster!
 
50 things software teams should not do.pptx
50 things software teams should not do.pptx50 things software teams should not do.pptx
50 things software teams should not do.pptx
 
What is the right "unit" in unit testing and why it is not a class?
What is the right "unit" in unit testing and why it is not a class?What is the right "unit" in unit testing and why it is not a class?
What is the right "unit" in unit testing and why it is not a class?
 
A lab around the principles and practices for writing maintainable code
A lab around the principles and practices for writing maintainable codeA lab around the principles and practices for writing maintainable code
A lab around the principles and practices for writing maintainable code
 
How to Practice TDD Without Shooting Yourself in the Foot
How to Practice TDD Without Shooting Yourself in the FootHow to Practice TDD Without Shooting Yourself in the Foot
How to Practice TDD Without Shooting Yourself in the Foot
 
Decomposing the Monolith using modern-day .NET and a touch of microservices
Decomposing the Monolith using modern-day .NET and a touch of microservicesDecomposing the Monolith using modern-day .NET and a touch of microservices
Decomposing the Monolith using modern-day .NET and a touch of microservices
 
Event Sourcing from the Trenches (DDD Europe 2020)
Event Sourcing from the Trenches (DDD Europe 2020)Event Sourcing from the Trenches (DDD Europe 2020)
Event Sourcing from the Trenches (DDD Europe 2020)
 
Practical introduction to DDD, CQRS and Event Sourcing
Practical introduction to DDD, CQRS and Event SourcingPractical introduction to DDD, CQRS and Event Sourcing
Practical introduction to DDD, CQRS and Event Sourcing
 
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the footHow to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
 
Decomposing the Monolith (Riga Dev Days 2019)
Decomposing the Monolith (Riga Dev Days 2019)Decomposing the Monolith (Riga Dev Days 2019)
Decomposing the Monolith (Riga Dev Days 2019)
 
A lab around the principles and practices for writing maintainable code (2019)
A lab around the principles and practices for writing maintainable code (2019)A lab around the principles and practices for writing maintainable code (2019)
A lab around the principles and practices for writing maintainable code (2019)
 
Lessons learned from two decades of professional software development
Lessons learned from two decades of professional software developmentLessons learned from two decades of professional software development
Lessons learned from two decades of professional software development
 

KĂŒrzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

KĂŒrzlich hochgeladen (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Software Development Practices in Practice

  • 1. Dennis Doomenft. Jonne Kats & Peter Hesseling Software Development Practices in Practice
  • 2. 09:00 – 10:15Iteration 110:30 – 12:00 Iteration 212:00 – 13:00 Lunch13:00 – 14:15 Iteration 314:30 – 15:45 Iteration 416:00 – 17:00 Iteration 5 Agenda Product Backlog Aspects of Software Quality The Demo Case Acceptance Testing Domain Driven Design Automatic Testing Test Driven Development Mocking RefactoringPerformance Testing Behavior Driven Development Design Principles & Patterns Clean Code CQRS
  • 3. Orthogonal Reversibility Feedback Iterative Development Minimal Duplication Aspects of software quality
  • 4. Use Evolutionary Design & Reference Architecture Treat your code as a book Always check-in with better quality (!= software rot) Adhere to Clean Code Use Coding Guidelines Prevent duplication The Golden Rules
  • 5. Don't forget YAGNI Don't make assumptions on legacy code Use TDD or BDD Consider using DDD if applicable Refactor aggressively Design towards patterns More Golden Rules
  • 7. Acceptance Testing Driven Development Jonne Kats
  • 8. Breaks a complex domain into small chunks Uses highly expressive models (typically UML sketches) Intimately involves business Understandable by everyone Promotes a loosely coupled design Provides guidelines for large organizations Domain Driven Design
  • 9. Ubiquitous Language One common unambiguous language Includes concepts and verbs Ensures collaborate understanding of the domain Originates from business Maintain a glossary (incl. translations) Apply to everything; code, tests, UI When refactoring, refactor everything Domain Driven Design
  • 10. Entity Has identity in domain Identity never changes Enforces business rules on its properties Is not directly accessible Often has a functional identifier Domain Driven Design
  • 11. Value Object No identity, just lightweight data Immutable Behaves like a primitive type Often reusable Examples: TimeFrame, ISBN, PostalCode, Email, Address Domain Driven Design
  • 12. Aggregate Closely related entities and value objects Has global identity Only accessed through its Aggregate Root entity Ensures integrity of all entities Typically loaded and saved as one unit Loaded using a repository and (often) created using a factory Deleting the root, deletes everything in the aggregate Domain Driven Design
  • 13. Domain Services Stateless Often the entry point into the model Enforce rules on multiple aggregates Implemented as methods or Commands Domain Driven Design
  • 14. Strategic Design Bounded Contexts Context Maps Shared Kernel Customer/supplier development teams Conformist Anti-corruption layer Separate Ways Domain Driven Design
  • 15. Unit Tests Fast in-memory tests Independent of any resources Integration Tests Access databases, files, services, I/O End-2-End Tests Full tests including all related systems Automated Testing
  • 16. Small and focused Intention revealing Repeatable Have no side-effects Independent Have a clear name Tests should be...
  • 17. It is important not to show what is not important Use Object Mother or Test Data Builder Signal the importance of variables using 'a', 'the', 'some‘ Start small Test what you know now (and assemble the rest) Guidelines for testing
  • 18. Isolate The Ugly Stuff Use Dependency Injection Prefer state-based tests Test one condition Guidelines for testing
  • 19. Is a design process Great for quality tests Tests are your first users Can be your documentation If TDD hurts => you're doing it wrong Red-Green-Refactor Better for state-based tests Test Driven Development 28 May 2009 Dennis Doomen
  • 20. Design Effects More client control More interfaces/factories More focused Less coupling Problems UI Persistent Data False sense of security Losing the overview More code to maintain Test Driven Development
  • 21. Stubs are stand-ins with fixed values Mocks can be used for expectations Frameworks: Rhino Mocks, NMock, MOQ, TypeMock (commercial) Guidelines Don't mock chatty interfaces Don't have more than 2-3 mocks per test Only mock your nearest neigbors Mocking 28 May 2009 Dennis Doomen
  • 22. Karl Seguin wrote: Refusing Getting too excited Testing everything! Integration testing Discover mocking Mocking everything Becoming effective Phases of automated testing 28 May 2009 Dennis Doomen
  • 23. Safe Delete Encapsulate Field Use Base Type where Possible Replace Constructor with Factory Method Convert Extension Method to Plain Static (vv) Convert Method to Property (vv) Convert Property to Auto-Property Extract Class from Parameters Rename Member / Type Rename / Move Namespace Extract Interface / Method / Superclass Pull Up & Down Introduce Field, Variable or Parameter Move To File (in Folder) Change Signature Refactoring
  • 25. Flows naturally from user storiesAs a...I want...so that into Given...when...then More behavior oriented ‘TDD Done Right’ Great for exploring the Ubiquitous Language using exploratory specs Seems easier to start with More intention revealing Difficult to implement with MSTest No single framework (yet) Behavior Driven Development
  • 26. MSpec 0.3 Behavior Driven Development
  • 27. Subspec Behavior Driven Development
  • 28. The Kitchen Reference Architecture Dennis Doomen Application Shell Silverlight 4 Views (XAML + C#) DI MVVM Support View Models Commands Controller Kitchen Context Application Services Unity for SL DTOs WCF RIA Services Enterprise Library Kitchen Service Domain Model Domain Events Domain Services Translation Policy Injection Validation Logging DI NHibernate(+ Fluent & LINQ) Service Agents Unit of Work Repositories AutoMapper Database Backoffice Systems
  • 29. The Principle of Least Surprise Single Responsiblity Principle Open Closed Principle Liskov Substitution Principle Interface Seggregation Principle Dependency Inversion Principle Law of Demeter (a.k.a. Writing Shy Code) Command Query Separation Design Principles
  • 31. Communicate design Solve common challenges Promote object-oriented design Promote loose coupling and reuse Go hand in hand with S.O.L.I.D. Purpose of Patterns
  • 32. Technical Patternssingleton, factory, adapter, chain of responsibility, strategy, state, bridge, proxy, command, interpreter, mediator, memento, observer, template, composite Architectural PatternsCQRS, layer supertype, SOA, MVC, MVP, PM, Pipes & Filters, Patterns Examples
  • 33. Domain Patternsdomain model, transaction script, business actions, entity factory, repository, entity, value object, aggregate, domain service, domain events, specification, query objects Strategic PatternsShared Kernel, Customer/Supplier, Conformist, Anti-Coruption Layer, Separate Ways Patterns Examples
  • 34. Gregg Irwin said: You use it without being aware You hear about it, read up on it, and tinker a bit You learn more and start using it explicitly, if naĂŻvely You get the fire and evangelize Something "clicks" You learn more and apply it "less naĂŻvely" and more implicitly Time passes and you see flaws You question the concept (often because you misapplied it) You either forget about it or add knowledge and experience You use it without being aware that you're using it Phases of Pattern Adoption
  • 35. Only if the data and actions are available in all states! State Pattern
  • 37. Query-by-Example Query Object Specification LINQ Query Patterns
  • 38. Used in WCSF Many interaction tests Requires a lot of mocking Strong view control Model View Presenter
  • 39. Few interaction tests Many state-based tests Requires less mocking No view control Presentation Model
  • 40. Microsoft variant of PM Easy data binding Bi-directional synchronization Model View View-Model
  • 41. Responsibilities Hides access to the DB Behaves like a collection (implements ICollection<T>) Could support Transparent Persistency Lazy loading Automatic flushing Provides optimizations such as caching Provides exception shielding Repository Pattern
  • 42. Recommendations Use an ORM such as NHibernate, Entity Framework or LLGenPro One repository per DDD aggregate root Use interfaces to allow faking/stubing Implement IQueryable (LINQ) Use Query Object or Specification patterns Repository Pattern
  • 43. Responsibilities Encapsulate peculiars of external systems Reduces impact of changes Facilitate single sign-on Caching Resistant against temporary network problems Monitoring and tracing Service Agents
  • 44. Recommendations Use interfaces to enable mocking/stubbing Use service agents for reporting servers and/of file I/O Use a workflow Service Agents
  • 46. Smells Too many, output or flag arguments Inline Comments not related to a complex algorithm Dead Code Inconsistency (solve similar problems with similar solutions) Artificial Coupling Obscured Intent Misplaced Responsibility Clean Code
  • 47. Guidelines Functions Names Should Say What They Do and Should Do One Thing and be short One Switch To Rule Them All (!) Be Precise Don' Mix Levels of Abstractions Always treat warnings as errors Clean Code
  • 48. Case Study The Kitchen
  • 49. US01 - Als kok wil ik recepten kunnen bijhouden met titel, beschrijving, instructies, bereidingstijd, ingredienten en moeilijkheidsgraad. US02 - Als kok wil ik kunnen zien wat de kosten van een recept bij benadering zijn (op basis van de productprijzen) US03 - Als kok wil ik per eter een profiel kunnen bijhouden met naam, adres, telefoonummer en adresgegevens. US 04 - Als kok wil ik per eter kunnen aangeven of een eter allergisch is, dat product niet lust, of liever niet eet US05 - Als kok wil ik een boodschappenlijstje kunnen genereren o.b.v. een of meerdere recepten. User Stories Dennis Doomen
  • 50. US06 - Als kok wil ik de boodschappen kunnen laten bestellen bij AH's Albert.nl US07 - Als kok wil ik dat de applicatie een willekeurig recept of weekmenu kan genereren, rekening houdend met de voorkeuren van mijn club/gezin US08 - Daarbij mogen gekochte recepten van de laatste 2 weken niet herhaald worden.??? US09 - Als kok wil ik mijn vrienden van Hyves, Facebook en mogelijk andere social networks kunnen importeren als profiel US10 - Als eter wil ik mijn waardering voor een recept kunnen opvoeren US11 - Als architect wil ik dat de applicatie op termijn met meerdere bestelservices moeten kunnen werken User Stories Dennis Doomen
  • 51. US1 Als kok wil ik recepten kunnen bijhouden met titel, beschrijving, instructies, bereidingstijd, ingredienten en moeilijkheidsgraad.
  • 53. Initial Reference Architecture Dennis Doomen Views (XAML + C#) Kitchen Service Domain Model Database
  • 54. US1-A Als kok wil ik recepten kunt zoeken op titel, ingredienten, moeilijkheid en bereidingstijd
  • 55. US2 Als kok wil ik kunnen zien wat de kosten van een recept bij benadering zijn (op basis van de productprijzen)
  • 56. US2 (onderdeel van US2 – de product beheer scherm. In dit scherm worden product-unit-prijs gegevens vastgelegd en beheerd)
  • 58. US3 Als kok wil ik per eter een profiel kunnen bijhouden met naam, email, telefoonummer en adresgegevens.
  • 60. US4 Als kok wil ik per eter kunnen aangeven of de persoon allergisch is, het product niet lust, of het product liever niet eet
  • 61. US4 (onderdeel van US4 – toevoegen/wijzigen van de eter voorkeur gegevens)
  • 63. US5 Als kok wil ik een boodschappenlijstje kunnen genereren o.b.v. een of meerdere recepten.
  • 64. US6 Als kok wil ik de boodschappen kunnen laten bestellen bij AH's Albert.nl
  • 65. US7 Als kok wil ik dat de applicatie een willekeurig recept of weekmenu kan genereren, rekening houdend met de voorkeuren van mijn club/gezin
  • 66. US9 Als kok wil ik mijn vrienden van Hyves, Facebook en mogelijk andere social networks kunnen importeren als profiel
  • 67. US9 (onderdeel van US9 – profiel import scherm, per social network)
  • 68. US10 Als eter wil ik mijn waardering voor een recept kunnen opvoeren
  • 69. US10 (onderdeel van US10 – als kok wil ik de mening van de eters over een recept kunnen bekijken)
  • 70. The Kitchen Reference Architecture Dennis Doomen Application Shell Silverlight 4 Views (XAML + C#) DI MVVM Support View Models Commands Kitchen Context Application Services Unity for SL DTOs WCF RIA Services Unity Kitchen Service Domain Model Domain Events Domain Services Translation DI NHibernate(+ Fluent & LINQ) Service Agents Unit of Work Repositories AutoMapper Database AH, Hyves, Facebook

Hinweis der Redaktion

  1. Orthogonality.  It’s a fancy word that just means being able to do or change or exercise one thing at a time.  It also means being able to understand or learn about one thing at a time in a system. Reversibility.  Technical or requirement decisions don’t have to be locked in stone. Feedback.  I think the best way to be successful building software is to assume that everything you do is wrong.  We need rapid feedback cycles to find and correct our inevitable mistakes. Iteration.  Your first idea is never your best idea.  Your business partners will need to refine their vision.  You need to be able to respond to both negative and positive feedback. Minimal Duplication.  Less duplication means easier change, less chance of making silly errors, and quicker iteration to get to the best product
  2. Refactor aggressively in areas that change often, but never refactor just &apos;because it doesn&apos;t look nice&apos;
  3. Refactor aggressively in areas that change often, but never refactor just &apos;because it doesn&apos;t look nice&apos;
  4. Flows naturally from user stories in the form of As A, I Want, So That into multple BDD scenarios in the form of Given, When, THenMore behavior oriented, thus better for interaction testsTDD Done RightLijktmakkelijkertezijnommeetebeginnenomdat het woord &apos;test&apos; nietmeervoorkomtGeeft de intentiebeteraan door de verschillende &apos;should&apos; conditiiesLastigom met MSTestteimplementerenMeerdere frameworks ommeetewerken, en nognieteentje die boven de rest uitsteekt
  5. Flows naturally from user stories in the form of As A, I Want, So That into multple BDD scenarios in the form of Given, When, THenMore behavior oriented, thus better for interaction testsTDD Done RightLijktmakkelijkertezijnommeetebeginnenomdat het woord &apos;test&apos; nietmeervoorkomtGeeft de intentiebeteraan door de verschillende &apos;should&apos; conditiiesLastigom met MSTestteimplementerenMeerdere frameworks ommeetewerken, en nognieteentje die boven de rest uitsteekt
  6. Flows naturally from user stories in the form of As A, I Want, So That into multple BDD scenarios in the form of Given, When, THenMore behavior oriented, thus better for interaction testsTDD Done RightLijktmakkelijkertezijnommeetebeginnenomdat het woord &apos;test&apos; nietmeervoorkomtGeeft de intentiebeteraan door de verschillende &apos;should&apos; conditiiesLastigom met MSTestteimplementerenMeerdere frameworks ommeetewerken, en nognieteentje die boven de rest uitsteekt
  7. Repositories regelen toegang tot de database (vaak via een ORM) en gedragen zich als een object collectie (interface is gebaseerd op die van ICollection).Repositories worden altijd via een interface opgehaald (b.v. via een factory)De scope van de unit-of-work wordt door de BA bepaald en niet door de repositories Idealiter ondersteunt de repository eigenschappen van TransparentPersistency, b.v. lazylaoding van relaties tussen entiteiten en het automatisch flushen van alle wijzigingen binnen een unit-of-work. Verzorgt optimalisaties om de database te ontlasten, zoals b.v. first en second-levelcaches, query caching, e.t.c Zorgt dat technische database-specifieke fouten afgeschermd worden en vervangen door functionele fouten
  8. De meeste ORMs ondersteunen alle gewenste functionaliteit. Ik gebruik Nhibernate en Nhibernate.LINQ Definieer 1 repository voor elke aggregatie root Laat toegang tot repositories altijd verlopen via een interface zodat de repository altijd gemocked kan worden Implementeer Iqueryable (b.v. Nhibernate.LINQ) zodat de aanroepende code LINQ queries kan uitvoeren zonder dat dit performanceproblemen veroorzaken. Gebruik Query Object pattern of Specification om een enorme lijst van FindXXX methodes met verschillende argumenten te voorkomen.
  9. Een service agent zit tussen het domein model of BA en een extern systeem (of subsysteem) en schermt alle technische afhankelijkheden af. Doel? De impact van externe wijzigingen minimaliseren. Ook kan een SA de verschillen tussen interne en externe accounts transparant maken (mapping tussen accounts) zodat single sing-on mogelijk is. Biedt optimalisatie aan zoals caching, retries, auditing, logging, e.t.c. Verzorgt de monitoring en tracing van de interactie met de externe systemen, en kan bijvoorbeeld actief signaleren als bepaalde operaties opvallen lang duren.
  10. Service Agents altijd via interfaces aanroepen om unittesten te kunnen schrijven zonder het externe systeem. Ook toegang tot files of networklocaties en reporting engines zijn ‘extern’ en moeten via service agents verlopen. Aangezien een service agents van nature long-running zijn, moeten die in principe altijd via een WF verlopen. Let op, in de praktijk gebeurt dit niet zo vaak.
  11. Inconsistency (solve similar problems with similar solutions)
  12. Inconsistency (solve similar problems with similar solutions)