Jun 27 2008
Functionality and Features v/s Performance and Cost
This is a major issue in developing applications, what functionality and features do we require and they come at what expense. I usually like to things simple for the user and that generally means better performance and less cost. Ofcourse there are certain features those need to be implemented irrespective of the cost, performance has to be optimized for them.
Here is an example of when i personally think that a feature is irrelevant, I had to implement a shopping cart in Flex and as soon as a product is added to the shopping cart its saved on the server as well. The idea behind this is that if the user doesn’t buy the product and returns to the site again he still has the product saved in the cart.
It just doesn’t make sense to me, making a server call every time product is added will increase the load tremendously, yes we need to make a server call when the product is removed as well. If the client logs in after a week or so and the product is no longer available, we need to handle it differently, is it worth the effort????? i would say NO. The end user i think doesn’t care if their cart information is saved, if i add something to cart then i will buy it right away.
It might seem just a server call but on the server there is a call to the database, insertion, deletion etc, all those operations take up precious server time and resources. It doesn’t matter if its a call to webservice or a remote method the basic idea is the same. If the number of users increases then the load on the server will increase like crazy, every tiny bit of operation has to be optimized.
I would use a shared object to store the cart information as a compromise but then I am just getting paid to write the code, its not my problem to maintain the servers etc. I have presented my case to them and its their choice.
Another scenario was when we wanted to save users favorites data on the server and were faced with the same problem. It just wouldn’t make sense to update that information every time user will add an item or delete something from favorites, it would literally kill the server. So we decided to store that information in memory on the client side and then send it out every 2 minutes, a reasonable compromise i would say.
So next time if you decide to add a feature it would be wise to consider the server performance, most of the times people can get away with it because the number of users are not that much and the server is heavy duty server with lots of RAM and CPU power. Only when the number of users increase exponentially and then people start to realize the importance of taking all these points into consideration.