Hacker News new | ask | show | jobs
by grandalf 4178 days ago
more realistically:

app.php

   <?php
    // logic and state here

    include 'some_other.php' // modifies or adds state in unknown ways

    // more logic

    $some_variable = 3; // does the include below depend on this? who knows.

    include 'yet_another.php' // expects state, who knows what
                             // also modifies state

    echo $state; // not sure if we can remove/replace any of those includes and this will be as expected.

   ?>

The includes are being used like sloppily defined function calls which do a muddled combination of rendering and state modification.

The same can be found in Rails in partials.

Also, in Rails, helpers are essentially crippled presenters that have access to lots of effectively global state and thus cannot be reused.