Download presentation
Presentation is loading. Please wait.
Published byLindsey King Modified over 9 years ago
1
Krzysztof Cwalina Program Manager Microsoft Corporation http://blogs.msdn.com/kcwalina http://blogs.msdn.com/kcwalina Brad Abrams Product Unit Manager Microsoft Corporation http://blogs.msdn.com/brada http://blogs.msdn.com/brada PC58
3
Dow Jones Industrial Average @ 9,000
4
Dow Jones Industrial Average @ 9,000
7
Framework Design Artifacts: Properties Properties Methods Methods Events Events Constructors Constructors
8
8 public class XmlFile { string filename; Stream data; public XmlFile(string filename) { this.data = DownloadData(filename); }} public XmlFile(string filename) { this.filename = filename; } public XmlFile(string filename) { this.filename = filename; }lazy
9
public class ArrayList { public int Count {get;} }
11
EmployeeList l = FillList(); 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[] GetAll() {} Moral: Use method if the operation is expensive Calling Code
24
24
25
Time to cut…
26
26
30
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"; }
31
Derived d = new Derived(); Console.WriteLine (d.ToString()); TheBase tb = d; Console.WriteLine (tb.ToString()); Object o = tb; Console.WriteLine (o.ToString());
33
All Virtual members should define a contract Don’t require clients to have knowledge of your overriding Should you call the base?
34
Barbara Liskov
35
public interface IComparable { int CompareTo(object obj); }
38
Careful dependency management is the necessary ingredient to successful evolution of frameworks. Without it, frameworks quickly deteriorate and are forced out of relevance prematurely.
40
BCLBCL WPFWPF XMLXML ReflectionReflection
49
49 Climbing a mountain?
50
50 Scaling a peak?
51
51 Running across a desert?
52
Falling into a pit?
62
Read the manual?? Read the manual??
68
PascalCasing – Each word starts with an uppercase letter camelCasing – First word lower case, others uppercase SCREAMING_CAPS – All upper case with underscores
69
public class MemberDoc { public int CompareTo(object value) public string Name { get;} }
70
public class CMyClass { int CompareTo (object objValue) {..} string lpstrName {get;} int iValue {get;} }
77
Brad Abrams http://blogs.msdn.com/brada Krzysztof Cwalina http://blogs.msdn.com/kcwalina Please fill out the session evals!
79
Please fill out your evaluation for this session at: This session will be available as a recording at: www.microsoftpdc.com
81
© 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.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.