SlideShare una empresa de Scribd logo
1 de 11
DaveThomas
 First class .Net Language citizen
 Multi paradigm language
 Functional
 Object orientated
 Well suited for:
 Financial
 Statistical
 Testing
 Event processing
 Tool development
 General purpose components
 General server-side development
 Referential transparency / deterministic
 Immutability
 First class functions
 Higher order functions
 Recursion
 Reasoning
 Code behaves in a consistent understandable manner
 Safety
 Contents of variables are always as expected no unknown
mutation
 Reduction code
 Code can be safely reused
 Data Sharing
 Threading is easier and locks are no longer needed
 Testing
 Concise functions that are easy to test
 Code reduction
 Typically around 70%
 Increased performance
 Easy to parallelise functions
 Increased productivity
 Common to experience 50% boost
 Increasing importance of multi-core and cloud
 F# facilitates building multi-core friendly code
 Reduced maintenance costs
 Bugs and compiler issues are found earlier, typically during REPL
(Read-Eval-Print Loop is for interactive compilation and exploration)
 Easy to create Domain specific languages
 Financial services
 Credit Suisse –Valuation, Quant models
 Insurance rating
 Grange insurance – Insurance Rating Engine
 Energy trading
 Eon EnergyTrading – pluggable calculation engines
 Statistical analysis
 Xbox live (TrueSkill)
 C# already had functional features
 LINQ, Lambda expressions, predicates, closures
 Uses the same .Net libraries
 Can be consumed by other .Net languages
 Start with core components
 Algorithm development
 Data analysis
 parallel batch processing
 rapid prototyping
 Testing
Object pool -C#
Example taken from
the MSDN website
2Types
20 Lines in base class
41 lines in derived class
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Collections.Concurrent
{
/// <summary>Provides a thread-safe object pool.</summary>
/// <typeparam name="T">Specifies the type of the elements stored in the pool.</typeparam>
[DebuggerDisplay("Count={Count}")]
[DebuggerTypeProxy(typeof(IProducerConsumerCollection_DebugView<>))]
public sealed class ObjectPool<T> : ProducerConsumerCollectionBase<T>
{
private readonlyFunc<T> _generator;
/// <summary>Initializes an instance of the ObjectPool class.</summary>
/// <param name="generator">The function used to create items when no items exist in the
pool.</param>
public ObjectPool(Func<T> generator) : this(generator, new ConcurrentQueue<T>()) { }
/// <summary>Initializes an instance of the ObjectPool class.</summary>
/// <param name="generator">The function used to create items when no items exist in the
pool.</param>
/// <param name="collection">The collection used to store the elements of the pool.</param>
public ObjectPool(Func<T> generator, IProducerConsumerCollection<T> collection)
: base(collection)
{
if (generator == null) throw new ArgumentNullException("generator");
_generator = generator;
}
/// <summary>Adds the provided item into the pool.</summary>
/// <param name="item">The item to be added.</param>
public void PutObject(T item) { base.TryAdd(item); }
/// <summary>Gets an item from the pool.</summary>
/// <returns>The removed or created item.</returns>
/// <remarks>If the pool is empty, a new item will be created and returned.</remarks>
public T GetObject()
{
T value;
return base.TryTake(out value) ? value : _generator();
}
/// <summary>Clears the object pool, returning all of the data that was in the pool.</summary>
/// <returns>An array containing all of the elements in the pool.</returns>
public T[] ToArrayAndClear()
{
var items = new List<T>();
T value;
while (base.TryTake(out value)) items.Add(value);
return items.ToArray();
}
protected override boolTryAdd(T item)
{
PutObject(item);
return true;
}
protected override boolTryTake(out T item)
{
item = GetObject();
return true;
}
}
}
/// <summary>
/// Provides a base implementation for producer-consumer collections that wrap other
/// producer-consumer collections.
/// </summary>
/// <typeparam name="T">Specifies the type of elements in the collection.</typeparam>
[Serializable]
public abstract class ProducerConsumerCollectionBase<T> : IProducerConsumerCollection<T>
{
private readonlyIProducerConsumerCollection<T> _contained;
/// <summary>Initializes the ProducerConsumerCollectionBase instance.</summary>
/// <param name="contained">The collection to be wrapped by this instance.</param>
protected ProducerConsumerCollectionBase(IProducerConsumerCollection<T> contained)
{
if (contained == null) throw new ArgumentNullException("contained");
_contained = contained;
}
/// <summary>Gets the contained collection.</summary>
protected IProducerConsumerCollection<T>ContainedCollection { get { return _contained; } }
/// <summary>Attempts to add the specified value to the end of the deque.</summary>
/// <param name="item">The item to add.</param>
/// <returns>true if the item could be added; otherwise, false.</returns>
protected virtual boolTryAdd(T item) { return _contained.TryAdd(item); }
/// <summary>Attempts to remove and return an item from the collection.</summary>
/// <param name="item">
/// When this method returns, if the operation was successful, item contains the item removed. If
/// no item was available to be removed, the value is unspecified.
/// </param>
/// <returns>
/// true if an element was removed and returned from the collection; otherwise, false.
/// </returns>
protected virtual boolTryTake(out T item) { return _contained.TryTake(out item); }
/// <summary>Attempts to add the specified value to the end of the deque.</summary>
/// <param name="item">The item to add.</param>
/// <returns>true if the item could be added; otherwise, false.</returns>
boolIProducerConsumerCollection<T>.TryAdd(T item) { return TryAdd(item); }
/// <summary>Attempts to remove and return an item from the collection.</summary>
/// <param name="item">
/// When this method returns, if the operation was successful, item contains the item removed. If
/// no item was available to be removed, the value is unspecified.
/// </param>
/// <returns>
/// true if an element was removed and returned from the collection; otherwise, false.
/// </returns>
boolIProducerConsumerCollection<T>.TryTake(out T item) { return TryTake(out item); }
/// <summary>Gets the number of elements contained in the collection.</summary>
public int Count { get { return _contained.Count; } }
/// <summary>Creates an array containing the contents of the collection.</summary>
/// <returns>The array.</returns>
public T[] ToArray() { return _contained.ToArray(); }
/// <summary>Copies the contents of the collection to an array.</summary>
/// <param name="array">The array to which the data should be copied.</param>
/// <param name="index">The starting index at which data should be copied.</param>
public void CopyTo(T[] array, int index) { _contained.CopyTo(array, index); }
/// <summary>Copies the contents of the collection to an array.</summary>
/// <param name="array">The array to which the data should be copied.</param>
/// <param name="index">The starting index at which data should be copied.</param>
void ICollection.CopyTo(Array array, int index) { _contained.CopyTo(array, index); }
/// <summary>Gets an enumerator for the collection.</summary>
/// <returns>An enumerator.</returns>
public IEnumerator<T>GetEnumerator() { return _contained.GetEnumerator(); }
/// <summary>Gets an enumerator for the collection.</summary>
/// <returns>An enumerator.</returns>
IEnumeratorIEnumerable.GetEnumerator() { return GetEnumerator(); }
/// <summary>Gets whether the collection is synchronized.</summary>
boolICollection.IsSynchronized { get { return _contained.IsSynchronized; } }
/// <summary>Gets the synchronization root object for the collection.</summary>
object ICollection.SyncRoot { get { return _contained.SyncRoot; } }
Agent based object pool
25 Lines of code
1Type alias
2Types
F#
25 Lines 689 Characters
59% less Lines
66% less Characters
C#
61 Lines 2041 Characters
2.4x more Lines
2.96x more Characters
functions
modulePoc
//Agent alias for MailboxProcessor
typeAgent<'T>=MailboxProcessor<'T>
///One of three messages for our Object Pool agent
typePoolMessage<'a>=
| GetofAsyncReplyChannel<'a>
| Putof'a
| ClearofAsyncReplyChannel<List<'a>>
/// Object pool representing a reusable pool of objects
typeObjectPool<'a>(generate:unit->'a, initialPoolCount) =
letinitial=List.initinitialPoolCount (fun (x) ->generate())
letagent=Agent.Start(funinbox->
letrecloop(x) =async {
let!msg=inbox.Receive()
matchmsgwith
| Get(reply) ->
letres=matchxwith
| a::b->reply.Reply(a);b
| [] asempty->reply.Reply(generate());empty
return!loop(res)
| Put(value)->return!loop(value::x)
| Clear(reply) ->
reply.Reply(x)
return!loop(List.empty<'a>) }
loop(initial))
/// Clears the object pool, returning all of the data that was in the pool.
memberthis.ToListAndClear() =agent.PostAndAsyncReply(Clear)
/// Puts an item into the pool
memberthis.Put(item ) =agent.Post(item)
/// Gets an item from the pool or if there are none present use the generator
memberthis.Get(item) =agent.PostAndAsyncReply(Get)
 F# open source project - FractureIO
 High performance networking
 Composable pipeline library
 Agent based infrastructure
F# in the enterprise

Más contenido relacionado

La actualidad más candente

知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tips知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tipsikeyat
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in AngularYadong Xie
 
VPN Access Runbook
VPN Access RunbookVPN Access Runbook
VPN Access RunbookTaha Shakeel
 
e computer notes - Producing readable output with i sql plus
e computer notes - Producing readable output with i sql pluse computer notes - Producing readable output with i sql plus
e computer notes - Producing readable output with i sql plusecomputernotes
 
Deep Dive into React Hooks
Deep Dive into React HooksDeep Dive into React Hooks
Deep Dive into React HooksFelix Kühl
 
Durable functions
Durable functionsDurable functions
Durable functions명신 김
 
Dependency Injection with CDI in 15 minutes
Dependency Injection with CDI in 15 minutesDependency Injection with CDI in 15 minutes
Dependency Injection with CDI in 15 minutesAntonio Goncalves
 
SQLite in Adobe AIR
SQLite in Adobe AIRSQLite in Adobe AIR
SQLite in Adobe AIRPeter Elst
 
PHP Traits
PHP TraitsPHP Traits
PHP Traitsmattbuzz
 
안드로이드 세미나 2
안드로이드 세미나 2안드로이드 세미나 2
안드로이드 세미나 2Chul Ju Hong
 
Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Ray Ploski
 
Php Reusing Code And Writing Functions
Php Reusing Code And Writing FunctionsPhp Reusing Code And Writing Functions
Php Reusing Code And Writing Functionsmussawir20
 
안드로이드 세미나 2
안드로이드 세미나 2안드로이드 세미나 2
안드로이드 세미나 2ang0123dev
 
DBD::SQLite
DBD::SQLiteDBD::SQLite
DBD::SQLitecharsbar
 

La actualidad más candente (20)

Stored procedure
Stored procedureStored procedure
Stored procedure
 
知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tips知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tips
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in Angular
 
VPN Access Runbook
VPN Access RunbookVPN Access Runbook
VPN Access Runbook
 
e computer notes - Producing readable output with i sql plus
e computer notes - Producing readable output with i sql pluse computer notes - Producing readable output with i sql plus
e computer notes - Producing readable output with i sql plus
 
Deep Dive into React Hooks
Deep Dive into React HooksDeep Dive into React Hooks
Deep Dive into React Hooks
 
Week 12 code
Week 12 codeWeek 12 code
Week 12 code
 
Durable functions
Durable functionsDurable functions
Durable functions
 
Best core & advanced java classes in mumbai
Best core & advanced java classes in mumbaiBest core & advanced java classes in mumbai
Best core & advanced java classes in mumbai
 
Dependency Injection with CDI in 15 minutes
Dependency Injection with CDI in 15 minutesDependency Injection with CDI in 15 minutes
Dependency Injection with CDI in 15 minutes
 
SQLite in Adobe AIR
SQLite in Adobe AIRSQLite in Adobe AIR
SQLite in Adobe AIR
 
PHP Traits
PHP TraitsPHP Traits
PHP Traits
 
Ajax
AjaxAjax
Ajax
 
Typescript barcelona
Typescript barcelonaTypescript barcelona
Typescript barcelona
 
안드로이드 세미나 2
안드로이드 세미나 2안드로이드 세미나 2
안드로이드 세미나 2
 
Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6
 
Vue next
Vue nextVue next
Vue next
 
Php Reusing Code And Writing Functions
Php Reusing Code And Writing FunctionsPhp Reusing Code And Writing Functions
Php Reusing Code And Writing Functions
 
안드로이드 세미나 2
안드로이드 세미나 2안드로이드 세미나 2
안드로이드 세미나 2
 
DBD::SQLite
DBD::SQLiteDBD::SQLite
DBD::SQLite
 

Destacado

Module Cv (Juli 2010)
Module Cv (Juli 2010)Module Cv (Juli 2010)
Module Cv (Juli 2010)abvandepol
 
My sql in_enterprise
My sql in_enterpriseMy sql in_enterprise
My sql in_enterprise120bi
 
Object-Oriented Concepts
Object-Oriented ConceptsObject-Oriented Concepts
Object-Oriented ConceptsAbdalla Mahmoud
 
Applications of extrusion in encapsulation technology
Applications of extrusion in encapsulation technologyApplications of extrusion in encapsulation technology
Applications of extrusion in encapsulation technologySyed Aasif Mujtaba
 
Javascript foundations: Introducing OO
Javascript foundations: Introducing OOJavascript foundations: Introducing OO
Javascript foundations: Introducing OOJohn Hunter
 
Paradigm Wars: Object Oriented Vs Functional Programming in creating MarkParser
Paradigm Wars: Object Oriented Vs Functional Programming in creating MarkParserParadigm Wars: Object Oriented Vs Functional Programming in creating MarkParser
Paradigm Wars: Object Oriented Vs Functional Programming in creating MarkParserRohit Arora
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental PrinciplesIntro C# Book
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with JavaJussi Pohjolainen
 

Destacado (13)

Module Cv (Juli 2010)
Module Cv (Juli 2010)Module Cv (Juli 2010)
Module Cv (Juli 2010)
 
My sql in_enterprise
My sql in_enterpriseMy sql in_enterprise
My sql in_enterprise
 
F# Tutorial @ QCon
F# Tutorial @ QConF# Tutorial @ QCon
F# Tutorial @ QCon
 
Marc Dujardin Introduction of a user-orientated design paradigm
Marc Dujardin Introduction of a user-orientated design paradigmMarc Dujardin Introduction of a user-orientated design paradigm
Marc Dujardin Introduction of a user-orientated design paradigm
 
Object-Oriented Concepts
Object-Oriented ConceptsObject-Oriented Concepts
Object-Oriented Concepts
 
encapsulation
encapsulationencapsulation
encapsulation
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
Applications of extrusion in encapsulation technology
Applications of extrusion in encapsulation technologyApplications of extrusion in encapsulation technology
Applications of extrusion in encapsulation technology
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
Javascript foundations: Introducing OO
Javascript foundations: Introducing OOJavascript foundations: Introducing OO
Javascript foundations: Introducing OO
 
Paradigm Wars: Object Oriented Vs Functional Programming in creating MarkParser
Paradigm Wars: Object Oriented Vs Functional Programming in creating MarkParserParadigm Wars: Object Oriented Vs Functional Programming in creating MarkParser
Paradigm Wars: Object Oriented Vs Functional Programming in creating MarkParser
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 

Similar a F# in the enterprise

Framework Project
Framework  ProjectFramework  Project
Framework ProjectMauro_Sist
 
Sitecore 7: A developers quest to mastering unit testing
Sitecore 7: A developers quest to mastering unit testingSitecore 7: A developers quest to mastering unit testing
Sitecore 7: A developers quest to mastering unit testingnonlinear creations
 
Flink Batch Processing and Iterations
Flink Batch Processing and IterationsFlink Batch Processing and Iterations
Flink Batch Processing and IterationsSameer Wadkar
 
The state of hooking into Drupal - DrupalCon Dublin
The state of hooking into Drupal - DrupalCon DublinThe state of hooking into Drupal - DrupalCon Dublin
The state of hooking into Drupal - DrupalCon DublinNida Ismail Shah
 
Thymeleaf and Spring Controllers.ppt
Thymeleaf and Spring Controllers.pptThymeleaf and Spring Controllers.ppt
Thymeleaf and Spring Controllers.pptPatiento Del Mar
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingVisual Engineering
 
WPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaWPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaRainer Stropek
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgetsvelveeta_512
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF Luc Bors
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVCRichard Paul
 
First java-server-faces-tutorial-en
First java-server-faces-tutorial-enFirst java-server-faces-tutorial-en
First java-server-faces-tutorial-entechbed
 
Angular JS2 Training Session #2
Angular JS2 Training Session #2Angular JS2 Training Session #2
Angular JS2 Training Session #2Paras Mendiratta
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationAbdul Malik Ikhsan
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web APIhabib_786
 

Similar a F# in the enterprise (20)

Framework Project
Framework  ProjectFramework  Project
Framework Project
 
Sitecore 7: A developers quest to mastering unit testing
Sitecore 7: A developers quest to mastering unit testingSitecore 7: A developers quest to mastering unit testing
Sitecore 7: A developers quest to mastering unit testing
 
Flink Batch Processing and Iterations
Flink Batch Processing and IterationsFlink Batch Processing and Iterations
Flink Batch Processing and Iterations
 
The state of hooking into Drupal - DrupalCon Dublin
The state of hooking into Drupal - DrupalCon DublinThe state of hooking into Drupal - DrupalCon Dublin
The state of hooking into Drupal - DrupalCon Dublin
 
Thymeleaf and Spring Controllers.ppt
Thymeleaf and Spring Controllers.pptThymeleaf and Spring Controllers.ppt
Thymeleaf and Spring Controllers.ppt
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
 
WPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaWPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA Austria
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgets
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF
 
Fewd week6 slides
Fewd week6 slidesFewd week6 slides
Fewd week6 slides
 
Practica n° 7
Practica n° 7Practica n° 7
Practica n° 7
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
 
First java-server-faces-tutorial-en
First java-server-faces-tutorial-enFirst java-server-faces-tutorial-en
First java-server-faces-tutorial-en
 
Angular JS2 Training Session #2
Angular JS2 Training Session #2Angular JS2 Training Session #2
Angular JS2 Training Session #2
 
How te bring common UI patterns to ADF
How te bring common UI patterns to ADFHow te bring common UI patterns to ADF
How te bring common UI patterns to ADF
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept Implementation
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
 
Struts2 - 101
Struts2 - 101Struts2 - 101
Struts2 - 101
 

Último

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

F# in the enterprise

  • 2.  First class .Net Language citizen  Multi paradigm language  Functional  Object orientated  Well suited for:  Financial  Statistical  Testing  Event processing  Tool development  General purpose components  General server-side development
  • 3.  Referential transparency / deterministic  Immutability  First class functions  Higher order functions  Recursion
  • 4.  Reasoning  Code behaves in a consistent understandable manner  Safety  Contents of variables are always as expected no unknown mutation  Reduction code  Code can be safely reused  Data Sharing  Threading is easier and locks are no longer needed  Testing  Concise functions that are easy to test
  • 5.  Code reduction  Typically around 70%  Increased performance  Easy to parallelise functions  Increased productivity  Common to experience 50% boost  Increasing importance of multi-core and cloud  F# facilitates building multi-core friendly code  Reduced maintenance costs  Bugs and compiler issues are found earlier, typically during REPL (Read-Eval-Print Loop is for interactive compilation and exploration)  Easy to create Domain specific languages
  • 6.  Financial services  Credit Suisse –Valuation, Quant models  Insurance rating  Grange insurance – Insurance Rating Engine  Energy trading  Eon EnergyTrading – pluggable calculation engines  Statistical analysis  Xbox live (TrueSkill)
  • 7.  C# already had functional features  LINQ, Lambda expressions, predicates, closures  Uses the same .Net libraries  Can be consumed by other .Net languages  Start with core components  Algorithm development  Data analysis  parallel batch processing  rapid prototyping  Testing
  • 8. Object pool -C# Example taken from the MSDN website 2Types 20 Lines in base class 41 lines in derived class using System.Collections.Generic; using System.Diagnostics; namespace System.Collections.Concurrent { /// <summary>Provides a thread-safe object pool.</summary> /// <typeparam name="T">Specifies the type of the elements stored in the pool.</typeparam> [DebuggerDisplay("Count={Count}")] [DebuggerTypeProxy(typeof(IProducerConsumerCollection_DebugView<>))] public sealed class ObjectPool<T> : ProducerConsumerCollectionBase<T> { private readonlyFunc<T> _generator; /// <summary>Initializes an instance of the ObjectPool class.</summary> /// <param name="generator">The function used to create items when no items exist in the pool.</param> public ObjectPool(Func<T> generator) : this(generator, new ConcurrentQueue<T>()) { } /// <summary>Initializes an instance of the ObjectPool class.</summary> /// <param name="generator">The function used to create items when no items exist in the pool.</param> /// <param name="collection">The collection used to store the elements of the pool.</param> public ObjectPool(Func<T> generator, IProducerConsumerCollection<T> collection) : base(collection) { if (generator == null) throw new ArgumentNullException("generator"); _generator = generator; } /// <summary>Adds the provided item into the pool.</summary> /// <param name="item">The item to be added.</param> public void PutObject(T item) { base.TryAdd(item); } /// <summary>Gets an item from the pool.</summary> /// <returns>The removed or created item.</returns> /// <remarks>If the pool is empty, a new item will be created and returned.</remarks> public T GetObject() { T value; return base.TryTake(out value) ? value : _generator(); } /// <summary>Clears the object pool, returning all of the data that was in the pool.</summary> /// <returns>An array containing all of the elements in the pool.</returns> public T[] ToArrayAndClear() { var items = new List<T>(); T value; while (base.TryTake(out value)) items.Add(value); return items.ToArray(); } protected override boolTryAdd(T item) { PutObject(item); return true; } protected override boolTryTake(out T item) { item = GetObject(); return true; } } } /// <summary> /// Provides a base implementation for producer-consumer collections that wrap other /// producer-consumer collections. /// </summary> /// <typeparam name="T">Specifies the type of elements in the collection.</typeparam> [Serializable] public abstract class ProducerConsumerCollectionBase<T> : IProducerConsumerCollection<T> { private readonlyIProducerConsumerCollection<T> _contained; /// <summary>Initializes the ProducerConsumerCollectionBase instance.</summary> /// <param name="contained">The collection to be wrapped by this instance.</param> protected ProducerConsumerCollectionBase(IProducerConsumerCollection<T> contained) { if (contained == null) throw new ArgumentNullException("contained"); _contained = contained; } /// <summary>Gets the contained collection.</summary> protected IProducerConsumerCollection<T>ContainedCollection { get { return _contained; } } /// <summary>Attempts to add the specified value to the end of the deque.</summary> /// <param name="item">The item to add.</param> /// <returns>true if the item could be added; otherwise, false.</returns> protected virtual boolTryAdd(T item) { return _contained.TryAdd(item); } /// <summary>Attempts to remove and return an item from the collection.</summary> /// <param name="item"> /// When this method returns, if the operation was successful, item contains the item removed. If /// no item was available to be removed, the value is unspecified. /// </param> /// <returns> /// true if an element was removed and returned from the collection; otherwise, false. /// </returns> protected virtual boolTryTake(out T item) { return _contained.TryTake(out item); } /// <summary>Attempts to add the specified value to the end of the deque.</summary> /// <param name="item">The item to add.</param> /// <returns>true if the item could be added; otherwise, false.</returns> boolIProducerConsumerCollection<T>.TryAdd(T item) { return TryAdd(item); } /// <summary>Attempts to remove and return an item from the collection.</summary> /// <param name="item"> /// When this method returns, if the operation was successful, item contains the item removed. If /// no item was available to be removed, the value is unspecified. /// </param> /// <returns> /// true if an element was removed and returned from the collection; otherwise, false. /// </returns> boolIProducerConsumerCollection<T>.TryTake(out T item) { return TryTake(out item); } /// <summary>Gets the number of elements contained in the collection.</summary> public int Count { get { return _contained.Count; } } /// <summary>Creates an array containing the contents of the collection.</summary> /// <returns>The array.</returns> public T[] ToArray() { return _contained.ToArray(); } /// <summary>Copies the contents of the collection to an array.</summary> /// <param name="array">The array to which the data should be copied.</param> /// <param name="index">The starting index at which data should be copied.</param> public void CopyTo(T[] array, int index) { _contained.CopyTo(array, index); } /// <summary>Copies the contents of the collection to an array.</summary> /// <param name="array">The array to which the data should be copied.</param> /// <param name="index">The starting index at which data should be copied.</param> void ICollection.CopyTo(Array array, int index) { _contained.CopyTo(array, index); } /// <summary>Gets an enumerator for the collection.</summary> /// <returns>An enumerator.</returns> public IEnumerator<T>GetEnumerator() { return _contained.GetEnumerator(); } /// <summary>Gets an enumerator for the collection.</summary> /// <returns>An enumerator.</returns> IEnumeratorIEnumerable.GetEnumerator() { return GetEnumerator(); } /// <summary>Gets whether the collection is synchronized.</summary> boolICollection.IsSynchronized { get { return _contained.IsSynchronized; } } /// <summary>Gets the synchronization root object for the collection.</summary> object ICollection.SyncRoot { get { return _contained.SyncRoot; } }
  • 9. Agent based object pool 25 Lines of code 1Type alias 2Types F# 25 Lines 689 Characters 59% less Lines 66% less Characters C# 61 Lines 2041 Characters 2.4x more Lines 2.96x more Characters functions modulePoc //Agent alias for MailboxProcessor typeAgent<'T>=MailboxProcessor<'T> ///One of three messages for our Object Pool agent typePoolMessage<'a>= | GetofAsyncReplyChannel<'a> | Putof'a | ClearofAsyncReplyChannel<List<'a>> /// Object pool representing a reusable pool of objects typeObjectPool<'a>(generate:unit->'a, initialPoolCount) = letinitial=List.initinitialPoolCount (fun (x) ->generate()) letagent=Agent.Start(funinbox-> letrecloop(x) =async { let!msg=inbox.Receive() matchmsgwith | Get(reply) -> letres=matchxwith | a::b->reply.Reply(a);b | [] asempty->reply.Reply(generate());empty return!loop(res) | Put(value)->return!loop(value::x) | Clear(reply) -> reply.Reply(x) return!loop(List.empty<'a>) } loop(initial)) /// Clears the object pool, returning all of the data that was in the pool. memberthis.ToListAndClear() =agent.PostAndAsyncReply(Clear) /// Puts an item into the pool memberthis.Put(item ) =agent.Post(item) /// Gets an item from the pool or if there are none present use the generator memberthis.Get(item) =agent.PostAndAsyncReply(Get)
  • 10.  F# open source project - FractureIO  High performance networking  Composable pipeline library  Agent based infrastructure

Notas del editor

  1. Credit Suisse – rapid development or modelsGrange Insurance - order of magnitude speed increase, running what if scenarios, parrellismEon Energy Trading – pluggable calculation enginesXbox live – Multi-Terrabyte parsing and analytics