Skip to main content

Posts

Showing posts from 2012

MVVM Architecture

MVVM:  Model–View-ViewModel talks of creating a new model (in addition to your domain model). This model normally adds additonal properties from the prespective of View (as we understand that View has controls in addition to data which it’s displaying). For instance if View had a property IsChecked and Presenter was setting in classic MVP, in MVVM Presenter will have that IsChecked Property which View will sync up with (doesn’t it look like Strategy pattern has been replaced with Observer?). So now a Presenter becomes more like a combo of – View Properties & Model properties which would be synchronized with View. So why not rename Presenter to ViewModel? Do that and you get MVVM. MVVM is attractive for platforms which support bi-directional binding with less effort. Also a minor tradeoff is ViewModel unlike Presenter can stand on its own (Presenter normally requires a View’s interface). 

Optimizing PHP

The more you understand the software you are using (Apache, PHP, IIS, your database) and the deeper your knowledge of the operating system, networking and server hardware, the better you can perform global optimizations on your code and your system. Try to use as much caching as possible, typically I would use this configuration: Squid -- PHP and memcache or file caching -- Database. For PHP scripts, the most expensive bottleneck is normally the CPU. If you are not getting out of memory messages, more CPUs are probably more useful than more RAM. Compile PHP with the "configure –-enable-inline-optimization" option to generate the fastest possible PHP executable. Tune your database and index the fields that are commonly used in your SQL WHERE criteria.  ADOdb , the very popular database abstraction library, provides a  SQL tuning mode , where you can view your invalid, expensive and suspicious SQL, their execution plans and in which PHP script the SQL was executed. Use