Sign in to follow this  
choffstein

Name this Design Pattern

Recommended Posts

I am trying to think of the name of this programming pattern, but am drawing a blank. Essentially, you use attributes or components and plug them into your classes to define class behavior. So, let's say I had a base Robot class. I could have a whole bunch of components that defined possible behavior, such as 'walking', or 'rolling', or 'fixing', and them I register the appropriate behavior with the right type of Robot. So a WorkerRobot may have 'walking' and 'fixing' attributes. I don't think I have the paradigm entirely right, because I think you typically just iterate through the components and update them -- though it is entirely possible that you could make them publicly available through some sort of component table. So...anyone know the name of this pattern? EDIT: Changed the word paradigm to pattern [Edited by - visage on December 16, 2008 7:27:00 AM]

Share this post


Link to post
Share on other sites
Sounds more like a design pattern than a programming paradigm. This could be either a composite or a decorator pattern.

EDIT:
You could also achieve this with a functional programming language such as Lua.

Share this post


Link to post
Share on other sites
Paradigm was the wrong word, thanks for the correction. Pattern was what I was looking for.

Decorator pattern definitely seems like what I was thinking about. Whether that is specifically it, I don't know ... but it sure seems close enough.

Thanks for the help guys.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this