If you've programmed presentation logic in a PHP application you've likely dealt with include a good amount. When designing applications that have common UI it is a good practice to extract common parts of the UI to their own script files. The problem with simple includes is that they share scope. This makes includes difficult to reason about, shown in the following example, even if you know yourguess.php isn't going to halt, you don't know whether "Hello World?" will get printed, or some other string, or perhaps a notice error that temp is not defined:


Using includes can lead to spaghetti-code where you must understand the entirety of every include before you can understand a single script that uses includes. Included files which expect certain variables to be available (perhaps $title is used to fill in the <title> tag) require the includee to wade through the script and determine which variables to have available in the context. For these reasons Recess, as of version 0.20 encourages not using includes in your templates and instead using Assertive Templates.

Assertive templates are a name given to a certain style of template: one that asserts the presence and type of every input variable at the top of the script. Here is an example:


Layouts and Parts use Assertive Templates to address the problem to make presentation logic more predictable. Here is a similar snippet to the first example using the Part helper: