You are here

Using PHP For Interactive Web Pages - Conclusion

Author(s): 
Andrew G. Bennett

The World Wide Web was conceived as a way of linking together resources from computers all over the world into one seamless web. This means that programming for the web is a different experience from traditional programming. One aspect of this is that, since the web is designed to link together many different resources, it makes sense to use many different tools to create interactive web experiences for users. In some ways, this is forced on developers. Even a basic set of tools for web development would include some image editing software to prepare images for the page, in addition to some way of creating HTML pages (possibly just a basic text editor). Typically a developer would also want sound and video software and programming tools to add interaction.

It is important to note the plural in the term "programming tools." Too many programmers, coming from a traditional background, think in terms of a programming language, rather than a set of tools. The glory of the web is that it enables many different pieces to work together. Different languages make different tasks easier and harder. It makes sense in this environment to use the tool for each task that makes that task easiest. For example, I have written (and maintain) an online homework system used by several hundred students a year, mostly engineers. I am often asked what language the system is written in. This is the wrong question, for the system consists of pieces written in five different languages: HTML, PHP, SQL, JavaScript, and Java. Each language was the best solution to the need for a particular feature in the system.

This approach of using multiple languages often raises questions about maintenance. Using just one language supposedly makes it easier to maintain a site, since the maintainer, who will eventually be someone other than the developer, will have to master only one language. Furthermore, the maintainer will have to track new versions of only one language and will have fewer compatibility issues to worry about. This is a false savings, however. Using the right language for each task leads to simpler and more easily maintained code than stretching the abilities of one language to its fullest.

The real requirement is that we quit thinking of programmers as people who have mastered one language. No one would expect a plumber or a doctor to understand how to use just one tool. Both are expected to have mastered a range of tools and techniques to use when appropriate. In the same way, developers need to have mastery of a range of programming tools. Fortunately, my experience with undergraduate programmers is that they have picked up on this and are quite comfortable switching tools as needed.

This specialization of tools also has advantages for the non-expert. Some mathematicians enjoy programming, but not all. But even mathematicians who don't want to master Java or some other language may want to get some specific interaction into a class web site. It is much easier to learn just enough of the correct tool to accomplish a task than to master programming in Java or C or Perl or whatever language is currently popular. For many situations, I have found PHP to be the correct tool.

Andrew G. Bennett, "Using PHP For Interactive Web Pages - Conclusion," Convergence (December 2004)