Name this Design Pattern
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]
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.
EDIT:
You could also achieve this with a functional programming language such as Lua.
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.
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.
Quote:Original post by RobTheBloke
you didn't mean component systems did you?
I knew this sort of system had been discussed on gamedev before. Thank you for reminding me of that resource, my good sir.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement