Immutable Collections

Sunday, February 17, 2013

Immutable Collections Immutability is a pattern which is suit well parallel programming, but you have to be aware of a potential memory pressure risk when it's not implemented right or used wisely. this post will cover a new BCL library (still in its preview stage) which is targeting immutable collections. .NET is already having Concurrent implementation for Queue, Stack, Bug and Dictionary, which is thread-safe, but other type of collection like List is missing. another type of collection are read only collection, but those type...

MEF 2.0 – mini series: Part 7 (Catalog filter and Deep hierarchic scoping)

Thursday, January 24, 2013

MEF 2.0 - mini series: Part 7 (Catalog filter and Deep hierarchic scoping) this is the 7th post in the MEF 2.0 mini series. you can see the following TOC for other posts in this series. in the previous post I was talking about composition scoping and lifetime management. on this one, I will extend the composition scoping topic toward hierarchic along with catalog filtering capability. hierarchic scoping is not trivial, you must understand the hierarchic behavior and what it was design for. MEF hierarchic...

MEF 2.0 – mini series: part 6 (Composition scoping and lifetime management)

Wednesday, January 16, 2013

MEF 2.0 - mini series: part 6 (Composition scoping and lifetime management) this is the 6th post in the MEF 2.0 mini series. you can see the following TOC for other posts in this series. in this post I will cover a new concept of scoping and part lifetime management, which is a great improvement over MEF 1. MEF 1 was coming with a fairly naïve lifetime management. part's lifetime could be either shared or non-shared (you could also apply 'any' but eventually 'any'...

MEF 2.0 – mini series: part 5 (Fluent export properties)

Tuesday, January 15, 2013

MEF 2.0 - mini series: part 5 (Fluent export properties) this is the 5th post in the MEF 2.0 mini series. you can see the following TOC for other posts in this series. in this post I will cover the fluent property's export. Exporting properties is a less known feature of MEF. MEF 1 was supporting this feature by using the attribute model. you could decorate a property with a attribute and then it become available for imports. the following...

MEF 2.0 TOC

Sunday, January 6, 2013

MEF 2.0 TOC MEF 2.0 is a reflection of a community requests. features like Open Generics, fluent and conventional discovery, lifetime handling of the part, better exception handling and more, was all requested by the community. part 1: Open Generics Part 2: Fluent and Conventional Export Part 3: Fluent import constructor Part 4: Fluent import Part 5: Fluent export properties. Part 6: Composition scoping and lifetime management ...

MEF – Best Practice

Wednesday, July 27, 2011

MEF - Best Practice In this post I will offer MEF practice that may ease your MEF life. one of the MEF headache is to understand what's goes wrong, when MEF reject the composition, you can read more about MEF diagnostic in this post.  Most of the obscure loading failure happens when your Export dependencies doesn't satisfied. in those case you solely relay on the MEF error message which is not enough in cases of deep dependencies graph. It will normally occurs when you...

SDP – MEF (Real-Life patterns)

Friday, March 18, 2011

SDP - MEF (Real-Life patterns) On the last day of the SDP at Crown Plaza Hotel, Tel Aviv. I was lecturing about Real-Life scenario of MEF failures. the lecture was focusing on diagnostic ,solutions and testing. I want to thanks all attendant's, It was the after lunch session and you were bravely kept your eyes open.   the presentation pdf can be found here.   you can use the following check-list as recommended diagnostic process.   Diagnostic Check-List Is the instance included...

Dynamic MEF isn’t thread safe by nature

Saturday, December 4, 2010

Dynamic MEF isn't thread safe by nature this post focus a pitfall which you should be aware in order to avoid sporadic crashes. In general most of MEF operation are operate once at the application initialization stage, and it normally happens on a single thread.   this may not be true when you need to dynamically load MEF parts (using GetExportedValue or SatisfyImportsOnce).   unfortunately MEF underline is using non concurrent dictionary which is not thread safe for the above operation implementation. therefore the following code will crash sporadically. ...

Exporting non Exportable types

Saturday, October 30, 2010

Exporting non Exportable types this post extend Glenn Block's post about "Poco, Mef, and custom type systems. Are you ready to take the red pill?"  the post is adding a compile time attribute export model, Directory catalog and migrate Glenn code to VS 2010. It is very recommended to read Glenn Block's post before reading this one.   the code sample for this post can be download from here.   Summarizing Glenn's post in general Glenn show how to add attributes (like Export) to...