PHP Code Builder – A Fair Evaluation

If you have been to #linux-india over the past one week or so, you could have spotted an enthusiastic new comer trying his best to publicize his creation called as PHP Code Builder.

This is a web based software which will generate PHP code for the corresponding design you do by selecting a few options shown. To be a bit more precise, say you want the PHP code for a login page, you can specify the database name, table name (which stores the login information) and click the “generate code” button, it generates the code for a login form. So, they actual intention is to make the development of PHP code easier for standard modules like login and database interaction.

Now, I know people will ask the question “why make a code builder to create PHP codes when writing one is not a much tougher job?”. Indeed, I do not think writing a PHP code for a login page is not as much hard as making a dosa by ourselves, from my 4 month real time experience of writing PHP web app. It is a new idea, a cool one, I agree. But, how it is going to help people ? May be if it can mature into a product that can handle a bit complex issues like session management, cookies and complex database operations. But, it is premature to say its not a useful product as its just a new born baby and I can not expect to ride a bicycle.

I got a mail whereby the creator of the software under consideration asking for some publicity. So I decided to lend my blog space for a post on their software, just my 2 cents to the cause. I visited their product page which looks very clean and simple. It looks like a web site of a product in full demand, kudos to that. Surprisingly there was a demo to test what the product can do. I jumped into getting some experience, so I can write something about it.

Clicking on the ‘Demo’ tab takes you to a page, where an almost empty screen with “Have fun using PHP code builder DEMO.. If you like it don’t wait to download it. :)” welcomes you. With opening my eyes little bit wider :-o, I discovered there is a side menu of available demos.

The first demo is of queries to the MySQL DB, where you have 4 buttons for generating insertion, deletion, selection and updation query strings. I click on the generate button and viola, I am given the query “insert into details set id=’$id’, detail=’$detail'”. what I actually expected was a PHP code to do execute the same query to a DB.

I decided to check other demos to find some real PHP. “Code for Sessions”, ahem, the topic which took a week or so for me to code a pretty basic session management in PHP in my beginning days as PHP dev. I just wanted to see the code again as I have forgotten it with 8 months of Python coding. It asks me to select the DB, the table, number of session variables and depending upon this number select the variables from a drop down list. I select things and click the generate code button with all enthusiasm to see a PHP code and I g0t this at the end,

//log in table code in html
<!--Login table for session -->
<table align="center" width="375">
<tr>
<th colspan="2" align="center">Log-In</th>
</tr>
<tr>
<th align="center"> </th>
<th align="center"> </th>
</tr>
<tr>
<th align="center">Username:</th>
<th align="center"><input type="text" name="id"></th>
</tr>
<tr>
<th align="center">Password</th>
<th align="center"><input type="text" name="detail"></th>
</tr>
<tr>
<th align="center"> </th>
<th align="center"> </th>
</tr>
<tr><th width="182" align="center"><input type="submit" name="Submit" value="Log In"></th>
<th width="183" align="center"><input type="reset" name="reset" value="Reset"></th>
</tr>
<tr><th colspan="2"></th></tr></table>
<!--session table ends here-->

I started to ponder whether am I seriously looking at a PHP code builder or HTML generator ? Where is the damn “<?php” and “?>” at least 😦

I checked other stuffs to find some PHP code somewhere and returned with to /dev/null. As a few things weren’t in demo, I had to check the source code after downloading it. Also, I do not want to make a prejudice and jump into flaming people for the absence of PHP code getting generated.

After the downloaded I jumped in, at last to see some PHP code 🙂 The source directory contains a dozen and half PHP files, most with the name db_<something> in it. I checked a few files to understand what they were, with my slowly succumbing knowledge of PHP. I decided I have to give a go and moved the app to my webhome so I can run it.

The first page asks for my MySQL username, password and hostname. I entered it, wishing the tables to get created. Rather, I got an error saying it did not have enough write permissions to write into a file. It made me curious to look into the file actually intended to create the db stuffs. What it did was, create a file or rather write the data into a file. Am not sure how secure is it to write MySQL username, password into a plain text file and have it in a web server. I couldn’t proceed because it couldn’t write into the file.

But, I am left with a few questions and concerns. First, where is any PHP code getting generated ? If the answer is “You did not check the downloaded code fully”, then why it is not there in the demo. What it gets generated in the demo is HTML and not PHP. If there is some PHP generated around, please let me know where it is.

Not moving into an offensive mode, I feel its still in a pre-mature state to go public, especially without any real PHP code. For example, the form demo generates the tables for two fields and not even a button for the form, where hell is the <form> tag to give some meaning to the form ? If a form is all about HTML for two labels and input text boxes, please name the app as HTML builder. No, am not meaning to hurt you or criticize you.

I will just put the my feeling about it as “a kid’s weekend project”. If am really serious I can write the same app in Python in a day or maximum a couple because what I need to do is just print the HTML, or even the PHP code for that matter.

Ok, if you ask me what it should be, it should be something like you have a canvas, you have objects for HTML elements like what you have in a GUI designer tool like Qt designer. You can drag and drop elements into the canvas and finally it can generate the code. Now, you can either have it as HTML generator or PHP generator. The latter will generate the appropriate PHP code for the form logic to work, like validation a text field and POST/GET methods for the form. The form validation can be guided by asking to select from a list of validation options like “only characters, only numbers, email address…” and validation the element for the same.

This is what I will accept as a decent PHP code generator or builder, even for a first release. For this, you can make use of Ajax to make the drag and drop features. Please, do not show just HTML generation while calling it as PHP Code Builder, because it will turn off people who will never mind to check your app during further releases and improvements. And I hope this is not your Final year project 😦

If you have anything to add on or justify, then add it to the comment section for this post. 🙂

Advertisements

3 thoughts on “PHP Code Builder – A Fair Evaluation

  1. Ok, I found the reason for the error during the database creation. I have changed the permissions for the files and I get this error,


    Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/phpcb/db_use_pas.php on line 147
    Warning: fclose(): supplied argument is not a valid stream resource in /var/www/phpcb/db_use_pas.php on line 148

    The error message ends up saying the headers have been already sent but it is tried to be modified later.

  2. I don’t seriously see a utility for this, if and when this thing works. A 1.0 product that can’t even do what it’s supposed to do shouldn’t be looking for publicity.

    Plus, as a lover of semantic code, the blatant use of tables makes me sick.

  3. Pingback: Celeroo | What users want in their Web Software Development Tools

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s