new development workflow
DESCRIPTION
New development workflow. @ DavidBurela Senior Consultant Hazaa. Windows Phone 7 apps. http://tinyurl.com/BurelaAzureBook. Goal for today’s presentation. Demonstrate how new technologies used together can change the workflow of a developer - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/1.jpg)
New development workflow
@DavidBurelaSenior ConsultantHazaa
![Page 2: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/2.jpg)
Windows Phone 7 apps
![Page 3: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/3.jpg)
http://tinyurl.com/BurelaAzureBook
![Page 4: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/4.jpg)
Goal for today’s presentation
• Demonstrate how new technologies used together can change the workflow of a developer
• Build a complete HTML5 website that incorporates continuous deployment.
![Page 5: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/5.jpg)
Technologies
• Resharper• Mercurial• TortoiseHg• ASP.Net MVC3 April tools update• NuGet• Ninject• nSubstitute• Bitbucket.org• Appharbor.com
![Page 6: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/6.jpg)
Current paradigms
Old New Technology
Source Centralised(TFS / subversion)
DVCS MercurialTortoiseHg
3rd partyAssemblies
libs folder Assembly repositoryNuGet
Build Bob’s machine Cloud Appharbor
Hosting Local data center Cloud Appharbor
deployment Deploy from Bob’s machine
auto deployment(from the cloud)
Appharbor
Testing manual testing unit tests & mocking
NinjectnSubstitute
![Page 7: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/7.jpg)
TFS vs DVCS
• TFS: Everyone pushes and pulls from the TFS server
![Page 8: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/8.jpg)
TFS vs DVCS• DVCS Workflow– Check in to your local repository regularly– Push your changes to a higher level repository
Melbourneteam
Sydney team
Corporationrepository
Productionweb server
![Page 9: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/9.jpg)
Git Vs. Mercurial
• Eric Sink on Distributed Version Control Systems http://www.hanselminutes.com/default.aspx?showID=250
• Summary:Git is more linux focusedMercurial good for Windows
![Page 10: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/10.jpg)
Mercurial
• Command line vs. graphical• http://tortoisehg.bitbucket.org/ – Mercurial runtime– Explorer add-in
![Page 11: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/11.jpg)
Mercurial Demo
AnimalscatdogdolpinsalmonparrotKiwi(new line)
![Page 12: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/12.jpg)
Mercurial Demo
Add categories• Mammals• Non-mammals
• KDiff3
![Page 13: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/13.jpg)
Mercurial Demo
Change categories• 4 legged• Swimming• flying
![Page 14: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/14.jpg)
Mercurial Demo
Create a new experimental animals branchSharksCyber dogs
Another random animal
![Page 15: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/15.jpg)
Mercurial Demo
Back to the main branchAdd a horseAdd another animal
![Page 16: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/16.jpg)
Mercurial Demo
Merge!
![Page 17: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/17.jpg)
Creating the website
• Create a new ASP.Net MVC 3– HTML5 semantics– Unit test project
![Page 18: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/18.jpg)
Creating the website
• Check source code into mercurial• Use a .hgignore file– Steal from https://bitbucket.org/FunnelWeb
![Page 19: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/19.jpg)
Creating the website
• Run unit tests• Make change
ViewBag.Message = "Welcome to the Burela demo";
• F5• Run unit tests• Checkin
![Page 20: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/20.jpg)
Creating the website
• Add a new property to the dynamic object– ViewBag.Animals = "Cat, Dog, Elephant, ";
• Update the html to include the data– <p>
@ViewBag.Animals</p>
• Check in• Lets get this data from a service instead
![Page 21: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/21.jpg)
Using a data repository
HomeControllerIndex(){ var service= new DataService(); var data = service.GetData(); ViewBag.Animals = data;}
![Page 22: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/22.jpg)
Using a data repository
HomeControllerIndex(){ var service = new DataService(); var data = service.GetData(); ViewBag.Animals = data;}
DataService
• Has a concrete implementation• Can’t unit test
![Page 23: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/23.jpg)
Inversion of control& Dependency Injection
HomeControllerIndex( IDataService service){ var data = service.GetData(); ViewBag.Animals = data;}
DataService(runtime)
• Can pass in different implementations– Database, webservice, fake
• Easier to unit test
FakeService(testing)
Known value 1Known value 2Known value 3…
![Page 24: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/24.jpg)
Ninject
![Page 25: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/25.jpg)
3rd party assemblies
• Libs folder
![Page 26: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/26.jpg)
3rd party assemblies
• Find the website• Find the correct version (.Net 4.0, Silverlight)• Extract• Copy into libs folder• Etc.• Repeat for each new version
![Page 27: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/27.jpg)
Introducing NuGet
• A way to add 3rd party libraries to your project, from an online repository, within Visual Studio.
• Easy discovery• Easy installation• Easy upgrades
![Page 29: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/29.jpg)
Introducing NuGet
• Installed as Visual Studio extension
![Page 30: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/30.jpg)
Introducing NuGet
• Install Ninject– Right click, Add Package Reference– Search for package– Install
![Page 31: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/31.jpg)
Introducing NuGet
Web Activator
Ninject
Ninject.MVC
Allows other NuGet packagesto execute code at start up
The Ninject .DLL files
Adds startup code to the appenables Ninject IoC
![Page 32: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/32.jpg)
Introducing NuGet
• Update the current packages
![Page 33: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/33.jpg)
Introducing NuGet• Open .nupack– Multiple versions of Ninject inside of it
![Page 34: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/34.jpg)
Website
• App_Start/NinjectMVC3.cs• Now that we have Ninject, lets continue with
the website
![Page 35: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/35.jpg)
Inversion of control& Dependency Injection
HomeController (IDataService dataService)Index(){ var data = dataService.GetData(); ViewBag.Animals = data;}
DataRepository(runtime)
• Can pass in different implementations• Easier to unit test
FakeRepository(testing)
Known value 1Known value 2Known value 3…
![Page 36: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/36.jpg)
Mocking with nSubstitute[TestMethod]public void Index(){ // Arrange var animalDataService = Substitute.For<IAnimalDataService>(); animalDataService.GetData().Returns(new List<string> { "dog", "cat", "rhino" }); HomeController controller = new HomeController(animalDataService);
// Act ViewResult result = controller.Index() as ViewResult;
// Assert Assert.AreEqual(“Animals: dog, cat, rhino, ", result.ViewBag.Animals);}
![Page 37: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/37.jpg)
• Check it all into mercurial again
![Page 38: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/38.jpg)
Pushing to BitBucket
• Unlimited free private repositories• Create a new repository• Push the changes• The entire changeset history is pushed
![Page 39: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/39.jpg)
Hosting on AppHarbor
1. Create a new AppHarbor service2. Copy notification URL from AppHarbor3. Configure BitBucket to notify AppHarbor
when code checked in4. AppHarbor pulls the source– Builds– Deploys
![Page 41: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/41.jpg)
Break the build
• Comment out ViewBag.Message = • Push code to BitBucket• AppHarbor will fail the unit tests– Cancel deployment
![Page 42: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/42.jpg)
Website authentication
• Create a new database on AppHarbor– The web.config connection string will be replaced
automatically• Generate the tables– aspnet_regsql.exe
![Page 43: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/43.jpg)
Recap
Old New Technology
Source Centralised(TFS / subversion)
DVCS MercurialTortoiseHg
3rd partyAssemblies
libs folder Assembly repositoryNuGet
Build Bob’s machine Cloud Appharbor
Hosting Local data center Cloud Appharbor
deployment Deploy from Bob’s machine
auto deployment(from the cloud)
Appharbor
Testing manual testing unit tests & mocking
NinjectnSubstitute
![Page 44: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/44.jpg)
Bitbucket client
![Page 45: New development workflow](https://reader035.vdocuments.us/reader035/viewer/2022062301/568160dc550346895dd00d18/html5/thumbnails/45.jpg)
Checking packages into source control
• Is it required to check the packages into source control?
• Nuget install packages.config