ݺߣ

ݺߣShare a Scribd company logo
Best Practices I A Comprehensive Programming Workshop by Hazem Torab IRange Co-Founder
Agenda Database Naming Database Objects Optimizing Queries De-normalization Comparing Database Versions Code Running Scripts Programmatically Unit Testing Detecting Application Version Workshop: Manage Application Versions
Naming Database Objects Database Tables and Views Conventions Lookups Settings Stored Procedures and Functions Generated Procedures  Custom Procedures / Functions
Naming Database Objects Problem Statement You are required to design a database ERD for a library system that includes the following: Definitions of books Every book has only one category Every book might have one or more authors
Naming Database Objects ERD
Optimizing Queries Preparing Your Environment This system is designed for a huge library and the initial numbers of records as the following: 500,000 Books with a growth rate of 20% per year 30% of the books have more than one author Every Author in average has 1.7 books Books are categorized into 500 categories
Optimizing Queries Problem Statement One of the required queries in this system is to list (in one query): Book Title Category Number of Authors of this book
Optimizing Queries Sample query using sub-queries Sample query using joins Execution plan Optimization using indexes
Comparing Database Versions Deploy Your First Version Now deploy your first version of your application and code and note that it’s the first version of the application Organize your local databases Generate scripts for database structure
De-Normalization After deploying your first version, the client asked to have multi levels of categories like this sample:
Comparing Database Versions  Deploy Your Second Version Now you are required to send database changes to your customer without affecting the entered data! How to use SQL Compare How to use SQL Data Compare
Unit Testing Unit Testing using Visual Studio 2010 Writing a unit testing method Debugging using unit testing Generating a unit test report
Detecting Application Version Version Numbers What does this mean: Version 0.0.0.2 What does this mean: Version 1.2.3.9 How to use and detect application version programmatically
Running Scripts Programmatically You are required to run the SQL scripts files of your first and second deployment programmatically Running simple SQL script Running multi-commands SQL script
Manage Application Version Problem Statement The workshop is to make a self-installable application that detects the database version, application version and installs the missing versions in between.
Manage Application Versions Flowchart Get List of missing Versions in between Check Code Version > DB Version Execute version script And update db version =< DB Version Start End
Manage Application Versions Workshop
Follow Us Email:  [email_address] Blog:  http://hazemtorab.blogspot.com Contact Me Website:  http://www.irange.net Twitter:  http://twitter.com/IRange_Software  Facebook:  http://www.facebook.com/IRange.Software
Thank  You

More Related Content

Best Software Development practices by Hazem Torab

  • 1. Best Practices I A Comprehensive Programming Workshop by Hazem Torab IRange Co-Founder
  • 2. Agenda Database Naming Database Objects Optimizing Queries De-normalization Comparing Database Versions Code Running Scripts Programmatically Unit Testing Detecting Application Version Workshop: Manage Application Versions
  • 3. Naming Database Objects Database Tables and Views Conventions Lookups Settings Stored Procedures and Functions Generated Procedures Custom Procedures / Functions
  • 4. Naming Database Objects Problem Statement You are required to design a database ERD for a library system that includes the following: Definitions of books Every book has only one category Every book might have one or more authors
  • 6. Optimizing Queries Preparing Your Environment This system is designed for a huge library and the initial numbers of records as the following: 500,000 Books with a growth rate of 20% per year 30% of the books have more than one author Every Author in average has 1.7 books Books are categorized into 500 categories
  • 7. Optimizing Queries Problem Statement One of the required queries in this system is to list (in one query): Book Title Category Number of Authors of this book
  • 8. Optimizing Queries Sample query using sub-queries Sample query using joins Execution plan Optimization using indexes
  • 9. Comparing Database Versions Deploy Your First Version Now deploy your first version of your application and code and note that it’s the first version of the application Organize your local databases Generate scripts for database structure
  • 10. De-Normalization After deploying your first version, the client asked to have multi levels of categories like this sample:
  • 11. Comparing Database Versions Deploy Your Second Version Now you are required to send database changes to your customer without affecting the entered data! How to use SQL Compare How to use SQL Data Compare
  • 12. Unit Testing Unit Testing using Visual Studio 2010 Writing a unit testing method Debugging using unit testing Generating a unit test report
  • 13. Detecting Application Version Version Numbers What does this mean: Version 0.0.0.2 What does this mean: Version 1.2.3.9 How to use and detect application version programmatically
  • 14. Running Scripts Programmatically You are required to run the SQL scripts files of your first and second deployment programmatically Running simple SQL script Running multi-commands SQL script
  • 15. Manage Application Version Problem Statement The workshop is to make a self-installable application that detects the database version, application version and installs the missing versions in between.
  • 16. Manage Application Versions Flowchart Get List of missing Versions in between Check Code Version > DB Version Execute version script And update db version =< DB Version Start End
  • 18. Follow Us Email: [email_address] Blog: http://hazemtorab.blogspot.com Contact Me Website: http://www.irange.net Twitter: http://twitter.com/IRange_Software Facebook: http://www.facebook.com/IRange.Software