Quote:Original post by T1Oracle
So does the STL. Ever heard of remove_if, copy_if, transform, for_each? The STL has plenty of useful algorithms.
Yes - but thats not what I meant. It doesn't perform operations ON the list, but WITHIN it. Take my entity manager, every time you create an entity it needs to have its spawn timer set, and it needs to have its spawn script run. If I didn't have an enitty manager I'd have to either put that code manually in every function which created an entity (a pain in the butt), or I'd have to write a standalone function todo it. Why wouldn't I put that function (and the rest like it) with my entity "manager"? My manager also, adds the item to the list and does memory management etc, but its most usefull functions are the specifics which no STL algorithm can do because they are unique.
Quote:Original post by T1Oracle
A name is a brief yet meaningful summary of what an object does.
Exactly - my managers "manage" my resources :P I don't see how a "factory" or "flyweight pattern" is any more descriptive than "manager".
Quote:Original post by T1Oracle
Then how does it make any less sense to define the entire application as a manager.
lol - true, I'd also say my IDE manages my code an is therefor a manager. And because I manage the IDE i'm its manager. yay - infinite loop of joy. But that doesn't take away from the fact my resource managers manage my resources ...
Quote:Original post by T1Oracle
What about versatility, loose coupling, and code size? How much of those "managers" aren't even being used? How much code are you writting just to deal with the specific querks of a given "manager?" How much work would you have to do to add in a feature not supported by that "manager?" How much refactoring would be needed to swap one "manager" for another?
- My managers are about 300-500 lines long on average ... I'd say about 80% of that is the actual resource loading (which you have to put somewhere so is unavoidable).
- I use all my managers - otherwise I wouldn't still keep them around.
- What do you mean specific quirks? The whole point of managers is to DEAL with the quirks of a chosen resourse so I'd have to say 100% of it is for quirks.
- Less code because off the manager. I'd only have to add it inside the manager, and expose a function or two to use it. If it wasn't inside a manager who knows how much code I'd have to tie in from random places to use it.
- No refactoring would be needed. My managers all return int ID's, and accept int ID's to todo whatever it is they do so I'd only every need to change the manager. I did this too ages ago when I change from .tga loading to .png - only change my texture manager and no other code.
Quote:Original post by T1Oracle
When you get the term "manager" what exactly are you guaranteed?
Like I said - thats not a downside in my oppinion. I know exactly what I'm garenteed by MY managers ... if I gave you my class called "ManagerTexture" with has a int load(std:string fname); then i'm pretty sure you can tell what it does. If you give me a class called "FlyweightTexture" then I'd probably assume it loaded really small textures :P