Reactions to story from Zen and the art of Castle maintenance
Joining Microsoft
http://hammett.castleproject.org/ ?p=312
Joining Microsoft July 16th, 2008 Long time readers of this blog (all four of you) wont find it difficult to remember my usual posts on my birthdays. Always a time to stop, reflect and setting goals. Well, another birthday came, I’m 29 now, and starting a new chapter in my life. I’m joining Microsoft and relocating to the North hemisphere. I’m sure you have many questions. I’m going to put some effort in answering the ones I can anticipate. Why? Many reasons. First of all, meeting Scott Guthrie and talking to Brad Abrams made me realize those guys are just as fanaticts about technology as I am.
Reactions / posts that link to this post
View all reactions »-
Yet another .NET community guy at Microsoft
http://devcatharsis.blogspot.com/2008/07/yet-another-net-com...Ok, this is just beginning to get silly, now it was CastleProject's Hammett's time. As I've mentioned earlier: Yet another .NET blogger and open source contributor sets sails to Redmond. Now was Rod Conery's time, the SubSonic guy, and the lucky team is yet again ScottGu's dream team. I'm afraid this trend can turn against Microsoft in the long run. These people were in fact working for Microsoft's interests, just out of Microsoft's roll pay. They were helping creating great software over Microsoft technologies, and creating communities around it. And they were credible, not just because of their recognized competence, but also because they were independent. Hope they keep up with the pace they had. The good thing is that he will continue working on Castle. Hanselman, Haack, Conery, Hammet... When will this end?
-
Microsoft banking on Managed Extensibility Framework (MEF)
http://dotnetjunkies.com/WebLog/kenbrubaker/archive/2008/07/...Microsoft is hiring Verissimo de Oliveira, the founder of the Castle Project, which has one of most popular Dependency Injection (DI) frameworks for .NET, Windsor. From this eWeek article: In addition, Microsoft's hiring moves have reflected a move toward more "open"-minded individuals. For instance Hamilton Verissimo de Oliveira, founder of the Castle Project, recently said he will join Microsoft as project manager of the MEF (Managed Extensibility Framework) team. MEF provides developers with a tool to easily add extensibility to their applications and with minimal impact on existing code. I would say Microsoft is serious about DI, no?
-
Opportunities, holidays & beers
http://blog.yoot.be/post/Opportunities-holidays-beers.aspxI've been quite busy lately which explain the very few & mostly news-aggregating posts I've written: Opportunity 1 : Late June, I had the pleasure to pass an interview at Microsoft, in Seattle, for a position of Program Manager on the MEF Team. I met very bright people and had very interesting conversations (and played with Microsoft Surface !!! ), and although I wasn't chosen (I simply wasn't good enough but I'm working on it I'm a positive guy), I view it as a great experience in my professional career. I later was very happy to learn that Hammett was hired for the position ... this guy is a genius. I was already enthusiastic about MEF before, but now I cannot wait to see the outcome. Holidays : difficult to concentrate on work when the sun is out and you got family & friends to got out with ... Opportunity 2 : I quit my company where I was working as a .Net consultant to join a small team of very talented people working on a great project. Cherries on the cake, I'm going to work close from home and for the first time in my life, buy my own car. Beers : when it's sunny & warm in Belgium, Belgians drink a lot of beers (actually, they also do even when it's not sunny but that's another story )... and you probably don't care about it lol ... Except that the guys of the Dutch Alt.net group have invited Ayende to share some good belgian beers on Tuesday, the 5th August in Brussels. I'll be there and I'm eager to see what kind of interesting conversations geeks can have after a few Leffe Blonde, Duvel, Kwak, Chimay ... lol Couldn't make it, too busy. All in all, a great period with lots of changes ... I'll be back with (I hope) interesting posts, about Entity Framework most notably, around mid-August. See you then !
-
Opportunities, holidays & beers
http://blog.yoot.be/post/Opportunities-holidays-beers.aspxI've been quite busy lately which explain the very few & mostly news-aggregating posts I've written: Opportunity 1 : Late June, I had the pleasure to pass an interview at Microsoft, in Seattle, for a position of Program Manager on the MEF Team. I met very bright people and had very interesting conversations (and played with Microsoft Surface !!! ), and although I wasn't chosen (I simply wasn't good enough but I'm working on it I'm a positive guy), I view it as a great experience in my professional career. I later was very happy to learn that Hammett was hired for the position ... this guy is a genius. I was already enthusiastic about MEF before, but now I cannot wait to see the outcome. Holidays : difficult to concentrate on work when the sun is out and you got family & friends to got out with ... Opportunity 2 : I quit my company where I was working as a .Net consultant to join a small team of very talented people working on a great project. Cherries on the cake, I'm going to work close from home and for the first time in my life, buy my own car. Beers : when it's sunny & warm in Belgium, Belgians drink a lot of beers (actually, they also do even when it's not sunny but that's another story )... and you probably don't care about it lol ... Except that the guys of the Dutch Alt.net group have invited Ayende to share some good belgian beers on Tuesday, the 5th August in Brussels. I'll be there and I'm eager to see what kind of interesting conversations geeks can have after a few Leffe Blonde, Duvel, Kwak, Chimay ... lol Couldn't make it, too busy. All in all, a great period with lots of changes ... I'll be back with (I hope) interesting posts, about Entity Framework most notably, around mid-August. See you then !
-
Introducing Managed Extensibility Framework
http://blogs.ugidotnet.org/corrado/archive/2008/07/28/93551....Introducing Managed Extensibility Framework Introduzione Ai primi di giugno 2008 e' uscito, un po in sordina a dir la verita', la prima CTP del Managed Extensibility Framework (MEF) e sebbene ancora in fase embrionale visto che farà parte della prossima "Wave" credo valga la pena tenerlo d'occhio non fosse altro perchè nel team oltre a nomi noti quali Krzysztof Cwalina e Brad Abrams si è da poco aggiunto un certo Hamilton Verissimo ovvero il papà di Castle Project. Gli esempi allegati al MEF sono molto WPF oriented ma non per questo MEF=WPF anche se l'accoppiata MEF + Model-View-ViewModel offre l'opportunità per scenari di estensibilità decisamente interessanti. Al momento MEF altro non è che una dll ComponentModel.dll,in versione guarda caso 4.0.0.0, che estende System.ComponentModel con un nuovo namespace Composition. Supponiamo di voler accoppiare, oppure se preferite, iniettare, nella proprietà Role di un istanza della classe Person un determinato ruolo: public class Person { [Import("Role")] public string Role { get; set; } } public class RoleProvider { [Export("Role")] public string AvailableRole { get { return "Developer" ; } } } Il codice per realizzare quanto richiesto è: Person p = new Person(); RoleProvider rp = new RoleProvider(); CompositionContainer container = new CompositionContainer(); container.AddComponent<Person>(p); container.AddComponent<RoleProvider>(rp); container.Bind(); Console.WriteLine(p.Role); //Developer Console.ReadLine(); Analizzando la definizione delle classi avrete notato che le proprieta' Role di RoleProvider e Person sono decorate rispettivamente con degli attributi [Export] e [Import] i quali indicano i punti di estensibilita' messi a disposizione da Person e RoleProvider, la stringa passata nel costruttore permette di associare a questi punti degli identificativi univoci (Contract Names) In sintesi: RoleProvider mette a disposizione di MEF un 'componente' il cui nome è “Role” mentre Person ha bisogno di un ‘componente’ con lo stesso nome. A mettere in comunicazione i due componenti ci pensa l'oggetto CompositionContainer il quale alimentato con i vari tipi che espongono o richiedono componenti al momento del Bind 'connette' i vari componenti in base al relativo identificativo. Se un Import rimane senza corrispondente Export, il Bind fallisce, cosi come fallisce nel caso in cui in CompositionContainer vengano inseriti più Export con lo stesso identificativo. Nel caso si abbiano piu' Imports che richiedono lo stesso Export, by default, tutti gli Imports condividono la stessa istanza, comportamento comunque modificabile attraverso l’ attributo [CompositionOptions] Tutto questo e' sicuramente molto interessante, peccato che di estensibile ci sia poco o nulla, infatti tutti gli attori sono fortemente legati tra loro. Rendiamo la soluzione estensibile Creiamo una nuovo progetto Class Library e spostiamo al suo interno la classe RoleProvider creata in precedenza, compiliamo e copiamo la dll di output in una cartella Extensions posta sotto la directory contenente l'eseguibile principale, separando, di fatto, consumer e provider. A questo punto dobbiamo modificare il codice che accoppia le entità con quello che segue: Person p = new Person(); DirectoryWatchingComponentCatalog catalog = new DirectoryWatchingComponentCatalog() catalog.AddDirectory(@".\Extensions"); var container = new CompositionContainer(catalog.Resolver); container.AddComponent<Person>(p); container.Bind(); Console.WriteLine(p.Role); Console.ReadLine(); Come potete notare un nuovo elemento è entrato in gioco, si trarra del DirectoryWatchingComponentCatalog il quale tiene sotto controllo una o più directories e mette a disposizione gli Imports/Exports in esse contenuti. E’ anche possibile notificare ai componenti quando l’asset delle directory cambia implementando l’interfaccia INotifyChanged. Che succede al nostro esempio se copio in Extensions due assembly che espongono ognuna un componente “Role” ? ottengo un eccezione per i motivi citati in precedenza, vediamo quindi come gestire il caso più frequente: Più Export resi disponibili a un unico Import. One Import vs More Exports Creiamo un altro progetto Class Library e copiamo al suo interno la classe RoleProvider vista in precedenza modificando il valore ritornato, giusto per avere due risultati diversi ,aggiungiamo ad entrambe le classi RoleProvider dei metadati che ci consentano successivamente di discriminare un componente dall’altro e copiamo entrambe le dll nella directory Extensions utilizzata in precedenza. namespace RoleLibrary1 { public class RoleProvider { [Export("Role")] [ExportProperty("IsActive",false)] public string AvailableRole { get { return "Developer"; } } } } namespace RoleLibrary2 { public class AnotherRoleProvider { [Export("Role")] [ExportProperty("IsActive",true)] public string AvailableRole { get { return "Architect"; } } } } e cambiamo la parte di Binding con questo codice: Person p = new Person(); DirectoryWatchingComponentCatalog catalog = new DirectoryWatchingComponentCatalog(); catalog.AddDirectory(@".\Extensions"); var container = new CompositionContainer(catalog.Resolver); var ret=container.TryGetImportInfos("Role"); if (ret.Succeeded) { foreach (IImportInfo importInfo in ret.Value) { if ((bool)importInfo.Metadata["IsActive"]) { string role = (string)importInfo.GetBoundValue(); p.Role = role; } } } Console.WriteLine(p.Role); Console.ReadLine(); Alle estensioni abbiamo aggiunto attraverso l’attributo [ExportProperty] dei metadati aggiuntivi e anzichè delegare al metodo Bind il compito di iniettare le estensioni (cosa che fallirebbe in questo caso vista la presenza di due assembly che esportano lo stesso contract name) usiamo il metodo TryGetImportInfos per ottenere una collezione di IImportInfo e, in base al valore del metadato “IsActive” decidere quale istanza utilizzare invocando il metodo GetBoundValue(); Delle varie estensioni, solo quella sul quale viene invocato il metodo GetBoundValue viene effettivamente caricata in memoria. Lookup Dinamico Fin’ora abbiamo utilizzato una stringa come tipo da iniettare, in un caso reale è molto probabile che si abbia a che fare con un tipo che condivide la stessa interfaccia con più estensioni come in questo caso: Entities project namespace Entities { public interface IAddress { int CAP { get; set; } string Address { get; set; } string City { get; set; } } } Il progetto Entities è referenziato sia dall’assembly principale che dalle varie estensioni, quindi ci aspettiamo che un estensione scritta in questo modo funzioni correttamente [Export("Address")] public class Address:Entities.IAddress { public int CAP { get{return 20100;} set{throw new NotImplementedException(); } } string Entities.IAddress.Address { get{return "Via Torino, 51";} set{throw new NotImplementedException();} } public string City { get{return "MILANO";} set{throw new NotImplementedException();} } } ed effettivamente è cosi, ma che succede se creo un estensione come quella qui sotto che nulla sa dell’interfaccia IAddress? [Export("Address")] public class LocationInfos { public int CAP { get { return 10100; } set { throw new NotImplementedException(); } } public string Address { get { return "Via Milano, 77"; } set { throw new NotImplementedException(); } } public string City { get { return "TORINO"; } set { throw new NotImplementedException(); } } } Nulla!, tutto continua a funzionare in quanto le regole di binding, a patto che il contract name (“Role”) coincida, verificano che la firma di LocationInfos soddisfa quella dichiarata dalla controparte Import. Conclusione E’ ancora molto presto per esprimere pareri su MEF e, non si sa quanto di quanto visto fin’ora rimarrà nella versione finale, ma viste le persone coinvolte sicuramente MEF sarà un altro dei vari acronimi di cui parleremo spesso nei mesi a venire. Technorati Tags: Managed Extensibility Framework author: Corrado Cavalli |
-
Microsoft banking on Managed Extensibility Framework (MEF)
http://www.dotnetjunkies.com/WebLog/kenbrubaker/archive/2008...Microsoft banking on Managed Extensibility Framework (MEF) Microsoft is hiring Verissimo de Oliveira, the founder of the Castle Project, which has one of most popular Dependency Injection (DI) frameworks for .NET, Windsor. From this eWeek article: In addition, Microsoft's hiring moves have reflected a move toward more "open"-minded individuals. For instance Hamilton Verissimo de Oliveira, founder of the Castle Project, recently said he will join Microsoft as project manager of the MEF (Managed Extensibility Framework) team. MEF provides developers with a tool to easily add extensibility to their applications and with minimal impact on existing code. I would say Microsoft is serious about DI, no? posted @ 7/25/2008 5:07 PM by Ken Brubaker
-
Microsoft banking on Managed Extensibility Framework (MEF)
http://dotnetjunkies.com/WebLog/kenbrubaker/archive/2008/07/...Microsoft is hiring Verissimo de Oliveira, the founder of the Castle Project, which has one of most popular Dependency Injection (DI) frameworks for .NET, Windsor. From this eWeek article: In addition, Microsoft's hiring moves have reflected a move toward more "open"-minded individuals. For instance Hamilton Verissimo de Oliveira, founder of the Castle Project, recently said he will join Microsoft as project manager of the MEF (Managed Extensibility Framework) team. MEF provides developers with a tool to easily add extensibility to their applications and with minimal impact on existing code. I would say Microsoft is serious about DI, no?
More rising blog posts
-
Entertainment »
MTV VMA Arrivals -
Business »
FREE $50 Wells Fargo Checking Deal -
Lifestyle »
FlashBack: Backpack with integrated LED's -
Politics »
Big Bounce for McCain Among Likely Voters! -
Sports »
Tom Brady Injured in Patriots Win -
Technology »
30+ Adobe Illustrator Tutorials : Mastering Your Tools and Options
Recent posts from Zen and the art of Castle maintenance
-
MEF Preview 2
2 days ago -
Credits: be nice MVCContrib people
3 days ago -
Integrating MonoRail with your favorite IoC container
3 days ago