User:Jeroen De Dauw/Single Responsibility Principle/02

From semantic-mediawiki.org
Jump to: navigation, search
Jeroen De DauwJeroen De Dauw/Single Responsibility PrincipleUser:Jeroen De Dauw/Single Responsibility Principle/02

The single responsibility principle

class MapsLocation {
 
    // The values representing a geographical location
    protected $latitude;
    protected $longitude;
    // ...
 
    // Alternatively an "address", which might or might not be "valid"
    protected $address;
    protected $isValid;
 
    // Information on how the location is used in a map
    protected $icon;
    protected $group;
    // ...
 
    // Information on how the location should be formatted
    protected $format;
    protected $directional;
    // ...
 
}
  • Clear violation of SRP