There’s some acronym soup for ya! Phil talks about the differences in the MVP and MVC patterns, some other patterns emerging out of MVP, and of course the ASP.NET MVC Framework, recently released to manufacturing by Microsoft!
March 31, 2009
March 30, 2009
A coding standard basically tells developers in what style they must write their code. If programmers work in a team than a coding standard ensures that each will be able to read the others code without any effort. [...] A tool which scans your source code and checks it against a standard would be quite a help. PHP_CodeSniffer is one such tool.
The PHP_CodeSniffer package allows you to check code (to “sniff” it) and ensure that it matches against a certain format. The tool doesn’t do any testing outside of that, though – no unit testing or functionality checking.
Sameer includes a guide to getting the tool installed and using it to get the source files in a certain directory. He also points to a tutorial for developing your own coding standards.
Alison has posted a guide to a technique that can help your site resist higher loads – content caching:
Caching your database-driven website pages has a plethora of benefits, not the least of which being improved speed and reduced server loads. This article will explain how to set up a simple caching system, and will also address when and where caching might not be appropriate.
She shares her “six lines of glory” that cache the resulting HTML page (after all data has been pulled from the database and rendered) into a cached file with output buffering. On other side of things, there’s another script that, based on the page requested, checks to see if a cached file exists. She also modifies it slightly to include a timestamp so things aren’t just cached forever.
There’s also a recommendation in the comments of the post to use the APC caching extension that’s already built. Of course, this can only really be used if you have access to install it on the remote machine (not an option on things like shared hosting).
In this recent post to his blog Juozas Kaziukenas looks at one of the features in the next major upcoming release of PHP (5.3) – lambda functions (anonymous functions).
Only some days ago PHP.net introduced 5.3.0RC1 version, but future features have been known for quite a while. Namespaces and lambda functions (+ closures) are most anticipated, because they’ll increase flexibility and good-looks of code a lot. Today I’m going to try to prove why lambda functions are so useful.
He looks at what lambda functions are and one of their more apparent uses – sorting. He gives an example working with information about authors and their books, sorting them by publisher and title.
Following up on the previous part of his dependency injection series (the first part), Fabien Potencier has come back with this second look at the development technique asking if you really need a dependency injection container in your scripts.
In the first installment of this series on Dependency Injection, I have tried to give concrete web examples of Dependency Injection in action. Today, I will talk about Dependency Injection Containers. First, let’s start with a bold statement: Most of the time, you don’t need a Dependency Injection Container to benefit from Dependency Injection.
A dependency injection container is a wrapper around classes/libraries that need certain types of objects and settings to make them work correctly. This wrapper gathers together the information the object inside needs automatically without the user of the library having to worry they’ve missed something. Several code examples are included showing an application both with and without the container.
The Scienta ZF Debug Bar is a plugin for the Zend Framework for PHP5. It provides useful debug information displayed in a small bar at the bottom of every page. Time spent, memory usage and number of database queries are presented at a glance. Additionally, included files, a listing of available view variables and the complete SQL command of all queries are shown in separate panels (shown configured with 2 database adapters):
The Zend Developer Zone has a new article that will interest developers still looking to make the jump from PHP4 to PHP5 (you know who you are) with Informix support. Zend Core can help.
There are many business web applications written in PHP4 that use the Informix module for data access. PHP4 is no longer supported and as a result will not be issued any more fixes or releases. Since version 5.2, the Informix module is no longer available for the PDO module. In this article I’ll to describe how to compile and install the Informix module on the Zend Core 2.5 (PHP 5.2.6)
The tutorial helps you set up your environment and build/install the Informix module to be plugged into the Zend Core stack. Activation is as simple as going into the Zend Core admin tool and enabling the extension. A sample script is included to test the results.
Its also noted in the comments that there’s a PDO driver for Informix that can be pulled from the PECL extension repository.
The PHP.net site has made an announcement about the project’s involvement with this year’s Google Summer of Code:
nce again we are happy to announce our involvement with the Google Summer of Code project. Be sure to check our program at this years GSoC. We invite everyone to look at the list of ideas for this years GSoC, and get involved. Students are welcome to propose their own ideas, and we will consider all applications that are received before the April 3rd deadline.
The list for this summer includes projects like an Automatic Code Checker, creation of some Benchmarks (for the language), improvements to PHP-GTK and the creation of an online editor for the PHP.net manual documentation. If you have a proposal to add to the wiki, please submit it by April 3rd, 2009 to be considered.
In this recent tutorial from NETTUTS.com they show how to create a “better login system” that supports a bit of access control functionality to even further secure your site.
Net.tuts+ has published several great tutorials on user login systems. Most tutorials only deal with authenticating the user, which allows for two levels of security: logged in and not logged in. For many sites, a finer degree of control is needed to control where users can go and what they can do. Creating an access control list (ACL) system will give you the flexibility for granular permissions.
They walk you through the database creation (user information), coding the ACL and user authentication classes, how to check a user’s permissions and how to create a user admin screen to allow for easy maintenance. You can find the complete source of the tutorial here.