{
    "href": "/post/2014/06/03/legacy-refactor-question-what-about-singletons/",
    "relId": "2014/06/03/legacy-refactor-question-what-about-singletons",
    "title": "Legacy Refactor Question: What About Singletons?",
    "author": "pmjones",
    "markup": "html",
    "tags": [
        {
            "href": "/tag/legacy/",
            "relId": "legacy",
            "title": "Legacy",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        },
        {
            "href": "/tag/php/",
            "relId": "php",
            "title": "PHP",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        },
        {
            "href": "/tag/programming/",
            "relId": "programming",
            "title": "Programming",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        }
    ],
    "created": "2014-06-03 15:36:10 UTC",
    "updated": [
        "2014-06-03 15:36:10 UTC"
    ],
    "html": "<p>In <a href=\"http://paul-m-jones.com/archives/2667\">my talk</a> and <a href=\"https://leanpub.com/mlaphp\">my book</a> on refactoring legacy PHP code, one of the early steps is to start removing globals and replace them with dependency injection (not a container, just injecting dependencies by hand.)  I addressed the use of the <code>global</code> keyword and the <code>$_GET</code> (et al) superglobals, but I did not address singletons directly. I had a Reddit correspondent ask about singletons recently, and how to refactor away from them; I answered on <a href=\"http://www.reddit.com/r/PHP/comments/277id9/legacy_refactor_question_what_about_singletons/\">Reddit</a>, where you can read the full conversation.</p>\n"
}
