Translate

Thursday, August 2, 2012

Curtailed Concise Classes And Trimmed (Reduced) Objects Of A Class

Every one knows memory management is one of the most crucial aspect in development of software / website applications. Using OOP memory management can be easy done by deallocating memory of an object when that object is no more required. But, a class contains many functions that may not be used all together each and every time object of that class is used.

Consider the case when one uses a function of an object of a class (for a serving a webpage) say one function 'a' which again is dependant on function 'b' & 'c' of that class, so totally 3 functions are of use when that web page is loaded. But when we create object of that class, it will contain all functions defined in that class. So, instead of consuming memory of only 3 functions it will consume memory that is required for all function present in that class (Yes, i know that this memory is not much but there is an old saying that lake is built-up of small water droplets). And everyone knows that functionality, complexity, bulkiness of software / web and mobile applications are increasing at very rapid pace, may be: year by year if not day by day.

So lets get back to our original discussion, to write a class separately for each call (considering web development and only one db model class into account, lets say it be a call (web request) for insert) which requires only functions used in that call (say one is for select to check if record exists and other to insert) it will be very tedious, time taking and doesn't suite true object oriented approach to separate those functions required in to separate classes based upon req. of request, more over this req. for many requests can change over time and again lot of functions from here to there. Also, this doesn't suite a true technical person when it is possible to generate such class / objects dynamically at run-time.

This might seem to increase execution time but only during development and during actual time of generating such classes as generation might take some time (mostly not more than few milliseconds for one class). Once the application is deployed & in live environment there is no need to to re-create those classes unless there is any change in code, as those can be stored and used again & updating them is req. only when original one is updated.

For more details and proof of concept visit PLS-E.IN

Will soon make it available for public use once setup on public internet server and post its link here. So, stay in touch. Hopefully, meet you all soon.

Its now already available for free use (currently supports only php classes) at PLS-E.IN

No comments:

Post a Comment