framework design guidelines
DESCRIPTION
I am very excited to be giving a Framework Design Guidelines talk at the PDC this year. Krzysztof and I think of this as our "victory lap" for publishing the Framework Design Guidelines 2nd Edition. As we were talking about what to cover in this talk, Krys and I realized that it has been just about 10 years since we started that very first version of the Framework Design Guidelines. This is well before we started working on the book, in fact it was before .NET Framework 1.0 shipped or was even announced (which, btw, was at PDC2000). We got to thinking about how things have changed, both in the guidelines and in the industry. Equally interesting is how much has stayed the same. I am particularly interested in what stayed the same over that time.. As we wrote even those first guidelines we knew it was very important that they last. In fact, we needed them to be timeless. About the same time a friend was in the process of designing and building her own home and she gave be a book that still shapes the way I think about software design today: Christopher Alexander, The Timeless Way of Building.TRANSCRIPT
![Page 1: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/1.jpg)
Krzysztof CwalinaProgram ManagerMicrosoft Corporationhttp://blogs.msdn.com/kcwalina
Brad AbramsProduct Unit ManagerMicrosoft Corporationhttp://blogs.msdn.com/brada
![Page 2: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/2.jpg)
![Page 3: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/3.jpg)
Dow Jones Industrial Average
@ 9,000
![Page 4: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/4.jpg)
Dow Jones Industrial Average
@ 9,000
![Page 5: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/5.jpg)
![Page 6: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/6.jpg)
![Page 7: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/7.jpg)
Framework Design Framework Design Artifacts:Artifacts:• PropertiesProperties• Methods Methods • EventsEvents• ConstructorsConstructors
![Page 8: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/8.jpg)
8
public class XmlFile {public class XmlFile { string filename; string filename; Stream data; Stream data; public XmlFile(string filename) { public XmlFile(string filename) { this.data = DownloadData(filename); this.data = DownloadData(filename); }}}}
public XmlFile(string filename) {public XmlFile(string filename) { this.filename = filename; this.filename = filename; } }
lazylazy
![Page 9: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/9.jpg)
public class ArrayList {public class ArrayList { public int Count {get;} public int Count {get;}}}
![Page 10: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/10.jpg)
![Page 11: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/11.jpg)
EmployeeList l = FillList();EmployeeList l = FillList();for (int i = 0; i < l.Length; i++){for (int i = 0; i < l.Length; i++){ if (l.All[i] == x){...}if (l.All[i] == x){...}}}
if (l.GetAll()[i]== x) {...}if (l.GetAll()[i]== x) {...}
public Employee[] All {get{}}public Employee[] All {get{}}
public Employee[] GetAll() {}public Employee[] GetAll() {}
Moral: Use method if the operation is expensive Moral: Use method if the operation is expensive
Calling CodeCalling Code
![Page 12: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/12.jpg)
![Page 13: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/13.jpg)
![Page 14: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/14.jpg)
![Page 15: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/15.jpg)
![Page 16: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/16.jpg)
![Page 17: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/17.jpg)
![Page 18: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/18.jpg)
![Page 19: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/19.jpg)
![Page 20: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/20.jpg)
![Page 21: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/21.jpg)
![Page 22: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/22.jpg)
![Page 23: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/23.jpg)
![Page 24: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/24.jpg)
24
![Page 25: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/25.jpg)
Time to cut…Time to cut…
![Page 26: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/26.jpg)
26
![Page 27: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/27.jpg)
![Page 28: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/28.jpg)
![Page 29: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/29.jpg)
![Page 30: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/30.jpg)
public class TheBase : Object {
public override string ToString() {
return “Hello from the Base";
}
}public class Derived : TheBase {
public override string ToString() {
return “Hello from Derived";
}
}
![Page 31: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/31.jpg)
Derived d = new Derived();Console.WriteLine (d.ToString());
TheBase tb = d;Console.WriteLine (tb.ToString());
Object o = tb;Console.WriteLine (o.ToString());
![Page 32: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/32.jpg)
![Page 33: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/33.jpg)
All Virtual members should define a contractAll Virtual members should define a contractDon’t require clients to have knowledge of Don’t require clients to have knowledge of your overridingyour overridingShould you call the base?Should you call the base?
![Page 34: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/34.jpg)
Barbara Liskov
![Page 35: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/35.jpg)
public interface IComparable { int CompareTo(object obj);}
![Page 36: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/36.jpg)
![Page 37: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/37.jpg)
![Page 38: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/38.jpg)
Careful dependency management is the necessary ingredient to successful evolution of frameworks. Without it, frameworks quickly deteriorate and are forced out of relevance prematurely.
![Page 39: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/39.jpg)
![Page 40: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/40.jpg)
BCLBCL
WPFWPF XMLXML
ReflectionReflection
![Page 41: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/41.jpg)
![Page 42: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/42.jpg)
![Page 43: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/43.jpg)
![Page 44: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/44.jpg)
![Page 45: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/45.jpg)
![Page 46: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/46.jpg)
![Page 47: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/47.jpg)
![Page 48: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/48.jpg)
![Page 49: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/49.jpg)
49Climbing a mountain?Climbing a mountain?
![Page 50: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/50.jpg)
50
Scaling a Scaling a peak?peak?
![Page 51: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/51.jpg)
51Running across a desert?Running across a desert?
![Page 52: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/52.jpg)
Falling into a Falling into a pit?pit?
![Page 53: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/53.jpg)
![Page 54: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/54.jpg)
![Page 55: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/55.jpg)
![Page 56: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/56.jpg)
![Page 57: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/57.jpg)
![Page 58: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/58.jpg)
![Page 59: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/59.jpg)
![Page 60: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/60.jpg)
![Page 61: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/61.jpg)
![Page 62: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/62.jpg)
![Page 63: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/63.jpg)
Read the manual??Read the manual??
![Page 64: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/64.jpg)
![Page 65: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/65.jpg)
![Page 66: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/66.jpg)
![Page 67: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/67.jpg)
![Page 68: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/68.jpg)
![Page 69: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/69.jpg)
PPascalascalCCasing – Each asing – Each word starts with an word starts with an uppercase letteruppercase letter
ccamelamelCCasing – First asing – First word lower case, word lower case, others uppercaseothers uppercase
SCREAMING_CAPSSCREAMING_CAPS – – All upper case with All upper case with underscoresunderscores
![Page 70: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/70.jpg)
public class MemberDoc{ public int CompareTo(object value) public string Name { get;}}
![Page 71: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/71.jpg)
public class CMyClass {public class CMyClass { int CompareTo (object objValue) {..} int CompareTo (object objValue) {..} string lpstrName {get;} string lpstrName {get;} int iValue {get;} int iValue {get;}}}
![Page 72: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/72.jpg)
![Page 73: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/73.jpg)
![Page 74: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/74.jpg)
![Page 75: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/75.jpg)
![Page 76: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/76.jpg)
![Page 77: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/77.jpg)
![Page 78: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/78.jpg)
Brad Abramshttp://blogs.msdn.com/brada
Krzysztof Cwalinahttp://blogs.msdn.com/kcwalina
Please fill out the session evals!
![Page 79: Framework Design Guidelines](https://reader035.vdocuments.us/reader035/viewer/2022062307/55515b6cb4c9059f768b4b00/html5/thumbnails/79.jpg)
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.