1.28k likes | 1.54k Views
A Modern Architecture Review. Using Code Review Tools. @ AdamCogan | # vsalm #tee12 #dev324. Agenda. #1 The 1 st things to look out for Processes Does it work? Documentation #2 High Level tools Architecture Code Analysis Code Metrics #3 Manual Checking SOLID Design Principles
E N D
A Modern Architecture Review Using Code Review Tools @AdamCogan | #vsalm #tee12 #dev324 Delivering Awesome Web Applications
Agenda #1 The 1st things to look out for • Processes • Does it work? • Documentation #2 High Level tools • Architecture • Code Analysis • Code Metrics #3 Manual Checking • SOLID Design Principles • Code Review tools
About Adam • Chief Architect at SSW • Developing custom solutions for businesses across a range of industries such as Government, banking, insurance • Microsoft Gold Partner • Microsoft Regional Director • VSTS MVP • @AdamCogan
Do you evaluate the processes? • Often times this is the source of problems • Are devs getting bogged down in the UI? • Do you have a Scrum Master? • Do you have continuous integration? • Do you have continuous deployment? • Do you have a Schema Master? • Do you have a TFS Master? http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/DoYouHaveTheDesignersFixingUpTheUI.aspx
Are they on the latest version? • …of VS • …of TFS • Alternatively for a ‘Gold Star’ … • Resharper, add-ins, extensions http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/CanYouGetLatestAndCompile.aspx
Can you ‘Get latest’ and compile? #L1 • It's amazing how often you can't simply do a "Get Latest" and compile • Add _Instructions_Compile.docx • Then run unit tests… http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/CanYouGetLatestAndCompile.aspx
Can you get latest and compile? #L1 • See the Integration.Test project fail • Add _Instructions_Compile.docx http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/CanYouGetLatestAndCompile.aspx
Can you get latest and compile? #L2 • Creation of the database via scripts (incremental)Tip: use OSQL, SQLCMD or SSW SQL Deploy • and re-run the tests. They will now pass.
Do you want a ‘Gold Star’ ? #L3 • Streamline setup of a new development environment • Problems to check for: • Windows 8 not supported • Many things to build • Lots of dependencies • Recommendation: All manual work station setup steps should be scripted with PowerShell • Recommendation: A get + compile should work within 1 minute, and work without a dev being on the domain (to support external consultants)
Figure: You see the problems in the devsenvironmentNote Prefix eg. _01Setup-Environment.ps1 PS C:\Code\Northwind> .\Setup-Environment.ps1 Problem: Azure environment variable run state directory is not configured (_CSRUN_STATE_DIRECTORY). Problem: Azure Storage Service is not running. Launch the development fabric by starting the solution. WARNING: Abandoning remainder of script due to critical failures. To try and automatically resolve the problems found, re-run the script with a -Fix flag.
Figure: The script tries to automatically fix the problems PS C:\Code\Northwind> .\Setup-Environment.ps1 -fix Problem: Azure environment variable run state directory is not configured (_CSRUN_STATE_DIRECTORY). Fixed: _CSRUN_STATE_DIRECTORY user variable set Problem: Azure Storage Service is not running. Launch the development fabric by starting the solution. WARNING: No automated fix available for 'Azure Storage Service is running' WARNING: Abandoning remainder of script due to critical failures.
Figure: Note on 2nd run only 1 script remains – see there is less to fix PS C:\Code\Northwind> .\Setup-Environment.ps1 -fix Problem: Azure Storage Service is not running. Launch the development fabric by starting the solution. WARNING: No automated fix available for 'Azure Storage Service is running' WARNING: Abandoning remainder of script due to critical failures.
Can you ‘Check In’ and Deploy #L1 • Add _Instructions_Deploy.docx • Alternatively for a ‘Star’ … http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/Default.aspx
Can you ‘Check In’ and Deploy #L2 • Use PowerShell scripts as your documentation • build.ps1 • deploy_dev.ps1 • deploy_test.ps1 • deploy_prod.ps1 • Alternatively for a ‘Gold Star’ … TFSBuild + Portal http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/Default.aspx
Do you review the Solution and Project names? • The name of your solution and the names of the project in your solution should be consistent http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/DoYouReviewTheSolutionName.aspx
Do you review the documentation? • Old School: • Heavy, long documents • Sequence Diagrams • UML http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/DoYouReviewTheDocumentation.aspx
Suggestions for doco eg. Enterprise Architect • Use Red for unimplemented stuff • Use the DateTime shape To see the last time the diagram was modified and by whom • Mark items as ‘TODO: Adam’. For items still pending
Do you review the documentation • New School: • 4 docs • Business.docx • _Instructions_Compile.docx • _Instructions_Deploy.docx • Technologies.docx • Unit Tests (low level) • Code and Work Items (low level PBI)
Agenda #1 The 1st things to look out for • Processes • Does it work? • Documentation #2 High Level tools • Architecture • Code Analysis • Code Metrics #3 Manual Checking • SOLID Design Principles • Code Review tools
Do you look at the architecture? • 2 Choices: • VS Dependency Graph or … ? • Ultimate Edition • nDepend? • 3rd Party Tool for a few hundred $ • Weak dependency graph • No need for VS Ultimate • Bonus: See problems in the ‘Queries + Rules Explorer’ http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/DoYouLookAtTheArchitecture.aspx
Great Overview tool and learning toolNot for day-to-day use as a code analysis tool.Note: Don’t be distracted by a colour problem
Do you use the best Code Analysis tools? http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/DoYouDoCodeAnalysis.aspx
Do you use the best Code Analysis tools? • Level 1 – ReSharper – All Rules • Level 2 - VS Code Analysis (FXCop) – Default Settings • Level 3 - VS Code Analysis (FXCop) – All Rules • Level 4 – StyleCop – All Rules • Level 5 – SSW Code Auditor – All Rules? http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/DoYouDoCodeAnalysis.aspx
Do you use the best Code Analysis tools? http://rules.ssw.com.au/SoftwareDevelopment/RulestobetterArchitectureandCodeReview/Pages/DoYouDoCodeAnalysis.aspx