I’m sure this has been discussed before, so forgive me.
I’ve been reading PoEAA again because I feel lately my code has been becoming much less OO-pure and more procedural, but reading through this excellent book again got me thinking… with PHP’s nature being request/response cycle driven, with nothing kept in memory between cycles, everything has to per persisted in some form or another between each request. Everything is created, everything is destroyed. All walls are built, all are torn down.
It made me want to ask of the clever people in this forum: how TRUE of a domain model do you actually use within PHP? How big are the object graphs you’re pulling into memory per R/R cycle? Do you use some form of lazy loading? When you perform an operation on your model, does it modify only the object graph in memory, and then persist to the database (or other, session?) when the walls are torn down? Or are you performing ad hoc queries to/from the database when manipulating your object graph?
I’m just thinking that because PHP continually needs to work with persistent storage… databases primarily, how far does one go with the “pure” domain model approach, and how do you find the right balance between performance, persistence and memory usage per R/R cycle? Need some thoughts and opinions from those brighter than me…