Click here to Skip to main content
15,884,298 members
Articles / Programming Languages / C#

Refactoring to Adaptive Object Modeling: Strategy Pattern

Rate me:
Please Sign up or sign in to vote.
3.38/5 (13 votes)
20 Jun 20058 min read 90.9K   166   36  
Strategy methodology maintains that the operations and business rules or code flow of a class should be held as a collection of properties, as opposed to single method calls, which can be changed at runtime.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<entityTypes>
		<entityType name="ExecutiveJobEntityType" 
			type="Strategy.ImplClasses.ExecutiveJobEntityType" 
			attributes="Attribute1,Attribute3"
			operations="JobOperation1,JobOperation2" />
		<entityType name="EmployeeJobEntityType" 
			type="Strategy.ImplClasses.EmployeeJobEntityType" 
			attributes="Attribute2,Attribute4" 
			operations="JobOperation2" />
	</entityTypes>	
	<entities>
		<entity name="ExecutiveJob" 
			type="Strategy.ImplClasses.JobEntity" 
			entityType="ExecutiveJobEntityType" />
		<entity name="EmployeeJob" 
			type="Strategy.ImplClasses.JobEntity" 
			entityType="EmployeeJobEntityType" />
	</entities>	
	<entityAttributes>
		<entityAttribute name="Attribute1" 
			attributeType="System.String" 
			attributeValue="This is a Adaptive Object Model Attribute" />
		<entityAttribute name="Attribute2" 
			attributeType="System.Int32" 
			attributeValue="1" />
		<entityAttribute name="Attribute3" 
			attributeType="System.Boolean" 
			attributeValue="True" />
		<entityAttribute name="Attribute4" 
			attributeType="System.DateTime" 
			attributeValue="03/01/2005" />
	</entityAttributes>
	<entityOperations>
		<entityOperation name="JobOperation1" 
			type="Strategy.ImplClasses.JobOperation1" />
		<entityOperation name="JobOperation2" 			
			type="Strategy.ImplClasses.JobOperation2" />
	</entityOperations>
</configuration>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Christopher G. Lasater

I am also a published author, please check out my book:
ISBN: 1-59822-031-4
Title: Design Patterns
Author:Christopher G. Lasater
More from my web site
Amazon.com


Comments and Discussions