International School of Engineering Web Software development Development Decoded
Home Products Allmostapp Testimonials About Us
one pix   one pix   | |
PHP  
Bookmark and Share
Add to Technorati Favorites

Writing enterprise class code in PHP

This entry is part 1 of 3 in the series Recipe for Great PHP Programming
Many people assume incorrectly that open source languages like PHP are not suitable for serious applications. The reason for this misconception lies with the coder’s discipline rather than any
inadequacies of the language.

Most PHP coders are used to building small applications and hence miss out some simple yet crucial guidelines needed for serious enterprise class applications.

Let us look at it this way:

Typical web based applications on static sites are small.

Let us say you can write 25 lines of code in an hour. Say, your typical web application (a complex form) has 50 lines. Now, assume that you did not plan well and hence had to write 50% extra code. Your new code has 75 lines and takes an extra hour. Neither the length of the code nor the extra time is objectionable.

But, typically enterprise applications are much larger. Average enterprise application has 50,000 lines of code. Now, if you are as bad as you were before, you will write 25,000 lines of extra code! Well, the 1000 extra hours is a lot of cost and further maintenance is that much more taxing.

This is why planning and adhering to coding guidelines and standards are crucial in enterprise application development.

In this tutorial series, we will discuss the aspects you must consider in planning, and will provide simple tips, guidelines and best practices that will help you write enterprise level code in PHP efficiently.

Balance Scalability and Efficiency

The first step in planning is to ensure that you balance scalability and efficiency. The applications you build must be scalable in two ways - one, they should be able to handle large number of users and amounts of data. Second, they should be able to be extended, enlarged and reorganized easily.

You can achieve good scalability in PHP applications by using procedural and object oriented code carefully.

Generally the more abstraction (OOP) you add, the easier it becomes to add new functionality. Too much abstraction, however, may hurt the performance - this is one of the reasons to keep using procedural code wherever it is most appropriate.

One good place to be procedural for example is your controller layer. Do you really need an object to check which action argument is coming by GET? Many frameworks insist on having objects everywhere and because of that they need object loaders in their controller (which, of course, is an object itself). It’s much quicker to directly instantiate the object you need with a procedural call than to wrap this call in yet another object and method.

celeroo-smiley Celeroo Frame is a lean, flexible and transparent framework that helps you use procedural and objected oriented code carefully. Learn more about Celeroo Frame and download for free.

Maintainability

The next step in planning is to ensure that your web applications are easy to maintain, i.e., to support, fix, debug and change. Scalability and Maintainability are often in conflict:

  • More procedural code created for better performance may require more time to support.
  • More abstraction layers created for better functional scalability may require senior, experienced and better programmers to understand and support.

Your coding must be structured in a way that such conflicts are avoided.

In addition, good documentation and commenting can help solve both problems.

Best results are achieved when the conflicts are solved by architecting the application well, by following good coding practices and by judiciously combining procedural and abstraction coding.

In the next article, we will list out coding guidelines and best practices that will help you with the above.


Next Article in this Series
Coding guidelines and best practices



Discussion

Comments for “Writing enterprise class code in PHP”

 
OUR PRODUCTS
Celeroo Req 'n Spec
Smartest Way To Manage Requirements And Changes For Any Software Project   more
 
Free Trial Req 'n Spec
Celeroo Builder
Cheapest And Fastest Way To Build PHP Applications   more
 
Free Trial Builder
Celeroo Frame
Lean, Flexible And Transparent MVC PHP Framework       more
 
Download Frame

Subscribe to "Allmostapp: Empowering BAs to Build Apps from Ideas - Swiftly"

We will NOT share your info with any third party. PERIOD.
 
right-bg-img right-bg-img
  Who We Are | Contact Us  
  All Rights Reserved. Copyright © 2008 - 2017 International School of Engineering. Celeroo’s Blog and Training Center . Entries (RSS) Search Unleashed wordpress-email-newsletter-plugin-for-double-opt-in-subscription G Lock Powered by WordPress Theme by The Masterplan