SlideShare a Scribd company logo
NuGet 3.0 
Transitioning from OData 
to JSON-LD 
Jeff Handley 
@JeffHandley
NuGet 3.0 
New UI for Visual Studio 
• Lots of new UI features 
New client/server API 
• Built for nuget.org availability, based on usage patterns 
Lots of code refactoring 
• Easier maintenance going forward
NuGet 3.0 - Transitioning from OData to JSON-LD
NuGet 3.0 Plans 
Aligned with Visual Studio “14” release cycle 
• Preview in the next release 
• Shipping for VS 2012 and VS 2013 
• Not shipping for VS 2010 
MSBuild will consume package references 
Solution Explorer integration 
Details at http://blog.nuget.org
Transitioning to the 
new client/server API 
Design retrospective
package repository 
remote server local folder 
package 
metadata from API unpacked into memory 
Visual Studio project system 
C# F# Windows Phone … 
file system 
/packages folder project system
Guiding principles 
BEFORE NUGET 3.0 
Bolt onto Visual Studio 
Heavy use of abstractions 
Comprehensive unit tests 
Generic client/server API (OData)
Visual Studio bolt-on 
Use Visual Studio API 
Same result as manually referencing libraries 
Integrate with most Visual Studio project systems 
Support VS-integrated source control
Abstractions 
IPackageRepository 
• nuget.org 
• Other remote servers 
• Folder on disk or network 
IPackage/IPackageMetadata 
• Remote 
• In-memory 
• On disk 
IPackageManager 
IProjectSystem 
• C# 
• F# 
• Windows Phone 
IFileSystem 
• Actual file system 
• Project systems 
• Source control 
LOOSE COUPLING & UNIT TESTING 
more than 80 other interfaces
Generic client/server API 
ANOTHER FORM OF LOOSE COUPLING 
Don’t couple the client to a server implementation 
Avoid versioning the server to add client features 
LINQ programming model for local and remote
NuGet.VisualStudio 
NuGet.Core 
PowerShell 
console 
package 
manager 
window 
VS IDE 
integration 
source control 
integration 
command 
extensions 
nuget.exe
NuGet.VisualStudio 
Visual Studio IDE integration 
• Output window logging 
• Settings (package sources) 
• Automatic package restore upon build 
• Garbage-collecting packages on VS restart 
• Extension update banner 
Visual Studio APIs 
• Project system integration 
• Actual package installation and uninstallation
NuGet.Core 
• Package authoring (including package analysis rules) 
• Package reading (OPC/Zip, data model w/validation, file conventions) 
• Semantic Version implementation 
• Target framework compatibility 
• Dependency resolver 
• Local and remote sources (API, HTTP, proxies, authentication) 
• NuGet.Config Processing (including hierarchical and extensible features) 
• 80+ interfaces
http://valleyreport.blogspot.com/2012/01 
/revised-dumping-ordinance-allows.html
Classes fulfilling multiple interfaces 
Project systems are also file systems 
• Add/remove files 
• Enforces VS project system and source control integration 
/packages folder is also a package repository 
• GetPackages() 
• AddPackage() 
• RemovePackage() 
Extension methods on interfaces to simulate multiple inheritance 
• 17 “extensions” classes that act as base classes 
33 “utility” classes to contain business logic
Extreme loose coupling 
Magic values trigger special handling several layers deep 
• FindPackage(id, version: null); 
Granular interfaces led to unmanageable parameter counts 
• ProjectSystemExtensions.DeleteFiles FxCop 
suppressions 
Events during operations allowed decoupled reactions 
• InstallWalker needs to report progress to the VS UI
http://www.flickr.com/photos/bump/2807032202/
No change was easy 
• 18 classes touched adding HTTP headers for downloads 
• Dozens of classes affected to add a new field to nuspec 
• Mocks require more work than the actual implementation 
• Extension methods are not compatible with mocking 
•We became afraid to touch the dependency resolver
Big changes needed 
Replacing API v2 with API v3
SQL Azure 
database 
Azure 
Blob 
Storage 
Gallery / API v2 
Azure web role (3 instances) 
EntityFramework 
code-first 
WCF Data 
Services and 
ASP.NET MVC 
and Razor 
OData 
Search and 
feed 
requests 
Content Delivery Network (CDN) 
Package 
downloads
Azure 
Blob 
Storage 
Search Service 
Azure worker role (3+ instances) 
Lucene.NET 
Full index loaded into memory 
Content Delivery Network (CDN) 
Metrics Service 
Azure website (3+ instances) 
SQL Azure 
database 
Search 
queries 
Package 
metadata 
requests 
Package 
downloads
JSON-LD 
http://json-ld.org/ 
{ 
"@context": "http://json-ld.org/contexts/person.jsonld", 
"@id": "http://dbpedia.org/resource/John_Lennon", 
"name": "John Lennon", 
"born": "1940-10-09", 
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon" 
}
Creating the v3 client 
For the new UI
API v2 support 
The UI must support both v2 and v3 clients 
No clean surface area to re-implement 
• UI  install walker  API v2  install walker  API v2 
• IQueryable<IPackage> exposed throughout code
NuGet 3.0 - Transitioning from OData to JSON-LD
Infinite surface area 
Finite scenarios
Scenarios and clients 
1. Search 
2. Install specific version 
3. Install latest version 
4. Install with dependencies 
5. Install from cache 
6. Install into another project 
7. Check for updates 
8. Update and update all 
9. Restore 
1. Package manager UI 
2. PowerShell console 
3. nuget.exe
http://www.clayburn.wtf/2011/03/to 
p-5-reasons-youre-unemployed.html
API v3 
search 
(feed) 
Search Service 
Azure worker role (3+ instances) 
Lucene.NET 
Full Index Loaded into Memory 
Gallery / API v2 
Azure web role (3+ instances) 
Content Delivery Network (CDN) 
API v3 
Package 
Metadata 
Package 
Downloads 
Metrics Service 
Azure website (3+ instances) 
API v2 
OData 
SQL Azure 
database 
Azure 
Blob 
Storage
WCF Data Services to the rescue!? 
NuGet 
Core 
WCF Data 
Services 
API v2 
Server 
OData 
XML 
WCF Data 
Services 
Entity 
Framework 
API v3 
Services 
JSON-LD 
Convert JSON-LD to XML
http://www.marcioezequiel.com 
.br/2013/10/bigode-grosso.html
Introducing NuGet.Client 
Handle the client/server scenarios 
Support API v2 and API v3 
Scenario-focused object model 
Prevent new dependencies on NuGet.Core
Wrapping NuGet.Core 
Package Manager UI 
NuGet.Core 
NuGet.Client
Dealing with deep API v2 assumptions 
• Implemented v2 interfaces in v3 classes 
• Threw NotImplementedException on all members 
• Ran a scenario, identified code paths required 
• Identified more concrete API v3 requirements 
• Discovered data needed for each scenario 
• Influenced API v3 JSON-LD views
Shrinking NuGet.Core 
Package Manager UI 
NuGet.Core 
Package 
Authoring 
Package 
Reading 
Semantic 
Versioning 
Target FX 
Compat 
Dependency 
Resolver 
Local 
Package 
Sources 
NuGet 
Config 
Processing 
Project and 
NuGet.Core 
NuGet.Client 
NuGet.Client File Systems
Compromises 
API v3 isn’t completely “clean” yet 
• It exposes the API v2 interfaces 
Chatty 
• API v3 uses more HTTP requests than a pure v3 server/client would 
• API v2 interop performs more OData requests than we used to 
Out of scope 
• PowerShell console 
• nuget.exe
New guiding principles 
Our new rules
Guiding principle #1 
Technology is not a substitute 
for understanding our scenarios.
Guiding principle #2 
Don’t expose IQueryable on 
public API. 
* this applies to our RESTful services too
Guiding principle #3 
Every client/server scenario 
needs an explicit endpoint.
Guiding principle #4 
Shipping is more valuable than 
code purity.
Guiding principle #5 
Don’t implement interfaces just 
because the members match.
Guiding principle #6 
Side-effecting event handlers 
hurt in unpredictable ways.
Guiding principle #7 
Avoid business logic in extension 
methods. They can’t be mocked.
Guiding principle #8 
If adding new business logic is 
hard, refactor right away.
Thanks 
Come get NuGet stickers 
@jeffhandley | jeffhandley.com | jeff.handley@microsoft.com | blog.nuget.org

More Related Content

What's hot (20)

PDF
DockerCon SF 2015: Docker in the New York Times Newsroom
Docker, Inc.
 
PPTX
What’s New in Spring Batch?
VMware Tanzu
 
PDF
CI/CD 기반의 Microservice 개발
Oracle Korea
 
PDF
Orchestrating Microservices with Kubernetes
Weaveworks
 
PDF
Security model for a remote company
Pierre Mavro
 
PPTX
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
PDF
Introduction to GitHub Actions - How to easily automate and integrate with Gi...
All Things Open
 
PDF
Continuous Delivery the Hard Way with Kubernetes
Weaveworks
 
PDF
Windows container security
Docker, Inc.
 
PDF
Load Balancing in the Cloud using Nginx & Kubernetes
Lee Calcote
 
PDF
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Oleg Nenashev
 
PDF
OpenShift for Java EE Developers
Markus Eisele
 
PDF
Greach 2014 - Road to Grails 3.0
graemerocher
 
PDF
Introduction to Kubernetes Security (Aqua & Weaveworks)
Weaveworks
 
PDF
NATS: Simple, Secure and Scalable Messaging For the Cloud Native Era
wallyqs
 
PDF
Provisioning Servers Made Easy
All Things Open
 
PDF
Jenkins Workflow Webinar - Dec 10, 2014
CloudBees
 
PDF
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
Docker, Inc.
 
PDF
Demystifying container connectivity with kubernetes in docker
Docker, Inc.
 
PDF
My kubernetes toolkit
Sreenivas Makam
 
DockerCon SF 2015: Docker in the New York Times Newsroom
Docker, Inc.
 
What’s New in Spring Batch?
VMware Tanzu
 
CI/CD 기반의 Microservice 개발
Oracle Korea
 
Orchestrating Microservices with Kubernetes
Weaveworks
 
Security model for a remote company
Pierre Mavro
 
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
Introduction to GitHub Actions - How to easily automate and integrate with Gi...
All Things Open
 
Continuous Delivery the Hard Way with Kubernetes
Weaveworks
 
Windows container security
Docker, Inc.
 
Load Balancing in the Cloud using Nginx & Kubernetes
Lee Calcote
 
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Oleg Nenashev
 
OpenShift for Java EE Developers
Markus Eisele
 
Greach 2014 - Road to Grails 3.0
graemerocher
 
Introduction to Kubernetes Security (Aqua & Weaveworks)
Weaveworks
 
NATS: Simple, Secure and Scalable Messaging For the Cloud Native Era
wallyqs
 
Provisioning Servers Made Easy
All Things Open
 
Jenkins Workflow Webinar - Dec 10, 2014
CloudBees
 
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
Docker, Inc.
 
Demystifying container connectivity with kubernetes in docker
Docker, Inc.
 
My kubernetes toolkit
Sreenivas Makam
 

Viewers also liked (20)

PPTX
Running in the Cloud - First Belgian Azure project
Maarten Balliauw
 
PPTX
Fun with ASP.NET MVC 3, MEF and NuGet (#comdaybe)
Maarten Balliauw
 
PPTX
An overview of the NuGet ecosystem - Mobel.io
Maarten Balliauw
 
PPTX
Understanding NuGet implementation for Enterprises
J S Jodha
 
PDF
OData, Open Data Protocol. A brief introduction
Eugenio Lentini
 
PPTX
NuGet vs Maven
Miguel Fernández
 
PPTX
Using nu get the way you should svcc
Maarten Balliauw
 
PPTX
Using NuGet the way you should - TechDays NL 2014
Maarten Balliauw
 
PPTX
Developing NuGet
Jeff Handley
 
PPTX
The API Tempest
Sam Ramji
 
PPTX
Elegant Rest Design Webinar
Stormpath
 
PPTX
Build A Killer Client For Your REST+JSON API
Stormpath
 
PPTX
Gestion paquetes NuGet con Visual Studio Team Services y MyGet
Luis Fraile
 
PPTX
JSON-LD for RESTful services
Markus Lanthaler
 
PPTX
Hortonworks Data In Motion Series Part 4
Hortonworks
 
PPTX
Custom Data Search with Stormpath
Stormpath
 
PDF
JWTs in Java for CSRF and Microservices
Stormpath
 
PDF
Protecting Your APIs Against Attack & Hijack
CA API Management
 
PDF
Getting Started With Angular
Stormpath
 
PPTX
Instant Security & Scalable User Management with Spring Boot
Stormpath
 
Running in the Cloud - First Belgian Azure project
Maarten Balliauw
 
Fun with ASP.NET MVC 3, MEF and NuGet (#comdaybe)
Maarten Balliauw
 
An overview of the NuGet ecosystem - Mobel.io
Maarten Balliauw
 
Understanding NuGet implementation for Enterprises
J S Jodha
 
OData, Open Data Protocol. A brief introduction
Eugenio Lentini
 
NuGet vs Maven
Miguel Fernández
 
Using nu get the way you should svcc
Maarten Balliauw
 
Using NuGet the way you should - TechDays NL 2014
Maarten Balliauw
 
Developing NuGet
Jeff Handley
 
The API Tempest
Sam Ramji
 
Elegant Rest Design Webinar
Stormpath
 
Build A Killer Client For Your REST+JSON API
Stormpath
 
Gestion paquetes NuGet con Visual Studio Team Services y MyGet
Luis Fraile
 
JSON-LD for RESTful services
Markus Lanthaler
 
Hortonworks Data In Motion Series Part 4
Hortonworks
 
Custom Data Search with Stormpath
Stormpath
 
JWTs in Java for CSRF and Microservices
Stormpath
 
Protecting Your APIs Against Attack & Hijack
CA API Management
 
Getting Started With Angular
Stormpath
 
Instant Security & Scalable User Management with Spring Boot
Stormpath
 
Ad

Similar to NuGet 3.0 - Transitioning from OData to JSON-LD (20)

PDF
Open shift and docker - october,2014
Hojoong Kim
 
PPT
.NET Core Apps: Design & Development
GlobalLogic Ukraine
 
PPTX
Vijay Oscon
vijayrvr
 
PPTX
ASP.NET vNext
Alex Thissen
 
PDF
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
Kumton Suttiraksiri
 
PPTX
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup
 
PPTX
Azure DevOps for JavaScript Developers
Sarah Dutkiewicz
 
PPTX
What's New in .Net 4.5
Malam Team
 
PPTX
Best of Microsoft Dev Camp 2015
Bluegrass Digital
 
PDF
Red Hat Forum Benelux 2015
Microsoft
 
PPTX
MVC 6 - the new unified Web programming model
Alex Thissen
 
PPTX
Azure serverless architectures
Benoit Le Pichon
 
PPTX
DEVNET-1166 Open SDN Controller APIs
Cisco DevNet
 
PDF
Mete Atamel
CodeFest
 
PDF
VMworld 2013: vSphere UI Platform Best Practices: Putting the Web Client SDK ...
VMworld
 
PPTX
JSS build and deployment
David Szöke
 
PPTX
Windows azure overview for SharePoint Pros
Usama Wahab Khan Cloud, Data and AI
 
PPTX
Deep Dive Azure Functions - Global Azure Bootcamp 2019
Andrea Tosato
 
PDF
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Bruno Borges
 
PPTX
ASP.NET Core 1.0
Ido Flatow
 
Open shift and docker - october,2014
Hojoong Kim
 
.NET Core Apps: Design & Development
GlobalLogic Ukraine
 
Vijay Oscon
vijayrvr
 
ASP.NET vNext
Alex Thissen
 
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
Kumton Suttiraksiri
 
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup
 
Azure DevOps for JavaScript Developers
Sarah Dutkiewicz
 
What's New in .Net 4.5
Malam Team
 
Best of Microsoft Dev Camp 2015
Bluegrass Digital
 
Red Hat Forum Benelux 2015
Microsoft
 
MVC 6 - the new unified Web programming model
Alex Thissen
 
Azure serverless architectures
Benoit Le Pichon
 
DEVNET-1166 Open SDN Controller APIs
Cisco DevNet
 
Mete Atamel
CodeFest
 
VMworld 2013: vSphere UI Platform Best Practices: Putting the Web Client SDK ...
VMworld
 
JSS build and deployment
David Szöke
 
Windows azure overview for SharePoint Pros
Usama Wahab Khan Cloud, Data and AI
 
Deep Dive Azure Functions - Global Azure Bootcamp 2019
Andrea Tosato
 
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Bruno Borges
 
ASP.NET Core 1.0
Ido Flatow
 
Ad

Recently uploaded (20)

PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Digital Circuits, important subject in CS
contactparinay1
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 

NuGet 3.0 - Transitioning from OData to JSON-LD

  • 1. NuGet 3.0 Transitioning from OData to JSON-LD Jeff Handley @JeffHandley
  • 2. NuGet 3.0 New UI for Visual Studio • Lots of new UI features New client/server API • Built for nuget.org availability, based on usage patterns Lots of code refactoring • Easier maintenance going forward
  • 4. NuGet 3.0 Plans Aligned with Visual Studio “14” release cycle • Preview in the next release • Shipping for VS 2012 and VS 2013 • Not shipping for VS 2010 MSBuild will consume package references Solution Explorer integration Details at http://blog.nuget.org
  • 5. Transitioning to the new client/server API Design retrospective
  • 6. package repository remote server local folder package metadata from API unpacked into memory Visual Studio project system C# F# Windows Phone … file system /packages folder project system
  • 7. Guiding principles BEFORE NUGET 3.0 Bolt onto Visual Studio Heavy use of abstractions Comprehensive unit tests Generic client/server API (OData)
  • 8. Visual Studio bolt-on Use Visual Studio API Same result as manually referencing libraries Integrate with most Visual Studio project systems Support VS-integrated source control
  • 9. Abstractions IPackageRepository • nuget.org • Other remote servers • Folder on disk or network IPackage/IPackageMetadata • Remote • In-memory • On disk IPackageManager IProjectSystem • C# • F# • Windows Phone IFileSystem • Actual file system • Project systems • Source control LOOSE COUPLING & UNIT TESTING more than 80 other interfaces
  • 10. Generic client/server API ANOTHER FORM OF LOOSE COUPLING Don’t couple the client to a server implementation Avoid versioning the server to add client features LINQ programming model for local and remote
  • 11. NuGet.VisualStudio NuGet.Core PowerShell console package manager window VS IDE integration source control integration command extensions nuget.exe
  • 12. NuGet.VisualStudio Visual Studio IDE integration • Output window logging • Settings (package sources) • Automatic package restore upon build • Garbage-collecting packages on VS restart • Extension update banner Visual Studio APIs • Project system integration • Actual package installation and uninstallation
  • 13. NuGet.Core • Package authoring (including package analysis rules) • Package reading (OPC/Zip, data model w/validation, file conventions) • Semantic Version implementation • Target framework compatibility • Dependency resolver • Local and remote sources (API, HTTP, proxies, authentication) • NuGet.Config Processing (including hierarchical and extensible features) • 80+ interfaces
  • 15. Classes fulfilling multiple interfaces Project systems are also file systems • Add/remove files • Enforces VS project system and source control integration /packages folder is also a package repository • GetPackages() • AddPackage() • RemovePackage() Extension methods on interfaces to simulate multiple inheritance • 17 “extensions” classes that act as base classes 33 “utility” classes to contain business logic
  • 16. Extreme loose coupling Magic values trigger special handling several layers deep • FindPackage(id, version: null); Granular interfaces led to unmanageable parameter counts • ProjectSystemExtensions.DeleteFiles FxCop suppressions Events during operations allowed decoupled reactions • InstallWalker needs to report progress to the VS UI
  • 18. No change was easy • 18 classes touched adding HTTP headers for downloads • Dozens of classes affected to add a new field to nuspec • Mocks require more work than the actual implementation • Extension methods are not compatible with mocking •We became afraid to touch the dependency resolver
  • 19. Big changes needed Replacing API v2 with API v3
  • 20. SQL Azure database Azure Blob Storage Gallery / API v2 Azure web role (3 instances) EntityFramework code-first WCF Data Services and ASP.NET MVC and Razor OData Search and feed requests Content Delivery Network (CDN) Package downloads
  • 21. Azure Blob Storage Search Service Azure worker role (3+ instances) Lucene.NET Full index loaded into memory Content Delivery Network (CDN) Metrics Service Azure website (3+ instances) SQL Azure database Search queries Package metadata requests Package downloads
  • 22. JSON-LD http://json-ld.org/ { "@context": "http://json-ld.org/contexts/person.jsonld", "@id": "http://dbpedia.org/resource/John_Lennon", "name": "John Lennon", "born": "1940-10-09", "spouse": "http://dbpedia.org/resource/Cynthia_Lennon" }
  • 23. Creating the v3 client For the new UI
  • 24. API v2 support The UI must support both v2 and v3 clients No clean surface area to re-implement • UI  install walker  API v2  install walker  API v2 • IQueryable<IPackage> exposed throughout code
  • 26. Infinite surface area Finite scenarios
  • 27. Scenarios and clients 1. Search 2. Install specific version 3. Install latest version 4. Install with dependencies 5. Install from cache 6. Install into another project 7. Check for updates 8. Update and update all 9. Restore 1. Package manager UI 2. PowerShell console 3. nuget.exe
  • 29. API v3 search (feed) Search Service Azure worker role (3+ instances) Lucene.NET Full Index Loaded into Memory Gallery / API v2 Azure web role (3+ instances) Content Delivery Network (CDN) API v3 Package Metadata Package Downloads Metrics Service Azure website (3+ instances) API v2 OData SQL Azure database Azure Blob Storage
  • 30. WCF Data Services to the rescue!? NuGet Core WCF Data Services API v2 Server OData XML WCF Data Services Entity Framework API v3 Services JSON-LD Convert JSON-LD to XML
  • 32. Introducing NuGet.Client Handle the client/server scenarios Support API v2 and API v3 Scenario-focused object model Prevent new dependencies on NuGet.Core
  • 33. Wrapping NuGet.Core Package Manager UI NuGet.Core NuGet.Client
  • 34. Dealing with deep API v2 assumptions • Implemented v2 interfaces in v3 classes • Threw NotImplementedException on all members • Ran a scenario, identified code paths required • Identified more concrete API v3 requirements • Discovered data needed for each scenario • Influenced API v3 JSON-LD views
  • 35. Shrinking NuGet.Core Package Manager UI NuGet.Core Package Authoring Package Reading Semantic Versioning Target FX Compat Dependency Resolver Local Package Sources NuGet Config Processing Project and NuGet.Core NuGet.Client NuGet.Client File Systems
  • 36. Compromises API v3 isn’t completely “clean” yet • It exposes the API v2 interfaces Chatty • API v3 uses more HTTP requests than a pure v3 server/client would • API v2 interop performs more OData requests than we used to Out of scope • PowerShell console • nuget.exe
  • 37. New guiding principles Our new rules
  • 38. Guiding principle #1 Technology is not a substitute for understanding our scenarios.
  • 39. Guiding principle #2 Don’t expose IQueryable on public API. * this applies to our RESTful services too
  • 40. Guiding principle #3 Every client/server scenario needs an explicit endpoint.
  • 41. Guiding principle #4 Shipping is more valuable than code purity.
  • 42. Guiding principle #5 Don’t implement interfaces just because the members match.
  • 43. Guiding principle #6 Side-effecting event handlers hurt in unpredictable ways.
  • 44. Guiding principle #7 Avoid business logic in extension methods. They can’t be mocked.
  • 45. Guiding principle #8 If adding new business logic is hard, refactor right away.
  • 46. Thanks Come get NuGet stickers @jeffhandley | jeffhandley.com | [email protected] | blog.nuget.org

Editor's Notes

  • #4: Demo the new UI Consolidation of Online, Installed, and Updates workflows Search respects target framework Version selection (for both installing and updating) Preview Installation Options Multiple windows Solution-Level management of versions installed
  • #23: We thought JSON would save us!
  • #26: Searching for the contract