Construction idioms: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
So here's three complete programs which demonstrate how I would go about evolving some code including a main component called MyThing. The initial implementation would be very direct and very concrete, the next implementation would factor out an interface, and the final implementation would implement MyThing in a full-blown extensible framework. | So here's three complete programs which demonstrate how I would go about evolving some code including a main component called MyThing. The initial implementation would be very direct and very concrete, the next implementation would factor out an interface, and the final implementation would implement MyThing in a full-blown extensible framework. All versions support construction via a MyThing.Create() factory method, thus "construction idioms". | ||
{|class="wikitable" | {|class="wikitable" | ||
! Example program | |||
! Note | |||
|- | |||
| [https://svn.jj5.net/jjrepo/exp/2017-11-23-000609/take-0.cs Take Zero] | | [https://svn.jj5.net/jjrepo/exp/2017-11-23-000609/take-0.cs Take Zero] | ||
| concrete implementation | | concrete implementation | ||
Line 14: | Line 17: | ||
If you want a copy of the code: | If you want a copy of the code: | ||
svn co https://svn.jj5.net/svn/public/jjrepo/exp/2017-11-23-000609 . | <nowiki>svn co https://svn.jj5.net/svn/public/jjrepo/exp/2017-11-23-000609 .</nowiki> |
Latest revision as of 23:12, 24 November 2017
So here's three complete programs which demonstrate how I would go about evolving some code including a main component called MyThing. The initial implementation would be very direct and very concrete, the next implementation would factor out an interface, and the final implementation would implement MyThing in a full-blown extensible framework. All versions support construction via a MyThing.Create() factory method, thus "construction idioms".
Example program | Note |
---|---|
Take Zero | concrete implementation |
Take One | introduce interface |
Take Two | extensible framework |
If you want a copy of the code:
svn co https://svn.jj5.net/svn/public/jjrepo/exp/2017-11-23-000609 .