Sorry if this aunt the best place to post this thread up or if this topic has already been mentioned.
I have been a c++, c# programmer for a good number of years now. mainly focusing on web development sort of stuff. I have always taken an oo design approach when structuring my code. But I have always wondered why? It seems to me that oo design isn’t really that efficient in the web environment.
E.g. when creating a complex web page that requires the loading of a number of (different) objects, I would normally have to run a db query for each. Say for example we had a Customer details page showing the details of a customer and their related customer transactions. this page could require the loading of a Customer object and maybe a collection of CustomerTransaction objects . this would mean that the interaction between webserver and db server would have to go back and forth which would make it slower for the web server to respond back with the requested page. and this is a basic example. Quite often I come across pages that require the loading of a great number of objects.
What I was thinking would be better in terms of website performance/speed would be a page by page programming approach. where each page would require only one db query to get all the information it needed for the page.
I know this idea would throw all the benefits of oo design out the window but it would mean a faster loading web page.
That really depends on how you would structure your classes. If you would design a query class that encapsulates the customer object and the required transactions (possibly passing that info to the constructor of the query class) there could still be only one db access for each page.