Arhitectura

Responsibility Driven Design

Stereotype Description
Information Holder Knows things and provides information. May make calculations from the data that it holds.
Structurer Knows the relationships between other objects.
Controller Controls and directs the actions of other objects. Decides what other objects should do.
Coordinator Reacts to events and relays the events to other objects.
Service Provider Does a service for other objects upon request.
Interfacer Objects that provide a means to communicate with other parts of the system, external systems or infrastructure, or end users.

Patterns in Practice - Object Role Stereotypes

public static class SystemTime
{
    public static Func<DateTime> Now = () => DateTime.Now;
}
 
.....
 
[Test]
public void Should_calculate_length_of_stay_from_today_when_still_occupied()
{
    var startDate = new DateTime(2008, 10, 1);
    SystemTime.Now = () => new DateTime(2008, 10, 5);
 
    var occupation = new Occupation {StartDate = startDate};
 
    occupation.LengthOfStay().ShouldEqual(4);
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License