SlideShare a Scribd company logo
SOLID programming with 
portable class libraries 
Vagif Abilov
About myself 
• Mail: vagif.abilov@gmail.com 
• Twitter: @ooobject 
• GitHub: object 
• BitBucket: object 
• Blog: http://bloggingabout.net/blogs/vagif/default.aspx 
• Some articles: http://www.codeproject.com 
• Some open source projects: 
– Simple.Data OData adapter 
– Simple.OData.Client 
– MongOData 
– PCL Conformance Analyzer
Poll: do you care about PCL? 
• Are you familiar with the concept of PCL? 
• Have you used portable class libraries? 
• Have you built your own portable class libraries? 
• Do you maintain source code for applications that need 
to be deployed on multiple platforms?
By the way, what is «portability»? 
According to Wikipedia: 
Portability in high-level computer programming is the 
usability of the same software in different environments. 
Strategies for portability 
• Transferring installed program files to another computer of basically 
the same architecture. 
• Reinstalling a program from distribution files on another computer of 
basically the same architecture. 
• Building executable programs for different platforms from source 
code; this is what is usually understood by "porting".

Recommended for you

EJB 3.2 - Java EE 7 - Java One Hyderabad 2012
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012EJB 3.2 - Java EE 7 - Java One Hyderabad 2012
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012

This document summarizes the evolution and features of Enterprise JavaBeans (EJB). It discusses how EJB has transitioned from older complex versions to newer simplified versions, starting with EJB 3.0 which reduced complexity and introduced a simpler programming model. The document then summarizes features introduced in EJB 3.1, including optional local interfaces, simplified packaging, portable JNDI names, support for singletons, asynchronous session bean invocations, and calendar-based timers. It provides examples of code for many of these new features.

javaee6javaee7javaee
WebLogic and GraalVM
WebLogic and GraalVMWebLogic and GraalVM
WebLogic and GraalVM

A talk about the innovation of WebLogic Server, held at the Oracle Groundbreakers Tour APAC 2020 https://oracle-groundbreakers-apac-virtual-tour-2020.heysummit.com/speakers/michel-schildmeijer/

oracle weblogic servergraalvmkubernetes
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)

This BoF is focused on one of the development models "In-System Programming", that can be used in combination with cloud platforms. It leverages also content-centric architectural style by using centralised repository, dynamic languages and multi-container runtime. The main goal is achieving the shortest development turn-around time ever.

dirigible cloud webide ide eclipse
Portabilitity definition (cont’d) 
Achieving portability between different processors, 
according to Wikipedia: 
• Non-web programs, installed upon a computer in the 
normal manner, can have more control, and yet achieve 
system portability by linking to the Java package. 
• Software can be recompiled and linked from source 
code for different operating systems and processors if 
written in a programming language supporting 
compilation for the platforms.
Innovative portability strategies 
• Xamarin products: compiling to native apps 
– Binding Objective-C libraries (iOS) 
– Binding Java libraries (Android) 
• Portable class libraries: managed assemblies that work 
on more than one .NET Framework platform 
– .NET 4.0, 4.0.3, 4.5 
– Silverlight 4, 5 
– Windows Phone 7, 7.5, 8 
– .NET for Windows Store applications 
– Xbox 360
Recompilation vs. binary reuse 
Does it really matter if we package code in 
reusable assemblies? Can we compile our 
code for a new target platform when we 
actually need it?
PCL advantages 
• If the code is not bound to a specific platform, then 
packaging it in a portable class library will guard it from 
unintended platform dependencies by enforcing 
portability constraints at early development stage 
• Packaging code as PCL may require introduction of 
higher level abstractions, extraction of interfaces, 
inversion of dependencies and provide guidance to 
follow SOLID principles

Recommended for you

Net framework
Net frameworkNet framework
Net framework

The document provides an overview of the Microsoft .NET Framework. It discusses how .NET aims to unite isolated web applications and make information available anytime through the use of web services, XML support, and rich development tools. The .NET Framework includes a Common Language Runtime that manages running code and supports multiple programming languages. It also includes various framework services like ASP.NET, ADO.NET, and Windows forms. The Common Language Specification allows different .NET languages to interoperate. Visual Studio .NET is the primary development tool for building .NET applications.

Take a Groovy REST
Take a Groovy RESTTake a Groovy REST
Take a Groovy REST

Guillaume Laforge, Product Ninja & Advocate at Restlet and Chair of the Apache Groovy PMC, presented about how to use Groovy for developing and consuming REST Web APIs at the JavaOne 2015 conference

restjavaonegroovy
Spring
SpringSpring
Spring

This document provides an overview of the Spring framework, including: - A brief history of Spring's development from 2002 to present. - An overview of Spring's key features like lightweight containers, declarative transactions, and dependency injection. - An explanation of Spring's layered architecture including presentation, service, and persistence layers. - A discussion of why Spring was created to simplify enterprise application development and reduce complexity. - An outline of Spring's various modules that can be selectively used in applications.

spring ppt
Platform support in PCL
Authoring portable class libraries
Case study 
From 
Simple.Data OData adapter 
to 
Simple.OData.Client PCL
What is Simple.Data 
• A lightweight, dynamic data access component for 
.NET 
• Written and maintained by Mark Rendle 
• Adapters for SQL Server, Oracle, Sqlite, MongoDB, 
OData, Oracle, PostgreSql, Informix 
• An alternative to ORM libraries, such as Entity 
Framework and NHibernate

Recommended for you

Ekon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOAEkon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOA

SOLID principles should better be applied when designing business objects, as soon as maintainability and modularity are needed. They bring uncoupling, abstraction and clean design to Object Oriented Programming. Microservices could be seen as SOLID principles applied to the Service Oriented Architecture. In respect to a classical monolith server, thanks to uncoupling and better granularity, you may enhance deployment, ease cooperation between dev teams, introduce Domain Driven Design and/or Event Driven Design, scale horizontally and still incorporate existing code and services. After a quick and practical review of SOLID principles, we will see how they may apply to SOA, and how Microservices could be defined using the Open Source mORMot framework interface-based services, on Windows or Linux.

microservicessoasolid
What's New and Next in OpenNTF Domino API (ICON UK 2014)
What's New and Next in OpenNTF Domino API (ICON UK 2014)What's New and Next in OpenNTF Domino API (ICON UK 2014)
What's New and Next in OpenNTF Domino API (ICON UK 2014)

- The document summarizes the presentation "What's New And Next in OpenNTF Domino API" given by Paul Withers. - It describes recent enhancements to the OpenNTF Domino API including improvements to logging, database methods, document serialization, and email functionality. - Future plans include expanding the XOTS task framework, graph database support, classes to represent all design elements, and potential integration with administrative functions.

openntf domino apixpagesdomino
2.3 (Architecture) Moving to Managed Code
2.3   (Architecture) Moving to Managed Code2.3   (Architecture) Moving to Managed Code
2.3 (Architecture) Moving to Managed Code

This document discusses moving COBOL applications to managed code environments like .NET and JVM. It defines managed code and contrasts it with native or unmanaged code. It highlights benefits of managed code like garbage collection, frameworks, and easier debugging. It provides examples of using managed code features in COBOL like exception handling. It also discusses database access, web and Java application server deployment, and modernizing architectures when moving to managed code. The document aims to help COBOL developers understand options and considerations for moving applications to managed platforms.

Simple.Data code example 
var db = Database.Open(); 
var titles = db.Albums 
.All() 
.Select(db.Albums.Title) 
.Where(db.Albums.GenreId == 1 && 
db.Albums.AlbumId > 400);
Simple.Data OData adapter 
• An alternative to WCF DataServices client 
• Better fits RESTful nature of OData protocol than SOAP 
alike client code generation triggered with «Add Service 
Reference»
Simple.Data.OData code example 
var db = Database.Opener.Open( 
"http://packages.nuget.org/v1/FeedService.svc/"); 
var package1 = db.Packages 
.FindByTitle("Simple.Data.OData"); 
var package2 = db.Packages 
.Find(db.Packages.Title == "Simple.OData.Client"); 
Generate HTTP GET request URLs: 
Packages?$filter=Title+eq+%27Simple.Data.OData%27 
Packages?$filter=Title+eq+%27Simple.OData.Client%27
Adapter 
• Structural design pattern 
• Converts the interface of a class into another interface 
clients expect 
Common API 
Adapter 
External service

Recommended for you

ASP.NET 01 - Introduction
ASP.NET 01 - IntroductionASP.NET 01 - Introduction
ASP.NET 01 - Introduction

This document provides an overview of ASP.NET 2.0 and the .NET framework. It discusses how ASP.NET is used to dynamically generate web content using programming logic. Key points include: - ASP.NET is Microsoft's technology for building dynamic web applications and is part of the .NET framework. - ASP.NET applications use web forms, which combine declarative markup with server-side programming code. - The .NET framework provides a common language runtime (CLR) and base class libraries (BCL) that allow multiple languages to run on the .NET platform.

teachingwebaspnet
.Net programming with C#
.Net programming with C#.Net programming with C#
.Net programming with C#

This document provides an overview of the .NET framework and common type system. It discusses key concepts like value types, reference types, inheritance, polymorphism, interfaces, boxing and unboxing. It also covers working with types in .NET like type operators, conversions, casting and managing external types. The document is divided into multiple modules that cover topics such as the .NET framework architecture, common language runtime, deployment, and common type system fundamentals.

programming.netframework
Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7

This document discusses building a modern Java web application called Miles2Run using Java EE 7. It describes the initial requirements of allowing users to store running activities and authenticate using Twitter. The technology stack used includes Java EE 7, AngularJS, MySQL, and deployment on WildFly running on OpenShift. Challenges in meeting all requirements and technologies used to overcome them like Redis, MongoDB and C3.js for graphs are also summarized.

javaopenshiftcloud
Simple.Data OData version <= 0.5 
Simple.Data API 
Simple.Data OData Adapter 
OData protocol
ODataPad
Making the adapter portable 
• An adapter can target new platforms as long as it 
provides a bridge between interfaces (and interfaces 
don’t refer to types bound to specific platforms) 
• OData protocol is platform agnostic 
• Most of OData adapter code deals with either parsing 
XML documents returned by an OData service or 
formatting CLR objects as XML documents to send to 
OData service 
• Simple.Data API uses types defined in Simple.Data 
library 
• Simple.Data supports Mono (hope of portability with 
other platforms)
Targeting Windows Store apps

Recommended for you

Cross-platform Mobile Development using Portable Class Libraries
Cross-platform Mobile Development using Portable Class LibrariesCross-platform Mobile Development using Portable Class Libraries
Cross-platform Mobile Development using Portable Class Libraries

An introduction to developing iOS, Android and Windows Phone applications using Xamarin tools and .NET portable class libraries.

portablepclios
F# in Action: Playing Functional Conway's Game of Life
F# in Action: Playing Functional Conway's Game of LifeF# in Action: Playing Functional Conway's Game of Life
F# in Action: Playing Functional Conway's Game of Life

F# in action: playing functional Conway's game of life John Conway's game of life has become a playground for programmers using different languages and platforms. It inspired many coding dojos and code retreats because it touches various aspects of development from component design to performance testing. In this session we are going to take functional approach and play different variations of Conway's game of life using F#. The session starts with presentation of a traditional game implementation in C#, so we can later compare it with F# versions. Switching to F#, we will first write an implementation for a standard two-dimensional board, and then extend it to support asynchronous workflows, parallel tasks and even boards of arbitrary dimensions. Each implementation will be complemented with a set of tests using FsUnit framework, and graphical presentation of results will use Microsoft Chart Controls.

conwayf#functional programming
А нам-то зачем функциональное программирование?
А нам-то зачем функциональное программирование?А нам-то зачем функциональное программирование?
А нам-то зачем функциональное программирование?

The document discusses functional programming and provides examples of functional code written in F# for Conway's Game of Life, including defining neighbors, determining if a cell is alive, surviving cells, reproducing cells, and calculating the next generation. Functions are defined recursively and patterns are matched. Parallel processing is demonstrated by filtering lists in parallel.

functional languages
System.Data namespace 
• Microsoft.SqlServer.Server 
• System.Configuration 
• System.Data 
• System.Data.Common 
• System.Data.Odbc 
• System.Data.OleDb 
• System.Data.Sql 
• System.Data.SqlClient 
• System.Data.SqlTypes 
• System.Xml
PCL Conformance Analyzer 
Demo
Simple.Data.OData version >= 0.6 
Simple.Data API 
Simple.Data OData Adapter 
Simple.OData.Client PCL 
OData protocol
Simple.OData.Client 
• Version 0.13 
– .NET 4.0, .NET 4.0.3, 4.5 
– Windows Store 
– Silverlight 5 
– Windows Phone 8 
• Version 0.17 
– Xamarin.Android 
– Xamarin.iOS

Recommended for you

Staying Close to Experts with Executable Specifications
Staying Close to Experts with Executable SpecificationsStaying Close to Experts with Executable Specifications
Staying Close to Experts with Executable Specifications

The document discusses using executable specifications to capture expert knowledge for the NRK media player project. Specifications were written using Gherkin and the SpecFlow framework to describe requirements. This allowed developers to work closely with domain experts and validate requirements through automated tests. Lessons learned include starting with acceptance criteria before end-to-end testing and using specifications as a communication tool between technical teams.

bddspecflownrk
iSeries Modernization: RPG/400 to Java Migration
iSeries Modernization: RPG/400 to Java MigrationiSeries Modernization: RPG/400 to Java Migration
iSeries Modernization: RPG/400 to Java Migration

eCube provides modernization, integration, replatforming and web-facing solutions that will extend the ROI of your RPG application. Learn more about eCube's transformation process for legacy RPG applications. http://ecubesystems.com/iseries.html

iseriesjava.net transformation
Unificacion Alemana
Unificacion AlemanaUnificacion Alemana
Unificacion Alemana

La conferencia de Potsdam en 1945 dividió Alemania en cuatro zonas administradas por los aliados, dando inicio a la Guerra Fría y la división de Alemania en las zonas occidental y oriental. Esta división culminó con la construcción del Muro de Berlín en 1961, pero finalmente cayó en 1989 abriendo el camino para la reunificación alemana el 3 de octubre de 1990.

murofriaguerra
But what about SOLID principles? 
Example 
Adding support for authentication
User request: support authentication 
• First implementation: accept user credentials (user + 
password), create authentication object using one of 
supported schemes (Basic, Windows etc.) 
• Worked like a charm, easy to use in client code 
var odataFeed = new ODataFeed( 
"http://www.myservice.com/api", 
"Vagif", 
"Password123"); 
• At that time Simple.Data OData adapter included non-portable 
version of Simple.OData.Client
ODataFeed 
public class ODataFeed 
{ 
public string Url { get; set; } 
public string User { get; set; } 
public string Password { get; set; } 
public string Domain { get; set; } 
public bool IntegratedSecurity { get; set; } 
}
Creating Web request 
var request = (HttpWebRequest)WebRequest.Create(uri); 
if (this.Credentials.IntegratedSecurity) 
{ 
request.Credentials = CredentialCache.DefaultNetworkCredentials; 
} 
else if (!string.IsNullOrEmpty(this.Credentials.User)) 
{ 
request.Credentials = new NetworkCredential( 
this.Credentials.User, 
this.Credentials.Password, 
this.Credentials.Domain); 
}

Recommended for you

MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model

Presentation for Dutch Microsoft TechDays 2015: With ASP.NET 5 comes MVC 6 with a programming model that unifies Web Pages, MVC and Web API. Each of these has been rebuilt to reflect Microsoft's vision of lean and composable web applications. In this session you will see the changes that have been made to the programming model. We will cover topics such as the new POCO controllers, View Components, dependency injection and much more. Plus, you are going to see the significant changes to the ASP.NET runtime on which MVC 6 is built.

microsoftmvc coretechdays 2015
.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp

Slides from the .NET Cloud-Native Bootcamp, hosted by Pivotal, Microsoft, and Magenic in New York and New Jersey on April 9th & 11th, 2019.

softwaresoftware development.net
Service fabric and azure service fabric mesh
Service fabric and azure service fabric meshService fabric and azure service fabric mesh
Service fabric and azure service fabric mesh

Service Fabric is an open-source distributed systems platform from Microsoft for packaging, deploying and managing distributed applications and services at scale. Azure Service Fabric Mesh is a new fully-managed platform that allows developing and running microservices applications without having to manage infrastructure. Key features of Service Fabric Mesh include serverless infrastructure, lifecycle management, intelligent traffic routing, and health monitoring. It allows building applications using any programming language or framework that can run in containers.

service fabricazuretallinn
Merging with Portable branch 
Project doesn’t compile! 
• System.Net.CredentialCache: .NET 4.x only 
• System.Net.NetworkCredential: most of platforms
What went wrong? 
• Simple.Data OData adapter took responsibility to create 
user credentials based on sensitive user information 
• Leaving aside security aspects, the adapter violated 
single responsibility principle 
• The adapter restricted supported authentication metods 
to those provided by credential creation code 
• The adapter is not open to extending it with new 
authentication methods, so it violated open/closed 
principle too 
• Use of interface segregation principle would avoid this 
mistake 
• PCL compliance forced use of interfaces
Revised implementation 
In platform-spefic client code 
var odataFeed = new ODataFeed( 
"http://www.myservice.com/api", 
credentials); 
In Simple.OData.Client PCL 
var request = (HttpWebRequest)WebRequest.Create(uri); 
request.Credentials = this.Credentials;
Revised implementation 
• Credentials is an instance of a class that implements 
System.Net.ICredentials interface 
• Neither Simple.Data OData adapter (.NET 4.x) nor 
Simple.OData.Client refer to a specific authentication 
scheme 
• All present and future authentication schemes are 
supported as long as they conform ICredentials

Recommended for you

Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...

Office 365 Saturday Event: https://www.meetup.com/O365-Saturday/events/238372859/ Other speakers: https://www.meetup.com/O365-Saturday/pages/23487743/2017_Speaker_Presentations/

sharepoint frameworkspospfx
Asp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework CoreAsp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework Core

This document provides an overview of ASP.NET Core, including: 1. ASP.NET Core is a cross-platform framework for building modern cloud-based web applications using .NET that can run on Windows, Linux, and Mac OS. 2. It is designed to be modular and include only necessary packages, making it faster and lighter weight than previous ASP.NET frameworks. It also supports dependency injection and inversion of control out of the box. 3. The project structure for an ASP.NET Core application includes folders for wwwroot (for static files), Properties (for settings), and Dependencies (for NuGet and client-side packages). Configuration is done through the Program.cs and Startup

dotnet coreasp.net coreasp.net mvc core
ASP.NET vNext
ASP.NET vNextASP.NET vNext
ASP.NET vNext

Presentation for Stichting DotNed in 2015: Microsoft neemt ASP.NET op de schop. Het web applicatie framework uit .NET 1.0 wordt grotendeels herschreven om te voldoen aan de eisen die men tegenwoordig stelt aan het realiseren van een moderne web applicatie. Deze sessie kijken we naar de nieuwe opzet van ASP.NET. We zien hoe Microsoft daarmee een cloud geoptimaliseerd, cross-platform framework creeert, dat zij zelf sneller kunnen laten evolueren door kortere release cycles. Dit alles betekent wel dat ASP.NET anders is geworden. In deze sessie leer je daarom ook wat er is veranderd, hoe je aan de slag gaat en waarom ASP.NET vNext een revolutionaire stap is in Microsoft's framework.

open sourcemicrosoftasp.net
Observations 
• Some SOLID principles require coding discipline and 
leave a room for interpretation, IMHO especially SRP 
and OCP (John Skeet on OCP: «While I've obviously considered the 
possibility that I'm the only one who finds it confusing, I've heard enough variation in 
the explanations of it to suggest that I'm really not the only one») 
• PCL conformance requirement doesn’t release you 
from the responsibility to make the design decision, but 
it can guard you from making obvious mistakes and 
sometimes even guide you in a right direction 
• PCLs make you more carefully plan service 
instantiation and use of non-functional utilities (logging, 
instrumentation etc.)
PCLs and concrete classes 
• Portable class libraries do not push the work of 
implementing platform-specific services to client 
applications 
• PCLs can be packaged as a single portable deployment 
unit 
– Autofac 
– Json.NET 
– Simple.OData.Client 
• PCLs can also be compound, consisting of core 
portable and platform-specific parts 
– MetroLog 
– Splat
MetroLog architecture
MetroLog NuGet specification 
<files> 
<file src="MetroLog.dll" target="libportable-net45+ 
wp8+win8MetroLog.dll" /> 
<file src="MetroLog.dll" target="libnet45MetroLog.dll" /> 
<file src="MetroLog.NetFx.dll" target="libnet45MetroLog.NetFx.dll" /> 
<file src="MetroLog.dll" target="libnetcore45MetroLog.dll" /> 
<file src="MetroLog.NetCore.dll" 
target="libnetcore45MetroLog.NetCore.dll" /> 
</files>

Recommended for you

{code} and containers
{code} and containers{code} and containers
{code} and containers

An introduction to {code} by Dell EMC, our mission on containers, and our core project REX-Ray. This will give the audience an understanding of why REX-Ray is important and where you can go to learn more.

rexraydockerdell emc
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles

This document outlines an agenda for a .NET cloud-native bootcamp. The bootcamp will introduce practices, platforms and tools for building modern .NET applications, including microservices, Cloud Foundry, and cloud-native .NET technologies and patterns. The agenda includes sessions on microservices, Cloud Foundry, hands-on exercises, and a wrap up. Break times are scheduled between sessions.

cloud foundrypivotal softwarepivotal cloud foundry
Current & Future Use-Cases of OpenDaylight
Current & Future Use-Cases of OpenDaylightCurrent & Future Use-Cases of OpenDaylight
Current & Future Use-Cases of OpenDaylight

OpenDaylight Overview and Architecture • OpenDaylight Use Cases (Partial List) I. Network Abstraction II. ONAP III. Network Virtualization IV. AI/ML with OpenDaylight V. ODL in OSS • OpenDaylight: Getting Involved

sdnnfvlinux foundation
PCLs consuming PCLs 
• A PCL client can also be a portable library 
• Client target platforms must be a subset of the 
referenced PCL’s target platforms 
• Functionality that requires platform-specific services is 
usually referred using interfaces and abstract classes 
• There is a trick to use concrete platform-specific 
classes in client PCLs by placing in the referenced PCL 
a dummy class with the same API surface and 
assembly identity as the platform-specific class
PCL profiles and portable subsets 
• Profile is a set of supported platforms 
• Portable subset is a family of profiles that expose 
certain version of .NET FX API surface area 
– Profile 78: Portable Subset: 
• .NET 4.5 
• Windows Phone 8 
• Windows Store 
– Profile 95: Portable Subset (Legacy): 
• .NET 4.0.3 and higher 
• Silverlight 4 and higher 
• Windows Phone 7 and higher 
• Windows Store
PCLs for Android and iOS 
Demo: Xamarin .NET Mobility Scanner 
Example: Reflection API portability
Polyglot programming with PCLs 
• Use right language to solve specific problems 
• C# provides the best ‘one size fits all’ choice 
• F# is very efficient for immutable data transformations, 
financial computations, machine learning 
• F# code can be packaged in a PCL and shared among 
different platforms (inluding Android and iOS!) 
– No official support to target Windows Phone 8 using F# PCL, but there 
is a workaround 
– Both PCL and F# support in Xamarin are work in progress (with 
changes being made literally while I am speaking now) 
• Core logic can be written in C# and F# and packaged 
as PCL, and UI is added using platform-specific tools

Recommended for you

Introduction to ASP.NET 5
Introduction to ASP.NET 5Introduction to ASP.NET 5
Introduction to ASP.NET 5

- ASP.NET 5 is the next generation of Microsoft's web framework that aims to address limitations of the current ASP.NET stack such as limited hosting possibilities and dependency on IIS. - It features a modular architecture based on OWIN and Katana that decouples the application from the server and allows hosting on non-IIS platforms like Linux. - Key improvements include cross-platform support, a more developer-friendly experience with features like no-compile debugging, and an emphasis on performance and light weight deployment through tools like the K command line.

asp.netowinkatana
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x

The Cordova framework Recurrent app architecture Cordova CLI Debugging Cordova applications My development environment This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2015. http://www.ivanomalavolta.com

phonegapmobile appsapache cordova
Unboxing ASP.NET Core
Unboxing ASP.NET CoreUnboxing ASP.NET Core
Unboxing ASP.NET Core

Dive into the new open source, modular and cross platform web framework. Introductory session that covers architecture, CLI tooling, basic CLI commands and exploring .csproj and Startup middleware and service.

open sourcemicrosoftcross platform
PCLs for the future 
• Profiles for v.4.0 API surface are being deprecated 
• Visual Studio 2013 can open PCLs that target legacy 
platforms, but it will upgrade Silverlight to target version 
5 and Windows Phone to target version 8 
• Xamarin PCLs targets both v.4.0 and v.4.5 API surfaces 
• If a library target wide range of platforms (both 4.0 and 
4.5), its NuGet package should include separate binaries 
for each surface 
• Consider only targeting v.4.5 API surface for new 
projects unless you need to support legacy platforms
Using PCLs in UI 
• Use of portable class libraries can result in significant 
code reuse in cross-platform application development 
• Most popular approach to cross-platform UI with PCLs 
is to use MVVM pattern and package core services, 
models and view models in a portable library 
• Most popular MVVM frameworks that have PCLs are 
MvvmLights and MvvmCross 
• MvvmCross supports targeting Xamarin.iOS and 
Xamarin.Android (and provides phenomenal support at 
StackOverflow by @slodge)
Example: Lions Roar 
• Developed by Sequence Agency 
• UI is built using MvvmCross 
• View models PCL (2463 LOC) 
• Entities PCL (691 LOC) 
• Supported plalforms 
– Windows Store (1166 LOC) 
– Windows Phone 8 (668) 
– Android Phone/Tablet (1172) 
– iPhone/iPad (2000 LOC)
Using PCL in ODataPad UI 
• ODataPad views show images 
• Original view model design included core portable base 
view model (without image data) and platform-specific 
view models (with image data) 
• Small picture size makes possible storing images in 
base64 format and reuse a single view model in all 
platforms 
• Rendering images requires platform-specific value 
converters 
• A PCL with a design-time view model serves design 
data to all Visual Studio designers (Blend)

Recommended for you

ITB2017 - Keynote
ITB2017 - KeynoteITB2017 - Keynote
ITB2017 - Keynote

This document provides an overview of the Into the Box (ITB) conference. It includes information about thanking sponsors and speakers, an ITB mobile app, winning an ITB drone, a ColdFusion Alive podcast, happy box activities, the Ortus team members, ColdFusion tooling and modernization, legacy issues, finding developers, education opportunities, and the future of ColdBox, ContentBox, Relax, Elixir, CommandBox, Docker, and Ortus projects.

coldfusionmicroservicesortus
OpenStack Summit
OpenStack SummitOpenStack Summit
OpenStack Summit

The document outlines the agenda for the OpenStack Summit in November 2013, including presentations on Docker and its ecosystem, how Docker can be used with OpenStack and Rackspace, and a demonstration of cross-cloud application deployment using Docker. Docker is presented as a solution to the "matrix from hell" of running applications across different environments by providing lightweight, portable containers that can run anywhere regardless of the operating system. The summit aims to educate attendees on Docker and showcase its integration with OpenStack for simplified and efficient application deployment and management across multiple clouds.

Dot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement onlineDot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement online

The .NET Framework is a software framework, developed by Microsoft that was primarily intended to run on Windows operating system. Microsoft started developing it since late 1990’s and its first beta version was released in the end of 2000, however its first commercial version was released in the year of 2002. Wide genres of applications can be developed using .NET framework and it is hugely popular in the IT market currently. P2Cinfotech is one of the leading, Online IT Training facilities and Job Consultant, spread all over the world. We have successfully conducted online classes on various Software Technologies that are currently in Demand. To name a few, we provide quality online training for QA, QTP, Manual Testing, HP LoadRunner, BA, Java Technologies. Unique Features of P2Cinfotech: 1. All online software Training Batches will Be handled by Real time working Professionals only. 2. Live online training like Real time face to face, Instructor ? student interaction. 3. Good online training virtual class room environment. 4. Special Exercises and Assignments to make you self-confident on your course subject. 5. Interactive Sessions to update students with latest Developments on the particular course. 6. Flexible Batch Timings and proper timetable. 7. Affordable, decent and Flexible fee structure. 8. Extended Technical assistance even after completion of the course. 9. 100% Job Assistance and Guidance. Courses What we cover: Quality Assurance Business Analsis QTp JAVA Apps Devlepoment Training Register for Free DEMO: www.p2cinfotech.com p2cinfotech@gmail.com +1-732-546-3607 (USA)

online training in asp.netdotnet training onlinevb.net training : asp.net training
Conclusion 
• Portable class libraries are not only for binary reuse 
• Packaging code as PCLs helps making code cleaner: 
– Extract interfaces 
– Unify platform-specific services 
– Inject service dependencies 
– Use portable data structures 
• Consider PCLs when choosing third party libraries 
– Ready for other platforms 
– Indication of a proper design 
– May only have dependencies to other portable libraries 
• Consider make your next library portable even if you 
only target a single platform!
Resources 
• Daniel Plaisted «How to Make Portable Class Libraries 
Work for You» 
• Scott Hanselman «Cross-Platform Portable Class 
Libraries with .NET are Happening» 
Open source projects at GitHub: 
• AutoFac 
• MetroLog 
• Splat 
• MvvmCross 
• Simple.OData.Client
Thank you! 
• Mail: vagif.abilov@gmail.com 
• Twitter: @ooobject 
• GitHub: object 
• BitBucket: object 
• Blog: http://bloggingabout.net/blogs/vagif/default.aspx 
The source code for this PCL Conformance Analyzer can 
be found at https://github.com/object/PclAnalyzer

More Related Content

What's hot

Software job options
Software job optionsSoftware job options
Software job options
Mohit Kanwar
 
Integrating Alfresco with Portals
Integrating Alfresco with PortalsIntegrating Alfresco with Portals
Integrating Alfresco with Portals
Piergiorgio Lucidi
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack Implementation
Mert Çalışkan
 
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012EJB 3.2 - Java EE 7 - Java One Hyderabad 2012
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012
Jagadish Prasath
 
WebLogic and GraalVM
WebLogic and GraalVMWebLogic and GraalVM
WebLogic and GraalVM
Michel Schildmeijer
 
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
Nedelcho Delchev
 
Net framework
Net frameworkNet framework
Net framework
Mahfuz1061
 
Take a Groovy REST
Take a Groovy RESTTake a Groovy REST
Take a Groovy REST
Restlet
 
Spring
SpringSpring
Spring
Suman Behara
 
Ekon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOAEkon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOA
Arnaud Bouchez
 
What's New and Next in OpenNTF Domino API (ICON UK 2014)
What's New and Next in OpenNTF Domino API (ICON UK 2014)What's New and Next in OpenNTF Domino API (ICON UK 2014)
What's New and Next in OpenNTF Domino API (ICON UK 2014)
Paul Withers
 
2.3 (Architecture) Moving to Managed Code
2.3   (Architecture) Moving to Managed Code2.3   (Architecture) Moving to Managed Code
2.3 (Architecture) Moving to Managed Code
Micro Focus
 
ASP.NET 01 - Introduction
ASP.NET 01 - IntroductionASP.NET 01 - Introduction
ASP.NET 01 - Introduction
Randy Connolly
 
.Net programming with C#
.Net programming with C#.Net programming with C#
.Net programming with C#
NguynSang29
 
Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7
Shekhar Gulati
 

What's hot (15)

Software job options
Software job optionsSoftware job options
Software job options
 
Integrating Alfresco with Portals
Integrating Alfresco with PortalsIntegrating Alfresco with Portals
Integrating Alfresco with Portals
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack Implementation
 
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012EJB 3.2 - Java EE 7 - Java One Hyderabad 2012
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012
 
WebLogic and GraalVM
WebLogic and GraalVMWebLogic and GraalVM
WebLogic and GraalVM
 
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
 
Net framework
Net frameworkNet framework
Net framework
 
Take a Groovy REST
Take a Groovy RESTTake a Groovy REST
Take a Groovy REST
 
Spring
SpringSpring
Spring
 
Ekon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOAEkon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOA
 
What's New and Next in OpenNTF Domino API (ICON UK 2014)
What's New and Next in OpenNTF Domino API (ICON UK 2014)What's New and Next in OpenNTF Domino API (ICON UK 2014)
What's New and Next in OpenNTF Domino API (ICON UK 2014)
 
2.3 (Architecture) Moving to Managed Code
2.3   (Architecture) Moving to Managed Code2.3   (Architecture) Moving to Managed Code
2.3 (Architecture) Moving to Managed Code
 
ASP.NET 01 - Introduction
ASP.NET 01 - IntroductionASP.NET 01 - Introduction
ASP.NET 01 - Introduction
 
.Net programming with C#
.Net programming with C#.Net programming with C#
.Net programming with C#
 
Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7
 

Viewers also liked

Cross-platform Mobile Development using Portable Class Libraries
Cross-platform Mobile Development using Portable Class LibrariesCross-platform Mobile Development using Portable Class Libraries
Cross-platform Mobile Development using Portable Class Libraries
Vagif Abilov
 
F# in Action: Playing Functional Conway's Game of Life
F# in Action: Playing Functional Conway's Game of LifeF# in Action: Playing Functional Conway's Game of Life
F# in Action: Playing Functional Conway's Game of Life
Vagif Abilov
 
А нам-то зачем функциональное программирование?
А нам-то зачем функциональное программирование?А нам-то зачем функциональное программирование?
А нам-то зачем функциональное программирование?
Vagif Abilov
 
Staying Close to Experts with Executable Specifications
Staying Close to Experts with Executable SpecificationsStaying Close to Experts with Executable Specifications
Staying Close to Experts with Executable Specifications
Vagif Abilov
 
iSeries Modernization: RPG/400 to Java Migration
iSeries Modernization: RPG/400 to Java MigrationiSeries Modernization: RPG/400 to Java Migration
iSeries Modernization: RPG/400 to Java Migration
ecubemarketing
 
Unificacion Alemana
Unificacion AlemanaUnificacion Alemana
Unificacion Alemana
Viviana Segura
 

Viewers also liked (6)

Cross-platform Mobile Development using Portable Class Libraries
Cross-platform Mobile Development using Portable Class LibrariesCross-platform Mobile Development using Portable Class Libraries
Cross-platform Mobile Development using Portable Class Libraries
 
F# in Action: Playing Functional Conway's Game of Life
F# in Action: Playing Functional Conway's Game of LifeF# in Action: Playing Functional Conway's Game of Life
F# in Action: Playing Functional Conway's Game of Life
 
А нам-то зачем функциональное программирование?
А нам-то зачем функциональное программирование?А нам-то зачем функциональное программирование?
А нам-то зачем функциональное программирование?
 
Staying Close to Experts with Executable Specifications
Staying Close to Experts with Executable SpecificationsStaying Close to Experts with Executable Specifications
Staying Close to Experts with Executable Specifications
 
iSeries Modernization: RPG/400 to Java Migration
iSeries Modernization: RPG/400 to Java MigrationiSeries Modernization: RPG/400 to Java Migration
iSeries Modernization: RPG/400 to Java Migration
 
Unificacion Alemana
Unificacion AlemanaUnificacion Alemana
Unificacion Alemana
 

Similar to SOLID Programming with Portable Class Libraries

MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model
Alex Thissen
 
.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp
VMware Tanzu
 
Service fabric and azure service fabric mesh
Service fabric and azure service fabric meshService fabric and azure service fabric mesh
Service fabric and azure service fabric mesh
Mikkel Mørk Hegnhøj
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Anupam Ranku
 
Asp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework CoreAsp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework Core
mohamed elshafey
 
ASP.NET vNext
ASP.NET vNextASP.NET vNext
ASP.NET vNext
Alex Thissen
 
{code} and containers
{code} and containers{code} and containers
{code} and containers
{code} by Dell EMC
 
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles
VMware Tanzu
 
Current & Future Use-Cases of OpenDaylight
Current & Future Use-Cases of OpenDaylightCurrent & Future Use-Cases of OpenDaylight
Current & Future Use-Cases of OpenDaylight
abhijit2511
 
Introduction to ASP.NET 5
Introduction to ASP.NET 5Introduction to ASP.NET 5
Introduction to ASP.NET 5
mbaric
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
Ivano Malavolta
 
Unboxing ASP.NET Core
Unboxing ASP.NET CoreUnboxing ASP.NET Core
Unboxing ASP.NET Core
Kevin Leung
 
ITB2017 - Keynote
ITB2017 - KeynoteITB2017 - Keynote
ITB2017 - Keynote
Ortus Solutions, Corp
 
OpenStack Summit
OpenStack SummitOpenStack Summit
OpenStack Summit
Docker, Inc.
 
Dot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement onlineDot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement online
Garuda Trainings
 
{code} and Containers - Open Source Infrastructure within Dell Technologies
{code} and Containers - Open Source Infrastructure within Dell Technologies{code} and Containers - Open Source Infrastructure within Dell Technologies
{code} and Containers - Open Source Infrastructure within Dell Technologies
The {code} Team
 
Building RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPIBuilding RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPI
Gert Drapers
 
How AD has been re-engineered to extend to the cloud
How AD has been re-engineered to extend to the cloudHow AD has been re-engineered to extend to the cloud
How AD has been re-engineered to extend to the cloud
LDAPCon
 
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform.NET Core: a new .NET Platform
.NET Core: a new .NET Platform
Alex Thissen
 
Open shift and docker - october,2014
Open shift and docker - october,2014Open shift and docker - october,2014
Open shift and docker - october,2014
Hojoong Kim
 

Similar to SOLID Programming with Portable Class Libraries (20)

MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model
 
.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp
 
Service fabric and azure service fabric mesh
Service fabric and azure service fabric meshService fabric and azure service fabric mesh
Service fabric and azure service fabric mesh
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
 
Asp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework CoreAsp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework Core
 
ASP.NET vNext
ASP.NET vNextASP.NET vNext
ASP.NET vNext
 
{code} and containers
{code} and containers{code} and containers
{code} and containers
 
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles
 
Current & Future Use-Cases of OpenDaylight
Current & Future Use-Cases of OpenDaylightCurrent & Future Use-Cases of OpenDaylight
Current & Future Use-Cases of OpenDaylight
 
Introduction to ASP.NET 5
Introduction to ASP.NET 5Introduction to ASP.NET 5
Introduction to ASP.NET 5
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
 
Unboxing ASP.NET Core
Unboxing ASP.NET CoreUnboxing ASP.NET Core
Unboxing ASP.NET Core
 
ITB2017 - Keynote
ITB2017 - KeynoteITB2017 - Keynote
ITB2017 - Keynote
 
OpenStack Summit
OpenStack SummitOpenStack Summit
OpenStack Summit
 
Dot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement onlineDot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement online
 
{code} and Containers - Open Source Infrastructure within Dell Technologies
{code} and Containers - Open Source Infrastructure within Dell Technologies{code} and Containers - Open Source Infrastructure within Dell Technologies
{code} and Containers - Open Source Infrastructure within Dell Technologies
 
Building RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPIBuilding RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPI
 
How AD has been re-engineered to extend to the cloud
How AD has been re-engineered to extend to the cloudHow AD has been re-engineered to extend to the cloud
How AD has been re-engineered to extend to the cloud
 
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform.NET Core: a new .NET Platform
.NET Core: a new .NET Platform
 
Open shift and docker - october,2014
Open shift and docker - october,2014Open shift and docker - october,2014
Open shift and docker - october,2014
 

Recently uploaded

MVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptxMVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptx
Mitchell Marsh
 
Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …
908dutch
 
Overview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptxOverview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptx
Mitchell Marsh
 
What is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for FreeWhat is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for Free
TwisterTools
 
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdfIndependence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
Livetecs LLC
 
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdfAWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
karim wahed
 
ThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and DjangoThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and Django
akshesh doshi
 
A Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdfA Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdf
kalichargn70th171
 
active-directory-auditing-solution (2).pptx
active-directory-auditing-solution (2).pptxactive-directory-auditing-solution (2).pptx
active-directory-auditing-solution (2).pptx
sudsdeep
 
Splunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptxSplunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptx
sudsdeep
 
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTIONBITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
ssuser2b426d1
 
Abortion pills in Fujairah *((+971588192166*)☎️)¥) **Effective Abortion Pills...
Abortion pills in Fujairah *((+971588192166*)☎️)¥) **Effective Abortion Pills...Abortion pills in Fujairah *((+971588192166*)☎️)¥) **Effective Abortion Pills...
Abortion pills in Fujairah *((+971588192166*)☎️)¥) **Effective Abortion Pills...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
shivamt017
 
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdfdachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
DNUG e.V.
 
Intro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AIIntro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AI
Ortus Solutions, Corp
 
How we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hoursHow we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hours
Ortus Solutions, Corp
 
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdfResponsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Trackobit
 
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
bhatinidhi2001
 
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptxWired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
SimonedeGijt
 
ENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentationENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentation
sofiafernandezon
 

Recently uploaded (20)

MVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptxMVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptx
 
Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …
 
Overview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptxOverview of ERP - Mechlin Technologies.pptx
Overview of ERP - Mechlin Technologies.pptx
 
What is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for FreeWhat is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for Free
 
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdfIndependence Day Hasn’t Always Been a U.S. Holiday.pdf
Independence Day Hasn’t Always Been a U.S. Holiday.pdf
 
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdfAWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
 
ThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and DjangoThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and Django
 
A Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdfA Comparative Analysis of Functional and Non-Functional Testing.pdf
A Comparative Analysis of Functional and Non-Functional Testing.pdf
 
active-directory-auditing-solution (2).pptx
active-directory-auditing-solution (2).pptxactive-directory-auditing-solution (2).pptx
active-directory-auditing-solution (2).pptx
 
Splunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptxSplunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptx
 
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTIONBITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
BITCOIN HEIST RANSOMEWARE ATTACK PREDICTION
 
Abortion pills in Fujairah *((+971588192166*)☎️)¥) **Effective Abortion Pills...
Abortion pills in Fujairah *((+971588192166*)☎️)¥) **Effective Abortion Pills...Abortion pills in Fujairah *((+971588192166*)☎️)¥) **Effective Abortion Pills...
Abortion pills in Fujairah *((+971588192166*)☎️)¥) **Effective Abortion Pills...
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
 
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdfdachnug51 - HCL Sametime 12 as a Software Appliance.pdf
dachnug51 - HCL Sametime 12 as a Software Appliance.pdf
 
Intro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AIIntro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AI
 
How we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hoursHow we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hours
 
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdfResponsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
Responsibilities of Fleet Managers and How TrackoBit Can Assist.pdf
 
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
 
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptxWired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
 
ENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentationENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentation
 

SOLID Programming with Portable Class Libraries

  • 1. SOLID programming with portable class libraries Vagif Abilov
  • 2. About myself • Mail: vagif.abilov@gmail.com • Twitter: @ooobject • GitHub: object • BitBucket: object • Blog: http://bloggingabout.net/blogs/vagif/default.aspx • Some articles: http://www.codeproject.com • Some open source projects: – Simple.Data OData adapter – Simple.OData.Client – MongOData – PCL Conformance Analyzer
  • 3. Poll: do you care about PCL? • Are you familiar with the concept of PCL? • Have you used portable class libraries? • Have you built your own portable class libraries? • Do you maintain source code for applications that need to be deployed on multiple platforms?
  • 4. By the way, what is «portability»? According to Wikipedia: Portability in high-level computer programming is the usability of the same software in different environments. Strategies for portability • Transferring installed program files to another computer of basically the same architecture. • Reinstalling a program from distribution files on another computer of basically the same architecture. • Building executable programs for different platforms from source code; this is what is usually understood by "porting".
  • 5. Portabilitity definition (cont’d) Achieving portability between different processors, according to Wikipedia: • Non-web programs, installed upon a computer in the normal manner, can have more control, and yet achieve system portability by linking to the Java package. • Software can be recompiled and linked from source code for different operating systems and processors if written in a programming language supporting compilation for the platforms.
  • 6. Innovative portability strategies • Xamarin products: compiling to native apps – Binding Objective-C libraries (iOS) – Binding Java libraries (Android) • Portable class libraries: managed assemblies that work on more than one .NET Framework platform – .NET 4.0, 4.0.3, 4.5 – Silverlight 4, 5 – Windows Phone 7, 7.5, 8 – .NET for Windows Store applications – Xbox 360
  • 7. Recompilation vs. binary reuse Does it really matter if we package code in reusable assemblies? Can we compile our code for a new target platform when we actually need it?
  • 8. PCL advantages • If the code is not bound to a specific platform, then packaging it in a portable class library will guard it from unintended platform dependencies by enforcing portability constraints at early development stage • Packaging code as PCL may require introduction of higher level abstractions, extraction of interfaces, inversion of dependencies and provide guidance to follow SOLID principles
  • 11. Case study From Simple.Data OData adapter to Simple.OData.Client PCL
  • 12. What is Simple.Data • A lightweight, dynamic data access component for .NET • Written and maintained by Mark Rendle • Adapters for SQL Server, Oracle, Sqlite, MongoDB, OData, Oracle, PostgreSql, Informix • An alternative to ORM libraries, such as Entity Framework and NHibernate
  • 13. Simple.Data code example var db = Database.Open(); var titles = db.Albums .All() .Select(db.Albums.Title) .Where(db.Albums.GenreId == 1 && db.Albums.AlbumId > 400);
  • 14. Simple.Data OData adapter • An alternative to WCF DataServices client • Better fits RESTful nature of OData protocol than SOAP alike client code generation triggered with «Add Service Reference»
  • 15. Simple.Data.OData code example var db = Database.Opener.Open( "http://packages.nuget.org/v1/FeedService.svc/"); var package1 = db.Packages .FindByTitle("Simple.Data.OData"); var package2 = db.Packages .Find(db.Packages.Title == "Simple.OData.Client"); Generate HTTP GET request URLs: Packages?$filter=Title+eq+%27Simple.Data.OData%27 Packages?$filter=Title+eq+%27Simple.OData.Client%27
  • 16. Adapter • Structural design pattern • Converts the interface of a class into another interface clients expect Common API Adapter External service
  • 17. Simple.Data OData version <= 0.5 Simple.Data API Simple.Data OData Adapter OData protocol
  • 19. Making the adapter portable • An adapter can target new platforms as long as it provides a bridge between interfaces (and interfaces don’t refer to types bound to specific platforms) • OData protocol is platform agnostic • Most of OData adapter code deals with either parsing XML documents returned by an OData service or formatting CLR objects as XML documents to send to OData service • Simple.Data API uses types defined in Simple.Data library • Simple.Data supports Mono (hope of portability with other platforms)
  • 21. System.Data namespace • Microsoft.SqlServer.Server • System.Configuration • System.Data • System.Data.Common • System.Data.Odbc • System.Data.OleDb • System.Data.Sql • System.Data.SqlClient • System.Data.SqlTypes • System.Xml
  • 23. Simple.Data.OData version >= 0.6 Simple.Data API Simple.Data OData Adapter Simple.OData.Client PCL OData protocol
  • 24. Simple.OData.Client • Version 0.13 – .NET 4.0, .NET 4.0.3, 4.5 – Windows Store – Silverlight 5 – Windows Phone 8 • Version 0.17 – Xamarin.Android – Xamarin.iOS
  • 25. But what about SOLID principles? Example Adding support for authentication
  • 26. User request: support authentication • First implementation: accept user credentials (user + password), create authentication object using one of supported schemes (Basic, Windows etc.) • Worked like a charm, easy to use in client code var odataFeed = new ODataFeed( "http://www.myservice.com/api", "Vagif", "Password123"); • At that time Simple.Data OData adapter included non-portable version of Simple.OData.Client
  • 27. ODataFeed public class ODataFeed { public string Url { get; set; } public string User { get; set; } public string Password { get; set; } public string Domain { get; set; } public bool IntegratedSecurity { get; set; } }
  • 28. Creating Web request var request = (HttpWebRequest)WebRequest.Create(uri); if (this.Credentials.IntegratedSecurity) { request.Credentials = CredentialCache.DefaultNetworkCredentials; } else if (!string.IsNullOrEmpty(this.Credentials.User)) { request.Credentials = new NetworkCredential( this.Credentials.User, this.Credentials.Password, this.Credentials.Domain); }
  • 29. Merging with Portable branch Project doesn’t compile! • System.Net.CredentialCache: .NET 4.x only • System.Net.NetworkCredential: most of platforms
  • 30. What went wrong? • Simple.Data OData adapter took responsibility to create user credentials based on sensitive user information • Leaving aside security aspects, the adapter violated single responsibility principle • The adapter restricted supported authentication metods to those provided by credential creation code • The adapter is not open to extending it with new authentication methods, so it violated open/closed principle too • Use of interface segregation principle would avoid this mistake • PCL compliance forced use of interfaces
  • 31. Revised implementation In platform-spefic client code var odataFeed = new ODataFeed( "http://www.myservice.com/api", credentials); In Simple.OData.Client PCL var request = (HttpWebRequest)WebRequest.Create(uri); request.Credentials = this.Credentials;
  • 32. Revised implementation • Credentials is an instance of a class that implements System.Net.ICredentials interface • Neither Simple.Data OData adapter (.NET 4.x) nor Simple.OData.Client refer to a specific authentication scheme • All present and future authentication schemes are supported as long as they conform ICredentials
  • 33. Observations • Some SOLID principles require coding discipline and leave a room for interpretation, IMHO especially SRP and OCP (John Skeet on OCP: «While I've obviously considered the possibility that I'm the only one who finds it confusing, I've heard enough variation in the explanations of it to suggest that I'm really not the only one») • PCL conformance requirement doesn’t release you from the responsibility to make the design decision, but it can guard you from making obvious mistakes and sometimes even guide you in a right direction • PCLs make you more carefully plan service instantiation and use of non-functional utilities (logging, instrumentation etc.)
  • 34. PCLs and concrete classes • Portable class libraries do not push the work of implementing platform-specific services to client applications • PCLs can be packaged as a single portable deployment unit – Autofac – Json.NET – Simple.OData.Client • PCLs can also be compound, consisting of core portable and platform-specific parts – MetroLog – Splat
  • 36. MetroLog NuGet specification <files> <file src="MetroLog.dll" target="libportable-net45+ wp8+win8MetroLog.dll" /> <file src="MetroLog.dll" target="libnet45MetroLog.dll" /> <file src="MetroLog.NetFx.dll" target="libnet45MetroLog.NetFx.dll" /> <file src="MetroLog.dll" target="libnetcore45MetroLog.dll" /> <file src="MetroLog.NetCore.dll" target="libnetcore45MetroLog.NetCore.dll" /> </files>
  • 37. PCLs consuming PCLs • A PCL client can also be a portable library • Client target platforms must be a subset of the referenced PCL’s target platforms • Functionality that requires platform-specific services is usually referred using interfaces and abstract classes • There is a trick to use concrete platform-specific classes in client PCLs by placing in the referenced PCL a dummy class with the same API surface and assembly identity as the platform-specific class
  • 38. PCL profiles and portable subsets • Profile is a set of supported platforms • Portable subset is a family of profiles that expose certain version of .NET FX API surface area – Profile 78: Portable Subset: • .NET 4.5 • Windows Phone 8 • Windows Store – Profile 95: Portable Subset (Legacy): • .NET 4.0.3 and higher • Silverlight 4 and higher • Windows Phone 7 and higher • Windows Store
  • 39. PCLs for Android and iOS Demo: Xamarin .NET Mobility Scanner Example: Reflection API portability
  • 40. Polyglot programming with PCLs • Use right language to solve specific problems • C# provides the best ‘one size fits all’ choice • F# is very efficient for immutable data transformations, financial computations, machine learning • F# code can be packaged in a PCL and shared among different platforms (inluding Android and iOS!) – No official support to target Windows Phone 8 using F# PCL, but there is a workaround – Both PCL and F# support in Xamarin are work in progress (with changes being made literally while I am speaking now) • Core logic can be written in C# and F# and packaged as PCL, and UI is added using platform-specific tools
  • 41. PCLs for the future • Profiles for v.4.0 API surface are being deprecated • Visual Studio 2013 can open PCLs that target legacy platforms, but it will upgrade Silverlight to target version 5 and Windows Phone to target version 8 • Xamarin PCLs targets both v.4.0 and v.4.5 API surfaces • If a library target wide range of platforms (both 4.0 and 4.5), its NuGet package should include separate binaries for each surface • Consider only targeting v.4.5 API surface for new projects unless you need to support legacy platforms
  • 42. Using PCLs in UI • Use of portable class libraries can result in significant code reuse in cross-platform application development • Most popular approach to cross-platform UI with PCLs is to use MVVM pattern and package core services, models and view models in a portable library • Most popular MVVM frameworks that have PCLs are MvvmLights and MvvmCross • MvvmCross supports targeting Xamarin.iOS and Xamarin.Android (and provides phenomenal support at StackOverflow by @slodge)
  • 43. Example: Lions Roar • Developed by Sequence Agency • UI is built using MvvmCross • View models PCL (2463 LOC) • Entities PCL (691 LOC) • Supported plalforms – Windows Store (1166 LOC) – Windows Phone 8 (668) – Android Phone/Tablet (1172) – iPhone/iPad (2000 LOC)
  • 44. Using PCL in ODataPad UI • ODataPad views show images • Original view model design included core portable base view model (without image data) and platform-specific view models (with image data) • Small picture size makes possible storing images in base64 format and reuse a single view model in all platforms • Rendering images requires platform-specific value converters • A PCL with a design-time view model serves design data to all Visual Studio designers (Blend)
  • 45. Conclusion • Portable class libraries are not only for binary reuse • Packaging code as PCLs helps making code cleaner: – Extract interfaces – Unify platform-specific services – Inject service dependencies – Use portable data structures • Consider PCLs when choosing third party libraries – Ready for other platforms – Indication of a proper design – May only have dependencies to other portable libraries • Consider make your next library portable even if you only target a single platform!
  • 46. Resources • Daniel Plaisted «How to Make Portable Class Libraries Work for You» • Scott Hanselman «Cross-Platform Portable Class Libraries with .NET are Happening» Open source projects at GitHub: • AutoFac • MetroLog • Splat • MvvmCross • Simple.OData.Client
  • 47. Thank you! • Mail: vagif.abilov@gmail.com • Twitter: @ooobject • GitHub: object • BitBucket: object • Blog: http://bloggingabout.net/blogs/vagif/default.aspx The source code for this PCL Conformance Analyzer can be found at https://github.com/object/PclAnalyzer