. Updated Daily. Editions SDA India   SDA Indonesia
BUSINESS ENTERPRISE SOLUTIONS ARCHITECTURE INFORMATION SECURITY WIRELESS & MOBILITY DATA & STORAGE DEVELOPMENT HARDWARE













News

Friday, 27 April 2007

Code As Data: Reflection in PHP

 

 

O'Reilly's ONLamp.com web site features a new tutorial that concentrates on the Reflection Application Programming Interface (API). The article also provides illustrative examples of using 'code as data'.

An interface must be built to allow the user to define each test. This could be done in a number of ways, but implementing it with an Ajax object seems to make most sense. The user can be presented with a three-level menu of classes, methods, and tests. He can then choose to edit an existing test or to add a new one. Using the JavaScript prototype library makes building an Ajax application to do this reasonably simple. We just need to create a PHP backend that can encode the data in a useful format (in this case, raw HTML), and then some JavaScript code for the user interface, the tutorial reads.

According to the tutorial, once the user has selected a class and method to work with, he will be presented with a list of tests that have been defined. He may edit an existing test, or create a new one, in each case the procedure is the same. A HTML form will be presented to allow entry of each of the parameters and the expected results. This data will then be sent to the server, to be written in the XML datafile. Ideally, the user should be able to delete, clone, and reorder tests. A more complete implementation would allow the user to set parameters for the object constructor, as well as set session, get, and post options.

 

More Info

 
 
print save email comment

print

save

email

comment

 
 

Search SDA Asia

Free eNewsletter

SDA Asia Magazine Free Download
 
 
 
Copyright @ 2009 SDA Asia Magazine - All Right Reserved Privacy Policy | Terms of Use