IFM is used when its just one or two functions that you need to add to the class.When the number of functions,that are to be added are more,then ILE is used.Not a rule though :)
But now with Extension Methods the whole process is much more simpler.
You need not do the subclassing or wrapper technique of ILE.
This can be a third way of implementing ILE :).Thanks to the framework team for keeping it simple.
The same date example using the 'Extension Methods' way of refactoring
public static class MyExtensionMethodsThe function NextDay is now available on any DateTime object,just as if you have written if you had access to the source code. It's the usage of ILE and IFM that has paved way for the inclusion of Extension Methods in the framework I guess.Thanks to Fowler for that.
{
public static DateTime NextDay(this DateTime date)
{
return new DateTime(date.Year, date.Month, date.Day+1);
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.