Stendhal code design: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Chad3f
imported>Chad3f
Line 5: Line 5:
=== Entities ===
=== Entities ===


Entity's are created using '''EntityFactory.createEntity()'''. In this method, the appropriete implementation class is created, and the '''initialize()''' method is called. When the entity is to be removed, the '''release()''' method should be called on it.
Entity's are created using '''EntityFactory.createEntity()'''. In this method, the appropriete implementation class is created, and initialize().


The design is being transitioned to a Model-View-Controller (MVC) like framework. This will allow different visual implementations (like 2D, 3D) to be plugged in with minimal (or no) changes of the model class.
The design is being transitioned to a Model-View-Controller (MVC) like framework. This will allow different visual implementations (like 2D, 3D) to be plugged in with minimal (or no) changes of the model class.
Line 28: Line 28:
This contains all logical entity data, and is responsible for tracking all entity specific attribute changes in the RPObject that it wraps. Currently this also handles some of the UI controller functions.
This contains all logical entity data, and is responsible for tracking all entity specific attribute changes in the RPObject that it wraps. Currently this also handles some of the UI controller functions.


The initialize() method is called with the RPObject that it will represent. This method is called after the constructor returns, but before anything else is [externally] called.
The '''initialize()''' method is called with the RPObject that it will represent. This method is called after the constructor returns, but before anything else is [externally] called.
When the client no longer needs the entity, it should call release(), which should handling any cleanup that garbage collection only is insufficient.
When the client no longer needs the entity, it should call '''release()''', which should handling any cleanup that garbage collection only is insufficient.


The class gets notified of object changes via the RPObjectChangeListener interface that it implements. This will be called for all changes to it's object (and immediate slot objects).
The class gets notified of object changes via the '''RPObjectChangeListener''' interface that it implements. This will be called for all changes to it's object (and immediate slot objects).