Old Posts: Maxing HTML and PHP code

25 May

After working for about one year in website development industry of Pakistan I’ve realized a very serious issue. This may be happening in other countries as well, as I haven’t had worked with international organization, especially professionals.

The problem is maxing presentational logic with business logic. In simple words I would say maxing HTML with server scripting language like php, asp, coldfusion etc.
Here I would appreciate Microsoft professionals who have done tremendous job by developing Asp.net language. The way they have separated asp.net and html code from C# and VB.NET code is fabulous. However I would like to mention that in the beginning-in early versions of ASP.NET-the problem was there. However with the passage of time and introducing newer and more mature versions like ASP.NET 2.0 they have addressed lots of issues.
Before going into the details of problem mentioned above I would also like to comment about some companies who are providing open source solutions for languages like PHP etc. The contribution made by oscommerce (having the above drawback), zencart(I haven’t studied but heard that it is a bit mature shopping cart solution than oscommerce) and joomla(very nice and more mature content management system) to php cannot be ignored.
The most important contribution is made by those who have developed frameworks(MVC’s) like Zend, Symfony, cakePhp, mojave(lacking documentation and community support) etc. One cannot imagine how worthy and brilliant job they have done and how easier they have made work for lazy professionals like me.

Two months back I was introduced to mojavi by our company senior web developer. In the first few days I was exhausted and bored. However after developing a simple login application in mojavi I found it quite helpful. But things didn’t move forward coz of lacking documentation and community support.

I stopped working in mojavi but the virus of working in frameworks sneak in my heart and I started googling different frameworks.

Next few days I studied cakePhp, symfony and then zend, red their documentation, browse their community support sites and forums and also red articles about their differences.

Finally and luckily I selected Zend framework-This was because of small configuration overhead of zend framework than other frameworks.

After working in zend MVC I realized how easier it is to make a web application and how easy it is to extend and maintain existing one.

Now let me discuss the real problem which has made me sick since last few days.

After joining new organization 6 days back I was assigned a project for modification. The project was constructed in oscommerce. Boss was expecting that I would finish some small modification in few hours but I trapped in the middle and was unable to browser where modification needs to be made.

When boss arrived and asked me about the modification I was having no idea what to say and I felt a bit shy at that time. After telling him that I haven’t completed the modification he was a bit shocked and worried because he might be thinking that I was not a right person for the post I had been hired. He took me to his office and asked me about projects I had previously worked on. After showing him my projects he got satisfied but still I could see uncertainty in his eyes.

Why all this happened and why I trapped in the middle will I think clear the problem I have mentioned in the beginning..

As I have already mentioned that project was constructed in oscommerce so those how know or have worked in oscommerce will better understand the way oscommerce has been developed. Although they have separated php code form html up to some extent, however it is not as mature as joomla content management system or model view controller frameworks.

Well, oscommerce was not a big obstacle. The more irritating thing was the way previous programmer had implemented and constructed the pages. After working in office for about 10 hours I managed to complete some modifications but not entire.

When I came home, installed oscommerce and started doing the same modifications it took me minutes to complete them.

So I took some deep breathes and started thinking about whom to be blamed. But after thinking for about two hours I realized that no one could be blamed because client needs their projects soon, so developers only think about the construction not about what will happen in future if he himself or someone else try to extend or modify the project.

Lot of website have been made in similar scenarios and situations.

So as a professional one needs to be very careful while modifying the project.

Although professional developed application based on the client recommendations however I think we professional should think seriously about the future extensions and maintenance and try to make application both client and professional friendly.

Note : This article was written about one year ago.

2 Responses to “Old Posts: Maxing HTML and PHP code”

  1. Amir Bilal May 26, 2009 at 8:53 am #

    I strongly second the idea of choosing ZFW.

    ps; Nice blog…

  2. Shiro June 11, 2009 at 5:10 am #

    I would like to ask the opinion about how to code the PHP file with HTML
    I am new in PHP, and I found that there are two type of people code in PHP one is put everything in PHP
    <?php
    echo "”;

    echo “”;
    ?>

    all the html tag using echo or store in one $html

    another mechanism is mix with PHP and HTML

    I read a few article today, some of them said don’t mess up with HTML and PHP together but I don’t think this is possible in the presentation layer, it must be a need to call a PHP script there,e.g display a variable value there.

    Can PHP Guru have a start guide how to make a good practise with this? Thank you so much.

Leave a comment