 Krzysztof Cwalina Program Manager Microsoft Corporation http://blogs.msdn.com/kcwalina    Brad Abrams Product Unit Manager Microsoft Corporation http://blogs.msdn.com/brada
 
Dow Jones Industrial Average @ 9,000
Dow Jones Industrial Average @ 9,000
 
 
Framework Design Artifacts: Properties Methods  Events Constructors
public class XmlFile {  string filename;  Stream data;  public XmlFile(string filename) {   this.data = DownloadData(filename); } } public XmlFile(string filename) {   this.filename = filename;  } lazy
public class ArrayList {  public int Count {get;} }
 
EmployeeList l = FillList(); for (int i = 0; i < l.Length; i++){ if (l.All[i] == x){...} } if (l.GetAll()[i]== x) {...} public Employee[] All {get{}} public Employee[] GetAll() {} Moral: Use method if the operation is expensive  Calling Code
 
 
 
 
 
 
 
 
 
 
 
 
Time to cut…
 
 
 
public class TheBase : Object { public override string ToString() { return “Hello from the Base&quot;; } } public class Derived : TheBase { public override string ToString() { return “Hello from Derived&quot;; } }
Derived d = new Derived(); Console.WriteLine (d.ToString()); TheBase tb = d; Console.WriteLine (tb.ToString()); Object o = tb; Console.WriteLine (o.ToString());
 
All Virtual members should define a contract Don’t require clients to have knowledge of your overriding Should you call the base?
Barbara Liskov
public interface IComparable {   int CompareTo(object obj); }
 
 
Careful dependency management is the necessary ingredient to successful evolution of frameworks. Without it, frameworks quickly deteriorate and are forced out of relevance prematurely.
 
   BCL WPF XML Reflection
 
 
 
 
 
 
 
 
Climbing a mountain?
Scaling a peak?
Running across a desert?
Falling into a pit?
 
 
 
 
 
 
 
 
 
 
Read the manual??
 
 
 
 
The Power of Sameness
P ascal C asing – Each word starts with an uppercase letter c amel C asing – First word lower case, others uppercase SCREAMING_CAPS  – All upper case with underscores
public class MemberDoc { public  int CompareTo(object value)  public s tring Name { get;} }
public class CMyClass {   int CompareTo (object objValue) {..}   string lpstrName {get;}   int iValue {get;} }
 
 
 
 
 
 
Brad Abrams http://blogs.msdn.com/brada   Krzysztof Cwalina http://blogs.msdn.com/kcwalina   Please fill out  the session  evals!
© 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.

Framework Design Guidelines

  • 1.
     Krzysztof CwalinaProgram Manager Microsoft Corporation http://blogs.msdn.com/kcwalina  Brad Abrams Product Unit Manager Microsoft Corporation http://blogs.msdn.com/brada
  • 2.
  • 3.
    Dow Jones IndustrialAverage @ 9,000
  • 4.
    Dow Jones IndustrialAverage @ 9,000
  • 5.
  • 6.
  • 7.
    Framework Design Artifacts:Properties Methods Events Constructors
  • 8.
    public class XmlFile{ string filename; Stream data; public XmlFile(string filename) { this.data = DownloadData(filename); } } public XmlFile(string filename) { this.filename = filename; } lazy
  • 9.
    public class ArrayList{ public int Count {get;} }
  • 10.
  • 11.
    EmployeeList l =FillList(); for (int i = 0; i < l.Length; i++){ if (l.All[i] == x){...} } if (l.GetAll()[i]== x) {...} public Employee[] All {get{}} public Employee[] GetAll() {} Moral: Use method if the operation is expensive Calling Code
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 25.
  • 27.
  • 28.
  • 29.
  • 30.
    public class TheBase: Object { public override string ToString() { return “Hello from the Base&quot;; } } public class Derived : TheBase { public override string ToString() { return “Hello from Derived&quot;; } }
  • 31.
    Derived d =new Derived(); Console.WriteLine (d.ToString()); TheBase tb = d; Console.WriteLine (tb.ToString()); Object o = tb; Console.WriteLine (o.ToString());
  • 32.
  • 33.
    All Virtual membersshould define a contract Don’t require clients to have knowledge of your overriding Should you call the base?
  • 34.
  • 35.
    public interface IComparable{ int CompareTo(object obj); }
  • 36.
  • 37.
  • 38.
    Careful dependency managementis the necessary ingredient to successful evolution of frameworks. Without it, frameworks quickly deteriorate and are forced out of relevance prematurely.
  • 39.
  • 40.
      BCL WPF XML Reflection
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
    The Power ofSameness
  • 69.
    P ascal Casing – Each word starts with an uppercase letter c amel C asing – First word lower case, others uppercase SCREAMING_CAPS – All upper case with underscores
  • 70.
    public class MemberDoc{ public int CompareTo(object value) public s tring Name { get;} }
  • 71.
    public class CMyClass{ int CompareTo (object objValue) {..} string lpstrName {get;} int iValue {get;} }
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
    Brad Abrams http://blogs.msdn.com/brada Krzysztof Cwalina http://blogs.msdn.com/kcwalina Please fill out the session evals!
  • 79.
    © 2008 MicrosoftCorporation. 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.

Editor's Notes

  • #2 06/05/09 19:20 © 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.