Articles about private

  • Get private variables & functions using function injection

    If you are familiar with OOP, you know that there are basically 2 types (scopes) of variables and functions:

    • Private: only available within the object itself
    • Public: also available to the caller, outside the object

    (There are other scopes as well but I leave them out to keep things focused in this article)

    To know what's available publicly, we can either read the documentation or use some functions like cfdump in Coldfusion.

    But what about the private ones? How can we know what variables and functions are available privately inside the object? I know there are many good reasons for things to remain private and I totally agree that is the good architecture. But there are times I want to know how the internal variables change, what values they are holding at runtime. This is especially useful for debugging purpose. Read full article.