10. Features
• Component does not know anything about
other components beyond the scope of the
extension contract
• Applications can have more than one
component that extend a specific extension
point
11.
12.
13.
14. Evolution
public class Calculator
{
private string baseValue;
...
public void Add(string value)
{
if (value==null
|| value.Count == 0
|| value == "-")
{
baseValue = baseValue + "-";
}
...
}
}
15. Evolution
public class Calculator
{
private string baseValue;
...
public void Add(string value)
{
if (ContainsDefaultValue(value))
{
baseValue = baseValue + "-";
}
...
}
protected virtual bool ContainsDefaultValue(string value)
{
return (value==null
|| value.Count == 0
|| value == "-");
}
}