@elbruno How To Code Efficiently Bruno Capuano @elbruno #MSFTHacks
@elbruno
How To Code Efficiently
Bruno Capuano@elbruno
#MSFTHacks
@elbruno
Bruno CapuanoInnovation Manager@elbruno
http://www.elbruno.com
@elbruno
Learn to Unlearn0#
How To Code EfficientlyMSFTHacks201
7
“Your wife is always right. Even when she is wrong,
after some time you realize you are wrong and
she is right.“
Dr. House
You probably don’t know how to tie
laces
@elbruno
Visual Studio 2017 & Visual Studio Code
1#How To Code EfficientlyMSFTHacks201
7
@elbruno
Most popular technologies
http://stackoverflow.com/research/developer-survey-2016#technology-most-popular-technologies
@elbruno
Most loved technologies
http://stackoverflow.com/research/developer-survey-2016#technology-most-loved-dreaded-and-wanted
@elbruno
Changing our tune…
Run on Windows.NET as system componentRun on VM (CLR)Black box compilersEdit in Visual StudioProprietary
Run everywhereDeploy with appCompile to nativeOpen compiler APIsUse your favorite editorOpen source
Get the Tools https://www.visualstudio.com/
@elbruno
Code>Build>Debug
We have new tools !
2#How To Code EfficientlyMSFTHacks201
7
@elbruno
Code process flow … :D
BUILDDEBUGEDIT
Developer does this #40 times a day (Linker)
@elbruno
Demo
@elbruno
Augment Visual Studio 2017
3#How To Code EfficientlyMSFTHacks201
7
@elbruno
Stay in the zoneHeads up display for codeLightbulbs provide quick actions in the editor for suggested code fixes, refactoringSee elapsed time while debugging to identify slow running code using PefTips. Get details by clicking directly into the diagnostic toolsRenaming highlights words to be updated with all words updating at the same time
Setting customization and roamingUsing your Microsoft account enables you to access your settings across editions and versions so that it always feels familiar
@elbruno
Code process flow … :D
BUILDDEBUGEDIT
Developer does this #40 times a day (Linker)
http://roslyn.io@roslyn
@elbruno
@elbruno
Write new features faster
1
TuplesEasily pass around groups of values
Pattern matchingTest the shape and content of expressions
Local functionsClean up classes by nesting helpers
@elbruno
Provide open source API
2
@elbruno
Analyzers identify errors and provide fixes in your
code as you type, i.e. without having to wait for a
build.
@elbruno
VSIX NUGET
Teach new language features/concepts
Introduce best practices for SDK
Enforce code style rules
Identify errors before build
@elbruno
Analyzer EcosystemFxCopAnalyzers (MSFT):
https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers/
SonarLint http://www.sonarlint.org/visualstudio/rules/index.htmlStyleCopAnalyzers:
https://github.com/DotNetAnalyzers/StyleCopAnalyzersCodeCracker https://github.com/code-cracker/code-crackerRoslynator https://github.com/JosefPihrt/RoslynatorVS Refactoring Essentials:
http://vsrefactoringessentials.com/GCop: https://visualstudiogallery.msdn.microsoft.com/f082f20e-
5123-4c0d-975a-0a17995d858b
@elbruno
Productivity
Refactoring supportNavigation/searchStyle enforcement
Testing
Better IntelliSense
@elbruno
Demo
@elbruno
Don’t go for “Yet Another …”
4#How To Code EfficientlyMSFTHacks201
7
@elbruno
“Yet another” defintion …Among programmers, yet another (often abbreviated ya, Ya or YA in the initial part of an acronym) is an idiomatic qualifier in the name of a computer program, organisation, or event that is confessedly unoriginal.[1]
Stephen C. Johnson is credited with establishing the naming convention in the late 1970s when he named his compiler-compiler yacc (Yet Another Compiler-Compiler), since he felt there were already numerous compiler-compilers in circulation at the time.https://en.wikipedia.org/wiki/Yet_another
As in "Yet Another AI Group" or "Yet Another Simulated Annealing Algorithm". If used of others' work, it describes something of which there are already far too many. In hackish acronyms the "YA" prefix almost invariably expands to Yet Another, e.g. YABA, YAUN.http://www.dictionary.com/browse/yet-another
YAAF – Yet Another Application FrameworkYabasic – Yet Another BASICYabause – Yet Another Broken and Uncomplete Saturn EmulatorYacc – Yet another compiler compilerYacas – Yet another computer algebra systemYACT – Yet another capture the flag teamYACTA – Yet Another CT AnalyzerYaDICs – Yet another Digital Image Correlation SoftwareYADIFA – Yet Another DNS Implementation For AllYafaRay – Yet another free Ray tracerYafc – Yet another FTP clientYAFFS – Yet Another Flash File SystemYafra – Yet Another FrameworkYAGO – Yet Another Great OntologyYahoo! – Yet another hierarchical, officious oracle[2]
Yakuake – Yet Another KuakeYAM – Yet Another Mailer, an email clientYAML – Yet Another Markup Language. Later redefined to YAML Ain't Markup Language, making a recursive acronymYandex – Yet another indexer,[3] a web search engine and indexYA-NewsWatcher – a Usenet client for classic Mac OSYANG – Yet Another Next GenerationYaourt – Yet AnOther User Repository ToolYAP – Yet Another Previewer, document previewerYAP – Yet Another Prolog, an implementation of the Prolog programming languageYAPC – Yet Another Perl ConferenceOperator YAPO – Yet Another Portable OperaYARN – Yet Another Resource NegotiatorYARP – Yet Another Robot PlatformYARV – Yet Another Ruby VMYasara – Yet Another Scientific Artificial Reality Application, a molecular modeling programYasca – Yet Another Source Code AnalyzerYaST – Yet another Setup Tool, an operating system installation and configuration wizard for SUSE Linux distributionsY.A.S.U. – Yet Another SecuROM UtilityYate – Yet Another Telephony Engine, VoIP softwareYAWC – Yet Another Wersion of CitadelYAWL – Yet Another Workflow Language, a business process modeling language for diagramming workflow patternsYaws – Yet another web serverYAZ – Yet Another Z39.50 Toolkit
Demo UWP Community Toolkit 1.3
@elbruno
Thinks on DevOps5#
How To Code EfficientlyMSFTHacks201
7
Plan1 Monitor +
Learn
Release
Develop + Test2
Development
Production
4
3
DevOps
It starts with an idea – and a plan how to turn this idea into reality …
Manage work
Develop + Test
1
PlanProject starts
PlanTrack progress
Write Code
Unit Testing
2
Build
Version Control
Build Verification
Release
Once the iteration starts, developers turn great ideas into features …
Develop + Test
Source Build
Continuous Integration
Value• Accelerate Delivery• Repeatability • Optimized Resources
Measure• More frequent releases• MTTR• MTTD
cspkg
Test
DEV OPSOPS
CloudLoad
TestingIntegration testing
environment
Automated functional testing environment
3
Pre-production environment
Stagingenvironment
Monitor + Learn
When all tests pass, the build is deployed to testing environments for each stage in the release process
Release
SOURCE REPO DEV
Release Management
Value• Optimized Resources• Accelerate Delivery
Measure• Deployment Rate• MTTR• Availability
STAGE
PRODUCTIONDEV OPS
Learn and understand how users use your app, how it reacts and quickly fix issues and bugs
Monitor + Learn
4
Monitor
Feedback
Plan the next iteration
Monitor and LearnTesting in Production
PRODUCTION A PRODUCTION B
90% 10%
TelemetryPRODUCTIO
N
Fault Injection
X
X X
X
@elbrunoMICROSOFT CONF IDENT IAL – INTERNAL ONLY
TFS
01
Deve
lop Developer Workstation
Team Collaboration
02
Build
& Te
st Build/CI
Test
Release Management for Visual Studio
Microsoft Test Manager
03
Depl
oy
Release Management for Visual Studio
Release
Automation Service
Azure Resource Management
PowerShell | WAML
xPlat Command Line
04
Mon
itor &
Le
arnMonitor
MicrosoftEcosystem
Application Insights
People | Process | Tools
Workstations - On-Premises | Hybrid | Cloud Monitoring - On-Premises | Hybrid | CloudALM Services - On-Premises | Hybrid | Cloud
DEV TEST QA
Environments - On-Premises | Hybrid | Cloud
TFS / VSTS
TFS / VSTS
TFS / VSTS
VSTS
@elbruno
01
Deve
lop Developer Workstation
Team Collaboration
02
Build
& Te
st Build/CI
Test
03
Depl
oy Configuration 04
Mon
itor &
Le
arnMonitor
This graphic shows OSS and partner products that are integrated with the Microsoft DevOps solution
MixedEcosystem
Release
People | Process | Tools
@elbruno
Hackathon Continuous Integration
It’s just a simple ASP.NET or Node.js web api!
Considerations:• CI for dependent services that you own
that are called by the bot• LUIS, Databases, external APIs• Put bot configs in Environment Variables or
Release definition to share the same build
Build
cspkg
@elbruno
Hackathon Testing
How do you test a bot? Considerations, forget about:• Auth• Mocking connector, mocking LUIS calls• Unit/Functional/Load testing https://www.microsoft.com/developerblog/real-life-code/2017/01/20/Bot-Framework-Unit-Testing.html https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Tests/Microsoft.Bot.Sample.Tests/AlarmBotTests.cs#L91 https://github.com/Microsoft/BotBuilder/tree/master/CSharp/Tests/Microsoft.Bot.Builder.Tests/Scripts
Test
@elbruno
Hackathon Cont. Deployment
It’s just an ASP.NET or Node.js web api! Considerations:• CD for dependent services that you own that
are called by the bot• Updates and retraining of LUIS models and
other intelligent systems• Bot state• Functional/performance tests
Deploy
X
@elbruno
Online demoThiago Almeida & Donovan Brown(18 min video on Channel 9)https://channel9.msdn.com/Series/DevOps-for-the-Bot-Framework/Continuous-Deployment-and-Release-Management-for-the-Bot-Framework
@elbruno
Code Efficiently1. Visual Studio 2017 & Visual Studio Code2. Interactive Window3. Get the most of Visual Studio 2017! 4. Don’t do a “Yet another …” 5. Think on DevOps for Bots
@elbruno
Q&A
@elbruno
Bruno CapuanoInnovation Manager@elbruno
http://www.elbruno.com