SlideShare a Scribd company logo
Agile Database development
     (with Visual Studio)
        Jose Luis Soria
         Göteborg, April 2012
Jose Luis Soria
• ALM Team Lead at
  Plain Concepts
• Professional Scrum
  Trainer at scrum.org

    jlsoria@plainconcepts.com

    http://geeks.ms/blogs/jlsoria

    @jlsoriat
Agenda
•   Database development
•   Agile development
•   Agile database development
•   Practices and tools
Database development
How databases work
• Databases are different from
  application code
  – Application code is not changed while
    running (even in dynamic languages, changes are not
    persisted)
  – Databases are changed while running
     • Changes in data or database objects, made
       while the database is online, have to be taken
       into account while developing
Agile Database Development - SDC2012
Databases are changed while running




  Take running database changes into
       account while developing.
Have a proper policy for changes in place
Databases across environments
• We have to deal with several
  environments while developing
• Each environment has its own
  database
• These databases are used for different
  things
• These databases are in different states
  and versions, and contain different
  data
Databases are different
        across environments




Be prepared to change different things
        in different databases
Applying changes to databases
• Most times, any particular change can
  only be made one time. Once the
  change has been made, it is not
  possible to make it again
• Changes are difficult to be undone
Changes to databases are lasting
        and hard to be undone




Have a proper policy for changes in place.
    Have a proper policy for undoing
           changes in place.
Agile development
Agile?
Twelve principles of Agile
Our highest priority is to satisfy the customer   Working software is the primary measure of
through early and continuous delivery of          progress.
valuable software.
Welcome changing requirements, even late          Agile processes promote sustainable
in development. Agile processes harness           development. The sponsors, developers, and
change for the customer's competitive             users should be able to maintain a constant
advantage.                                        pace indefinitely.
Deliver working software frequently, from a       Continuous attention to technical excellence
couple of weeks to a couple of months, with       and good design enhances agility.
a preference to the shorter timescale.
Business people and developers must work          Simplicity--the art of maximizing the amount
together daily throughout the project.            of work not done--is essential.
Build projects around motivated individuals.      The best architectures, requirements, and
Give them the environment and support they        designs emerge from self-organizing teams.
need, and trust them to get the job done.
The most efficient and effective method of        At regular intervals, the team reflects on how
conveying information to and within a             to become more effective, then tunes and
development team is face-to-face                  adjusts its behavior accordingly.
conversation.
Twelve principles of Agile
Our highest priority is to satisfy the customer   Working software is the primary measure of
through early and continuous delivery of          progress.
valuable software.
Welcome changing requirements, even late          Agile processes promote sustainable
in development. Agile processes harness           development. The sponsors, developers, and
change for the customer's competitive             users should be able to maintain a constant
advantage.                                        pace indefinitely.
Deliver working software frequently, from a       Continuous attention to technical excellence
couple of weeks to a couple of months, with       and good design enhances agility.
a preference to the shorter timescale.
Business people and developers must work          Simplicity--the art of maximizing the amount
together daily throughout the project.            of work not done--is essential.
Build projects around motivated individuals.      The best architectures, requirements, and
Give them the environment and support they        designs emerge from self-organizing teams.
need, and trust them to get the job done.
The most efficient and effective method of        At regular intervals, the team reflects on how
conveying information to and within a             to become more effective, then tunes and
development team is face-to-face                  adjusts its behavior accordingly.
conversation.
Agile database development
Early and continuous delivery of   Working software is the primary
valuable software.                 measure of progress.
Welcome changing requirements.     Sustainable development, constant
                                   pace.
Deliver working software           Continuous attention to technical
frequently.                        excellence and good design.

Business people and developers     Simplicity.
must work together.
Build projects around motivated    The best architectures,
individuals. Give them the         requirements, and designs emerge.
environment and support they
need.
What does it mean?
Early and continuous delivery of
          valuable software




Ability to deliver in a simple and quick
                    way
Welcome changing requirements




  Ability to introduce changes
          at any moment
Deliver working software frequently




Ability to deliver in a simple and quick
                    way
Business people and developers
       must work together




Development depends on business
Build projects around motivated individuals.
  Give them the environment they need




       Proper environment and tools
Working software
is the primary measure of progress




Development depends on business.
           Keep always
a functional version of the software
Sustainable development.
      Constant pace




Ability to introduce changes
        at any moment
Continuous attention to technical
  excellence and good design




Best practices: CI, refactoring, TDD…
Simplicity




       Reuse.
Work in small chunks
The best architectures, requirements
       and designs emerge




   Ability to introduce changes
           at any moment
Agile database development
Agile database development
• Be able to deliver database changes in a simple and quick
  way
• Be able to introduce database changes at any moment
• Make database development dependent on business
• Set up a proper environment and tools
• Keep always a functional version of the database
• Use best practices: CI, refactoring, TDD…
• Reuse
• Work in small chunks
• Take running database changes into account while
  developing
• Have a proper policy for changes in place
• Have a proper policy for undoing changes in place
• Be prepared to change different things in different databases
How to do it?: practices & tools
Practices and tools
• Are going to help us to do database
  development properly
• Tools and demos for this session deal with
  relational databases (SQL Server). But
  principles are the same for other
  scenarios:
  – NoSQL (MongoDB, Azure Storage…)
  – ORMs (Entity Framework, NHibernate…)
• Most things will also work with VS 11 and
  SQL Server Data Tools
Version control
• Treat database code like any other source
  code
  – Enable several people to work on the same
    code base
  – Make modifications available to the rest of the
    team in a controlled way
  – Make it possible to set up Continuous Integration
  – Use versioning features: compare, restore old
    version, combine…
• Use the same code, schema or approach to
  migrate any database in your environment
Demo
Version control for databases
Coding aids
• Visual Studio provides several aids for
  working with database code
  – Intellisense
  – Tracking and resolving dependencies
  – Static analysis
  – Refactoring
Demo
Coding aids
Isolated development
           environment
• Have each developer work in his own
  environment, which includes the
  database
  – Self-contained
  – Resembling production environment
  – Automated (deployment, testing, etc.)
Demo
Isolated development
environment
Unit tests
• Sometimes, database code can contain
  logic
• Database code can benefit from
  automated unit testing the same way as
  application code
  –   Find problems early
  –   Facilitate change
  –   Simplify integration
  –   Self-document
  –   Drive the design
Demo
Database unit testing
Continuous Integration
• Early warning of conflicting changes
• Immediate unit testing of all changes
• Constant availability of a "current"
  build for testing, demo, or release
  purposes
• Immediate feedback
• Modular, less complex code
• Quality code
Continuous Integration
               principles
•   Maintain a code repository
•   Automate the build
•   Make the build self-testing
•   Everyone commits to the baseline every day
•   Every commit (to baseline) should be built
•   Keep the build fast
•   Test in a clone of the production environment
•   Make it easy to get the latest deliverables
•   Everyone can see the results of the latest build
•   Automate deployment
Continuous Integration
               principles
•   Maintain a code repository
•   Automate the build
•   Make the build self-testing
•   Everyone commits to the baseline every day
•   Every commit (to baseline) should be built
•   Keep the build fast
•   Test in a clone of the production environment
•   Make it easy to get the latest deliverables
•   Everyone can see the results of the latest build
•   Automate deployment
Demo
Database continuous
integration
Requirements drive changes
• Make changes in small chunks
• Changes are originated by
  requirements
• Make different changes for different
  requirements
Continuous deployment to any
        environment
• Automating database migrations to
  any environment helps us:
  – Easily roll forward or back
  – Minimize disruption for changes
  – Maximize reliability of deployment process
  – Work incrementally (including DBAs)
Continuous deployment process
• Obtain the correct version of the
  database
• Prepare the environment
• Initialize database and instance
• Initialize schema
• Initialize user credentials
• Populate database with reference data
• Have a rollback mechanism in place
Demo
Continuous deployment
Database sync vs. delta scripts
• Syncing databases can lead to
  uncontrolled changes across
  environments
• It’s better to make changes the same
  way for all the environments
• We can use numerated delta scripts
  and tools like DBDeploy
Database sync vs. delta scripts
• Delta scripts
   – Great for greenfield development and Continuous
     Integration
• Database sync
   –   For legacy databases
   –   For non-agile, non-CI projects
   –   For changing data
   –   When you don’t have database under version control
• Other options
   – ORMs usually have their own mechanism to deal with
     database changes. For example, migrations in Entity
     Framework
Dealing with data
• Reference data can be scripted
• Changes (delta scripts) should deal
  with existing data
• There are several ways to obtain data
  for testing
  – Using the application API
  – Using backups
  – Using data comparison tools
  – Using data generation tools
Have we covered everything?
• Be able to deliver database changes in a simple and quick
  way
• Be able to introduce database changes at any moment
• Make database development dependent on business
• Set up a proper environment and tools
• Keep always a functional version of the database
• Use best practices: CI, refactoring, TDD…
• Reuse
• Work in small chunks
• Take running database changes into account while
  developing
• Have a proper policy for changes in place
• Have a proper policy for undoing changes in place
• Be prepared to change different things in different databases
Any questions?
•   Visual Studio Database tools http://bit.ly/dyN3wv
•   VSDBCMD http://bit.ly/vB6G1
•   Database changes done right http://bit.ly/wTOY01
•   Continuous delivery http://continuousdelivery.com/




       jlsoria@plainconcepts.com

       @jlsoriat

More Related Content

What's hot (20)

PPTX
μινωικός ανάκτορα
Theodora2013
 
PDF
Δομή ακολουθίας στη ΓΛΩΣΣΑ
Alexandra Karakasidou
 
PPTX
αθλητισμος διατροφη υγεια
Πέννυ Πεχλιβανίδου
 
PDF
ΠΛΗ30 ΜΑΘΗΜΑ 4.2
Dimitris Psounis
 
PDF
SEM與Amos進階-三星統計張偉豪
Beckett Hsieh
 
PDF
ΠΛΗ30 ΜΑΘΗΜΑ 3.3
Dimitris Psounis
 
PPT
Έλλειψη
Pantelis Bouboulis
 
PPT
ΑΝΑΝΕΩΣΙΜΕΣ ΠΗΓΕΣ ΕΝΕΡΓΕΙΑΣ ΚΑΙ ΠΡΑΣΙΝΗ ΑΝΑΠΤΥΞΗ
3ο Λύκειο Φλώρινας
 
PDF
ΓΡΑΜΜΑΤΙΚΗ ΛΑΤΙΝΙΚΩΝ
labr0s
 
PDF
Організаційна трансформація НБУ: Основні напрями реформи
tsnua
 
PDF
Gimp (Εκπαιδευτικός Οδηγός)
Makis Triantafillidis
 
PPT
Εφηβεία...αλλαγές και διατροφή
Sofia Babou
 
PPTX
Δομή Επανάληψης
gkesel
 
PDF
CMV共同方法變異-三星統計張偉豪-20140822
Beckett Hsieh
 
DOCX
Σχεδιάγραμμα ρατσισμός- ξενοφοβία Έκθεση Β΄ Λυκείου
Stella Karioti
 
PPTX
Bits bytes
mexarxu
 
PPTX
Ασφάλεια ΤΠΕ - 02. Τεχνικά Θέματα Ασφάλειας
Marina Gavrilaki
 
PPTX
Κεφάλαιο 1: Εισαγωγή στην έννοια του Αλγόριθμου
Evangelia Anastasaki
 
DOCX
Ευρωπαϊκή Ένωση - φύλλο εργασίας
zazagina
 
PPTX
Ευριπίδη Ελένη, Ανιχνεύοντας τη "διάνοια"
Σταυρούλα Τσαμασίρου
 
μινωικός ανάκτορα
Theodora2013
 
Δομή ακολουθίας στη ΓΛΩΣΣΑ
Alexandra Karakasidou
 
αθλητισμος διατροφη υγεια
Πέννυ Πεχλιβανίδου
 
ΠΛΗ30 ΜΑΘΗΜΑ 4.2
Dimitris Psounis
 
SEM與Amos進階-三星統計張偉豪
Beckett Hsieh
 
ΠΛΗ30 ΜΑΘΗΜΑ 3.3
Dimitris Psounis
 
Έλλειψη
Pantelis Bouboulis
 
ΑΝΑΝΕΩΣΙΜΕΣ ΠΗΓΕΣ ΕΝΕΡΓΕΙΑΣ ΚΑΙ ΠΡΑΣΙΝΗ ΑΝΑΠΤΥΞΗ
3ο Λύκειο Φλώρινας
 
ΓΡΑΜΜΑΤΙΚΗ ΛΑΤΙΝΙΚΩΝ
labr0s
 
Організаційна трансформація НБУ: Основні напрями реформи
tsnua
 
Gimp (Εκπαιδευτικός Οδηγός)
Makis Triantafillidis
 
Εφηβεία...αλλαγές και διατροφή
Sofia Babou
 
Δομή Επανάληψης
gkesel
 
CMV共同方法變異-三星統計張偉豪-20140822
Beckett Hsieh
 
Σχεδιάγραμμα ρατσισμός- ξενοφοβία Έκθεση Β΄ Λυκείου
Stella Karioti
 
Bits bytes
mexarxu
 
Ασφάλεια ΤΠΕ - 02. Τεχνικά Θέματα Ασφάλειας
Marina Gavrilaki
 
Κεφάλαιο 1: Εισαγωγή στην έννοια του Αλγόριθμου
Evangelia Anastasaki
 
Ευρωπαϊκή Ένωση - φύλλο εργασίας
zazagina
 
Ευριπίδη Ελένη, Ανιχνεύοντας τη "διάνοια"
Σταυρούλα Τσαμασίρου
 

Similar to Agile Database Development - SDC2012 (20)

PPTX
Chapter 5
TehreemSaleem5
 
PPTX
Software development with agile methodologies
Elmozamil Elamir
 
PDF
Agile Simplified
Walaa Atef
 
PDF
SFD2012Hanoi - Duong Trong Tan - Agile and FOSS
Vu Hung Nguyen
 
PDF
FOSS and agile software development
DUONG Trong Tan
 
PPT
Arch factory - Agile Design: Best Practices
Igor Moochnick
 
PPT
Business Analyst As Product Owner
Craig Brown
 
PPT
6a.Agile Software Development.ppt
emanamin19
 
PPT
6a.Agile Software Development.ppt
HamzaUsman48
 
PPTX
Emerging Trends of Software Engineering
DR. Ram Kumar Pathak
 
PDF
The BA role in Agile Development
Agileee
 
PDF
Agile Infrastructure Velocity 09
Andrew Shafer
 
ODP
Agile Engineering
John Lewis
 
KEY
The Agile Manifesto (and a brief history lesson)
Adrian Howard
 
PPTX
Poor Man's Kanban
Chicago ALT.NET
 
PDF
Introduction To Agile Refresh Savannah July20 2010 V1 4
Marvin Heery
 
PPT
3. Agility and extreme programming OF UNIT-1 PPT
sharmila27432
 
PDF
Agile & User Experience
Michelle Adams
 
PPTX
MDG Agile for Medical Device Software
Mike Attili
 
Chapter 5
TehreemSaleem5
 
Software development with agile methodologies
Elmozamil Elamir
 
Agile Simplified
Walaa Atef
 
SFD2012Hanoi - Duong Trong Tan - Agile and FOSS
Vu Hung Nguyen
 
FOSS and agile software development
DUONG Trong Tan
 
Arch factory - Agile Design: Best Practices
Igor Moochnick
 
Business Analyst As Product Owner
Craig Brown
 
6a.Agile Software Development.ppt
emanamin19
 
6a.Agile Software Development.ppt
HamzaUsman48
 
Emerging Trends of Software Engineering
DR. Ram Kumar Pathak
 
The BA role in Agile Development
Agileee
 
Agile Infrastructure Velocity 09
Andrew Shafer
 
Agile Engineering
John Lewis
 
The Agile Manifesto (and a brief history lesson)
Adrian Howard
 
Poor Man's Kanban
Chicago ALT.NET
 
Introduction To Agile Refresh Savannah July20 2010 V1 4
Marvin Heery
 
3. Agility and extreme programming OF UNIT-1 PPT
sharmila27432
 
Agile & User Experience
Michelle Adams
 
MDG Agile for Medical Device Software
Mike Attili
 
Ad

More from Jose Luis Soria (20)

PDF
Project Portfolio Management with Kanban in an international company
Jose Luis Soria
 
PDF
Lean Kanban at Ria - Lean Kanban Southern Europe 2015
Jose Luis Soria
 
PPTX
Things to do with the time you’ll save thanks to VSO
Jose Luis Soria
 
PDF
Jose Luis Soria - Codemotion 2014 - Designing a release pipeline
Jose Luis Soria
 
PDF
Jose Luis Soria - XP2014 - Designing a Release Pipeline
Jose Luis Soria
 
PPTX
Jose Luis Soria - Microsoft Plataforma Empresarial 2014 - ALM como factor dif...
Jose Luis Soria
 
PPTX
Alm Forum 2014 - Jose Luis Soria - Patterns and anti-patterns for (Continuous...
Jose Luis Soria
 
PDF
Proyectos ágiles con Team Foundation Server - COITT
Jose Luis Soria
 
PDF
ALM Tour 2013 - Responderá mi aplicación en el mundo real?
Jose Luis Soria
 
PDF
ALM Tour 2013 - Proyectos bajo control - asegurando la entrega de valor
Jose Luis Soria
 
PDF
ALM Tour 2013 - Entregar a tiempo y sin errores
Jose Luis Soria
 
PDF
Bcn devcon jose luis soria - patterns & antipatterns for delivery
Jose Luis Soria
 
PDF
Real World Agile Roadshow 2013 - Planificación y Arquitectura Ágil
Jose Luis Soria
 
PPTX
ALM Summit 3 - Setting up a Continuous Delivery Deployment Pipeline with TFS
Jose Luis Soria
 
PPTX
Roadshow ALM Calidad 2013 - Infraestructura de pruebas - Jose Luis Soria
Jose Luis Soria
 
PDF
Jose Luis Soria - Visual Studio Tour Plain Concepts - DevOps
Jose Luis Soria
 
PDF
Visual Studio Tour Plain Concepts - ALM para Windows 8
Jose Luis Soria
 
PDF
Jose Luis Soria - CAS2012 - Cargo cult Agile training & coaching
Jose Luis Soria
 
PDF
Cargo Cult Agile training & coaching
Jose Luis Soria
 
PPTX
Destino la Nube 2012 - ALM para Azure
Jose Luis Soria
 
Project Portfolio Management with Kanban in an international company
Jose Luis Soria
 
Lean Kanban at Ria - Lean Kanban Southern Europe 2015
Jose Luis Soria
 
Things to do with the time you’ll save thanks to VSO
Jose Luis Soria
 
Jose Luis Soria - Codemotion 2014 - Designing a release pipeline
Jose Luis Soria
 
Jose Luis Soria - XP2014 - Designing a Release Pipeline
Jose Luis Soria
 
Jose Luis Soria - Microsoft Plataforma Empresarial 2014 - ALM como factor dif...
Jose Luis Soria
 
Alm Forum 2014 - Jose Luis Soria - Patterns and anti-patterns for (Continuous...
Jose Luis Soria
 
Proyectos ágiles con Team Foundation Server - COITT
Jose Luis Soria
 
ALM Tour 2013 - Responderá mi aplicación en el mundo real?
Jose Luis Soria
 
ALM Tour 2013 - Proyectos bajo control - asegurando la entrega de valor
Jose Luis Soria
 
ALM Tour 2013 - Entregar a tiempo y sin errores
Jose Luis Soria
 
Bcn devcon jose luis soria - patterns & antipatterns for delivery
Jose Luis Soria
 
Real World Agile Roadshow 2013 - Planificación y Arquitectura Ágil
Jose Luis Soria
 
ALM Summit 3 - Setting up a Continuous Delivery Deployment Pipeline with TFS
Jose Luis Soria
 
Roadshow ALM Calidad 2013 - Infraestructura de pruebas - Jose Luis Soria
Jose Luis Soria
 
Jose Luis Soria - Visual Studio Tour Plain Concepts - DevOps
Jose Luis Soria
 
Visual Studio Tour Plain Concepts - ALM para Windows 8
Jose Luis Soria
 
Jose Luis Soria - CAS2012 - Cargo cult Agile training & coaching
Jose Luis Soria
 
Cargo Cult Agile training & coaching
Jose Luis Soria
 
Destino la Nube 2012 - ALM para Azure
Jose Luis Soria
 
Ad

Recently uploaded (20)

PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 

Agile Database Development - SDC2012

  • 1. Agile Database development (with Visual Studio) Jose Luis Soria Göteborg, April 2012
  • 2. Jose Luis Soria • ALM Team Lead at Plain Concepts • Professional Scrum Trainer at scrum.org [email protected] http://geeks.ms/blogs/jlsoria @jlsoriat
  • 3. Agenda • Database development • Agile development • Agile database development • Practices and tools
  • 5. How databases work • Databases are different from application code – Application code is not changed while running (even in dynamic languages, changes are not persisted) – Databases are changed while running • Changes in data or database objects, made while the database is online, have to be taken into account while developing
  • 7. Databases are changed while running Take running database changes into account while developing. Have a proper policy for changes in place
  • 8. Databases across environments • We have to deal with several environments while developing • Each environment has its own database • These databases are used for different things • These databases are in different states and versions, and contain different data
  • 9. Databases are different across environments Be prepared to change different things in different databases
  • 10. Applying changes to databases • Most times, any particular change can only be made one time. Once the change has been made, it is not possible to make it again • Changes are difficult to be undone
  • 11. Changes to databases are lasting and hard to be undone Have a proper policy for changes in place. Have a proper policy for undoing changes in place.
  • 14. Twelve principles of Agile Our highest priority is to satisfy the customer Working software is the primary measure of through early and continuous delivery of progress. valuable software. Welcome changing requirements, even late Agile processes promote sustainable in development. Agile processes harness development. The sponsors, developers, and change for the customer's competitive users should be able to maintain a constant advantage. pace indefinitely. Deliver working software frequently, from a Continuous attention to technical excellence couple of weeks to a couple of months, with and good design enhances agility. a preference to the shorter timescale. Business people and developers must work Simplicity--the art of maximizing the amount together daily throughout the project. of work not done--is essential. Build projects around motivated individuals. The best architectures, requirements, and Give them the environment and support they designs emerge from self-organizing teams. need, and trust them to get the job done. The most efficient and effective method of At regular intervals, the team reflects on how conveying information to and within a to become more effective, then tunes and development team is face-to-face adjusts its behavior accordingly. conversation.
  • 15. Twelve principles of Agile Our highest priority is to satisfy the customer Working software is the primary measure of through early and continuous delivery of progress. valuable software. Welcome changing requirements, even late Agile processes promote sustainable in development. Agile processes harness development. The sponsors, developers, and change for the customer's competitive users should be able to maintain a constant advantage. pace indefinitely. Deliver working software frequently, from a Continuous attention to technical excellence couple of weeks to a couple of months, with and good design enhances agility. a preference to the shorter timescale. Business people and developers must work Simplicity--the art of maximizing the amount together daily throughout the project. of work not done--is essential. Build projects around motivated individuals. The best architectures, requirements, and Give them the environment and support they designs emerge from self-organizing teams. need, and trust them to get the job done. The most efficient and effective method of At regular intervals, the team reflects on how conveying information to and within a to become more effective, then tunes and development team is face-to-face adjusts its behavior accordingly. conversation.
  • 16. Agile database development Early and continuous delivery of Working software is the primary valuable software. measure of progress. Welcome changing requirements. Sustainable development, constant pace. Deliver working software Continuous attention to technical frequently. excellence and good design. Business people and developers Simplicity. must work together. Build projects around motivated The best architectures, individuals. Give them the requirements, and designs emerge. environment and support they need.
  • 17. What does it mean?
  • 18. Early and continuous delivery of valuable software Ability to deliver in a simple and quick way
  • 19. Welcome changing requirements Ability to introduce changes at any moment
  • 20. Deliver working software frequently Ability to deliver in a simple and quick way
  • 21. Business people and developers must work together Development depends on business
  • 22. Build projects around motivated individuals. Give them the environment they need Proper environment and tools
  • 23. Working software is the primary measure of progress Development depends on business. Keep always a functional version of the software
  • 24. Sustainable development. Constant pace Ability to introduce changes at any moment
  • 25. Continuous attention to technical excellence and good design Best practices: CI, refactoring, TDD…
  • 26. Simplicity Reuse. Work in small chunks
  • 27. The best architectures, requirements and designs emerge Ability to introduce changes at any moment
  • 29. Agile database development • Be able to deliver database changes in a simple and quick way • Be able to introduce database changes at any moment • Make database development dependent on business • Set up a proper environment and tools • Keep always a functional version of the database • Use best practices: CI, refactoring, TDD… • Reuse • Work in small chunks • Take running database changes into account while developing • Have a proper policy for changes in place • Have a proper policy for undoing changes in place • Be prepared to change different things in different databases
  • 30. How to do it?: practices & tools
  • 31. Practices and tools • Are going to help us to do database development properly • Tools and demos for this session deal with relational databases (SQL Server). But principles are the same for other scenarios: – NoSQL (MongoDB, Azure Storage…) – ORMs (Entity Framework, NHibernate…) • Most things will also work with VS 11 and SQL Server Data Tools
  • 32. Version control • Treat database code like any other source code – Enable several people to work on the same code base – Make modifications available to the rest of the team in a controlled way – Make it possible to set up Continuous Integration – Use versioning features: compare, restore old version, combine… • Use the same code, schema or approach to migrate any database in your environment
  • 34. Coding aids • Visual Studio provides several aids for working with database code – Intellisense – Tracking and resolving dependencies – Static analysis – Refactoring
  • 36. Isolated development environment • Have each developer work in his own environment, which includes the database – Self-contained – Resembling production environment – Automated (deployment, testing, etc.)
  • 38. Unit tests • Sometimes, database code can contain logic • Database code can benefit from automated unit testing the same way as application code – Find problems early – Facilitate change – Simplify integration – Self-document – Drive the design
  • 40. Continuous Integration • Early warning of conflicting changes • Immediate unit testing of all changes • Constant availability of a "current" build for testing, demo, or release purposes • Immediate feedback • Modular, less complex code • Quality code
  • 41. Continuous Integration principles • Maintain a code repository • Automate the build • Make the build self-testing • Everyone commits to the baseline every day • Every commit (to baseline) should be built • Keep the build fast • Test in a clone of the production environment • Make it easy to get the latest deliverables • Everyone can see the results of the latest build • Automate deployment
  • 42. Continuous Integration principles • Maintain a code repository • Automate the build • Make the build self-testing • Everyone commits to the baseline every day • Every commit (to baseline) should be built • Keep the build fast • Test in a clone of the production environment • Make it easy to get the latest deliverables • Everyone can see the results of the latest build • Automate deployment
  • 44. Requirements drive changes • Make changes in small chunks • Changes are originated by requirements • Make different changes for different requirements
  • 45. Continuous deployment to any environment • Automating database migrations to any environment helps us: – Easily roll forward or back – Minimize disruption for changes – Maximize reliability of deployment process – Work incrementally (including DBAs)
  • 46. Continuous deployment process • Obtain the correct version of the database • Prepare the environment • Initialize database and instance • Initialize schema • Initialize user credentials • Populate database with reference data • Have a rollback mechanism in place
  • 48. Database sync vs. delta scripts • Syncing databases can lead to uncontrolled changes across environments • It’s better to make changes the same way for all the environments • We can use numerated delta scripts and tools like DBDeploy
  • 49. Database sync vs. delta scripts • Delta scripts – Great for greenfield development and Continuous Integration • Database sync – For legacy databases – For non-agile, non-CI projects – For changing data – When you don’t have database under version control • Other options – ORMs usually have their own mechanism to deal with database changes. For example, migrations in Entity Framework
  • 50. Dealing with data • Reference data can be scripted • Changes (delta scripts) should deal with existing data • There are several ways to obtain data for testing – Using the application API – Using backups – Using data comparison tools – Using data generation tools
  • 51. Have we covered everything? • Be able to deliver database changes in a simple and quick way • Be able to introduce database changes at any moment • Make database development dependent on business • Set up a proper environment and tools • Keep always a functional version of the database • Use best practices: CI, refactoring, TDD… • Reuse • Work in small chunks • Take running database changes into account while developing • Have a proper policy for changes in place • Have a proper policy for undoing changes in place • Be prepared to change different things in different databases
  • 52. Any questions? • Visual Studio Database tools http://bit.ly/dyN3wv • VSDBCMD http://bit.ly/vB6G1 • Database changes done right http://bit.ly/wTOY01 • Continuous delivery http://continuousdelivery.com/ [email protected] @jlsoriat