0
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  ...
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 (ev...
Databases are changed while running  Take running database changes into       account while developing.Have a proper polic...
Databases across environments• We have to deal with several  environments while developing• Each environment has its own  ...
Databases are different        across environmentsBe 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 mad...
Changes to databases are lasting        and hard to be undoneHave a proper policy for changes in place.    Have a proper p...
Agile development
Agile?
Twelve principles of AgileOur highest priority is to satisfy the customer   Working software is the primary measure ofthro...
Twelve principles of AgileOur highest priority is to satisfy the customer   Working software is the primary measure ofthro...
Agile database developmentEarly and continuous delivery of   Working software is the primaryvaluable software.            ...
What does it mean?
Early and continuous delivery of          valuable softwareAbility to deliver in a simple and quick                    way
Welcome changing requirements  Ability to introduce changes          at any moment
Deliver working software frequentlyAbility to deliver in a simple and quick                    way
Business people and developers       must work togetherDevelopment depends on business
Build projects around motivated individuals.  Give them the environment they need       Proper environment and tools
Working softwareis the primary measure of progressDevelopment depends on business.           Keep alwaysa functional versi...
Sustainable development.      Constant paceAbility to introduce changes        at any moment
Continuous attention to technical  excellence and good designBest 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 ...
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...
Version control• Treat database code like any other source  code  – Enable several people to work on the same    code base...
DemoVersion control for databases
Coding aids• Visual Studio provides several aids for  working with database code  – Intellisense  – Tracking and resolving...
DemoCoding aids
Isolated development           environment• Have each developer work in his own  environment, which includes the  database...
DemoIsolated developmentenvironment
Unit tests• Sometimes, database code can contain  logic• Database code can benefit from  automated unit testing the same w...
DemoDatabase unit testing
Continuous Integration• Early warning of conflicting changes• Immediate unit testing of all changes• Constant availability...
Continuous Integration               principles•   Maintain a code repository•   Automate the build•   Make the build self...
Continuous Integration               principles•   Maintain a code repository•   Automate the build•   Make the build self...
DemoDatabase continuousintegration
Requirements drive changes• Make changes in small chunks• Changes are originated by  requirements• Make different changes ...
Continuous deployment to any        environment• Automating database migrations to  any environment helps us:  – Easily ro...
Continuous deployment process• Obtain the correct version of the  database• Prepare the environment• Initialize database a...
DemoContinuous deployment
Database sync vs. delta scripts• Syncing databases can lead to  uncontrolled changes across  environments• It’s better to ...
Database sync vs. delta scripts• Delta scripts   – Great for greenfield development and Continuous     Integration• Databa...
Dealing with data• Reference data can be scripted• Changes (delta scripts) should deal  with existing data• There are seve...
Have we covered everything?• Be able to deliver database changes in a simple and quick  way• Be able to introduce database...
Any questions?•   Visual Studio Database tools http://bit.ly/dyN3wv•   VSDBCMD http://bit.ly/vB6G1•   Database changes don...
Agile Database Development - SDC2012
Upcoming SlideShare
Loading in...5
×

Agile Database Development - SDC2012

3,823

Published on

Slides for my presentation about Agile Database Development at SDC2012 (Gothemburg - April 2012)

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,823
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
32
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "Agile Database Development - SDC2012"

  1. 1. Agile Database development (with Visual Studio) Jose Luis Soria Göteborg, April 2012
  2. 2. Jose Luis Soria• ALM Team Lead at Plain Concepts• Professional Scrum Trainer at scrum.org jlsoria@plainconcepts.com http://geeks.ms/blogs/jlsoria @jlsoriat
  3. 3. Agenda• Database development• Agile development• Agile database development• Practices and tools
  4. 4. Database development
  5. 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
  6. 6. Databases are changed while running Take running database changes into account while developing.Have a proper policy for changes in place
  7. 7. 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
  8. 8. Databases are different across environmentsBe prepared to change different things in different databases
  9. 9. 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
  10. 10. Changes to databases are lasting and hard to be undoneHave a proper policy for changes in place. Have a proper policy for undoing changes in place.
  11. 11. Agile development
  12. 12. Agile?
  13. 13. Twelve principles of AgileOur highest priority is to satisfy the customer Working software is the primary measure ofthrough early and continuous delivery of progress.valuable software.Welcome changing requirements, even late Agile processes promote sustainablein development. Agile processes harness development. The sponsors, developers, andchange for the customers competitive users should be able to maintain a constantadvantage. pace indefinitely.Deliver working software frequently, from a Continuous attention to technical excellencecouple 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 amounttogether daily throughout the project. of work not done--is essential.Build projects around motivated individuals. The best architectures, requirements, andGive 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 howconveying information to and within a to become more effective, then tunes anddevelopment team is face-to-face adjusts its behavior accordingly.conversation.
  14. 14. Twelve principles of AgileOur highest priority is to satisfy the customer Working software is the primary measure ofthrough early and continuous delivery of progress.valuable software.Welcome changing requirements, even late Agile processes promote sustainablein development. Agile processes harness development. The sponsors, developers, andchange for the customers competitive users should be able to maintain a constantadvantage. pace indefinitely.Deliver working software frequently, from a Continuous attention to technical excellencecouple 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 amounttogether daily throughout the project. of work not done--is essential.Build projects around motivated individuals. The best architectures, requirements, andGive 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 howconveying information to and within a to become more effective, then tunes anddevelopment team is face-to-face adjusts its behavior accordingly.conversation.
  15. 15. Agile database developmentEarly and continuous delivery of Working software is the primaryvaluable software. measure of progress.Welcome changing requirements. Sustainable development, constant pace.Deliver working software Continuous attention to technicalfrequently. 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 theyneed.
  16. 16. What does it mean?
  17. 17. Early and continuous delivery of valuable softwareAbility to deliver in a simple and quick way
  18. 18. Welcome changing requirements Ability to introduce changes at any moment
  19. 19. Deliver working software frequentlyAbility to deliver in a simple and quick way
  20. 20. Business people and developers must work togetherDevelopment depends on business
  21. 21. Build projects around motivated individuals. Give them the environment they need Proper environment and tools
  22. 22. Working softwareis the primary measure of progressDevelopment depends on business. Keep alwaysa functional version of the software
  23. 23. Sustainable development. Constant paceAbility to introduce changes at any moment
  24. 24. Continuous attention to technical excellence and good designBest practices: CI, refactoring, TDD…
  25. 25. Simplicity Reuse.Work in small chunks
  26. 26. The best architectures, requirements and designs emerge Ability to introduce changes at any moment
  27. 27. Agile database development
  28. 28. 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
  29. 29. How to do it?: practices & tools
  30. 30. 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
  31. 31. 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
  32. 32. DemoVersion control for databases
  33. 33. Coding aids• Visual Studio provides several aids for working with database code – Intellisense – Tracking and resolving dependencies – Static analysis – Refactoring
  34. 34. DemoCoding aids
  35. 35. Isolated development environment• Have each developer work in his own environment, which includes the database – Self-contained – Resembling production environment – Automated (deployment, testing, etc.)
  36. 36. DemoIsolated developmentenvironment
  37. 37. 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
  38. 38. DemoDatabase unit testing
  39. 39. 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
  40. 40. 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
  41. 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. 42. DemoDatabase continuousintegration
  43. 43. Requirements drive changes• Make changes in small chunks• Changes are originated by requirements• Make different changes for different requirements
  44. 44. 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)
  45. 45. 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
  46. 46. DemoContinuous deployment
  47. 47. 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
  48. 48. 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
  49. 49. 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
  50. 50. 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
  51. 51. 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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×