The Application Controller and Reflection

As applications grow in size they generally end up having one or more large conditional statements. These become unwieldy and difficult to maintain. Surely there must be a better way—and there is. It is called reflection and it is used in the ApplicationController/command module in the preceding example. Before looking at the command module code again, let’s take a look at what reflection means.

Reflection is a methodology by which the behavior of an application can be modified at run time based on its current state. That may sound difficult, but imagine if large if statements could be disposed of completely and the code just “knew” what it was supposed to do. If this is the case, then reflection is being ...

Get Oracle Database Ajax & PHP Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.