Oriented Web Development in PHP

2013 年 2 月 14 日3660

Aspect-Oriented Web Development in PHP

Jorge Esparteiro Garcia

Faculdade de Engenharia da Universidade do Porto

jorge.garcia@fe.up.pt

Abstract. Aspect-Oriented Programming (AOP) provides another way

of thinking about program structure that allows developers to separate

and modularize concerns like crosscutting concerns. These concerns are

maintained in aspects that allows to easily maintain both the core and

crosscutting concerns. Much research on this area has been done focused

on traditional software development. Although little has been done in

the Web development context. In this paper is presented an overview

of existing AOP PHP development tools identifying their strengths and

weaknesses. Then we compare the existing AOP PHP development tools

presented in this paper. We then discuss how these tools can be effectively

used in the Web development.

Finally, is discussed how AOP can enhance the Web development and

are presented some future work possibilities on this area.

Keywords: Aspect Oriented Programming, Web Development, AOP,

PHP

1 Introduction

As web applications become more complex, it becomes harder to separate in-

dependent concerns. Aspect oriented programming (AOP) [9] paradigm offers

various ways to separate concerns which can help us to reduce time and com-

plexity of applications. AOP better separates concerns than previous method-

ologies (object oriented, procedure, etc.), thereby providing modularization of

crosscutting concerns [10].

Despite AOP being a programming paradigm that can be used with the most

common object oriented languages, much of the research has been done on devel-

oping standalone applications and little has been applied to Web development.

Therefore, we believe Web development can be improved using aspect-oriented

techniques.

AspectJ [8] is one of the most popular AOP proposal tools that offers the

possibility to develop web applications using JSP (Java Server Pages). However,

nowadays PHP is becoming the most widely used Web scripting. PHP has an

edge over locked-in solutions such as JSP and ASP for most Web development

work because it is a cross-platform technology.

PHP is, nowadays, one of the best and most popular script programming

languages for innumerable web applications. Over 20 millions domains on web

1

use PHP as the web programming language [12]. Specially suited for Web devel-

opment, it鈥瞫 recognized as one of the most used programming languages in the

world.

Therefore in this work are presented the existing AOP PHP development

tools and is made a comparison of these tools showing their strengths and weak-

nesses on the web development. It鈥瞫 also discussed the impact of AOP Web

development with a language with such a wide-spread use.

The rest of the this paper is as follows. Section 2 gives a brief overview of

Aspect Oriented Programming. In Section 3 are presented the existing AOP

PHP development tools. In Section 4 is made a comparison of these tools in the

context of the web development. Section 5 concludes the paper and discusses the

future work.

2 Aspect-Oriented Programming Web development

AOP is a new technology for separating crosscutting concerns into single units

called aspects. An aspect is a modular unit of crosscutting implementation.

It encapsulates behaviors that affect multiple classes into reusable modules.

With AOP, we start by implementing our project using our OO language (for

example, Java), and then we deal separately with crosscutting concerns in our

code by implementing aspects.

Finally, both the code and aspects are combined into a final executable form

using an aspect weaver. As a result, a single aspect can contribute to the imple-

mentation of a number of methods, modules, or objects, increasing both reusabil-

ity and maintainability of the code.

Figure 1 explains the weaving process. The original code doesn鈥檛 need to know

about any functionality the aspect has added; it only needs to be recompiled

without the aspect to regain the original functionality.

2.1 Aspect-Oriented

0 0