Helping ordinary people create extraordinary websites!
GET OUR NEWSLETTER
Your Email:
 
Blog Feed

Posts Tagged ‘code reuse’

Before you code…

Sunday, January 27th, 2008

So, you’re about to build an entire web application in PHP. You’ve worked out how you’re going to do it, you’ve got a general idea what it’ll look like, maybe you’ve even chosen a framework (if you don’t have any to choose from, find some). Before you go any further, take a step back and run through this checklist.

  1. Plan. Do some design mockups, work out what functionality will go in what classes. You can never plan enough, and good planning can save you days of code rewriting later.
  2. Research. This is probably one of the most-forgotten areas of project planning. Chances are what you’re building has been done before, so do a bit of research on existing applications similar to yours. Consider any problems you may encounter and see how other applications handled these challenges. SourceForge is a great place to start.
  3. Future proof. Depending on your application, this might not be terribly important, but consider what technologies are being used at the moment and may start being used. This article has a few suggestions. For example, maybe in future you’ll add a microformat-export function, and your code needs to be structured differently to support that?
  4. Don’t reinvent the wheel. Most developers I’ve seen simply don’t practice this enough. Sure, you’re using your framework for some common tasks, but many people assume they’ll need to write a lot of their own code for complex routines. Before you start, check out PEAR and PHP Classes.
  5. Set some timeframes and get into it! Now that you have a good idea of what you’re going to build, and how you’ll make it happen, set some goals and get coding!

5 essential development facts every PHP developer should know

Thursday, January 24th, 2008

There’s always a bridge between textbook knowledge of programming - syntax, procedure etc. - and the real world knowledge that you get from actually developing real applications. Here are five things every PHP developer should be familiar with before they begin developing web applications in PHP.

1. Frameworks
Frameworks are arguably one of the most important areas of PHP development. With no single accepted way of developing web applications in PHP, a number of open source frameworks are available, helping you code quicker, more consistently and more effectively. Some of the best include CakePHP, Symfony and CodeIgniter. A lot of the frameworks also follow the MVC design pattern, which you should definitely be familiar with should you ever have to work on code that follows it. After a while, you may even feel inclined to create your own framework to meet your needs.

2. Templating engines
If you’re not using a framework that enforces a specific design pattern, chances are you want to be using a templating engine. Whether you create your own or using one of the existing options (like Smarty), a templating engine allows you to entirely seperate your code logic from your HTML interface code (and associated CSS/JS/etc.). This considerably simplifies your code, allows quick and easy modifications to the actual front-end of your application, and makes it easier for non-developers to modify your application’s visuals.

(more…)

Code reuse in PHP frameworks

Wednesday, January 23rd, 2008

Code reuse: a great boon for web development. With large repositories of PHP code out there, from snippet archives to class databases, PHP is arguably one of the best languages when it comes to existing reusable code.

Of course, it isn’t nearly that simple. Everyone writes code differently; different naming conventions, different approaches to achieving common tasks (e.g. configuration), even different ways of interacting with the code (functions, classes static/non-static etc.). The problem is compounded when you start using a framework, with the intention of enforcing some basic convention - convention which your existing code libraries may not follow.

(more…)


Blog Categories Blog Archives
Advertise with Us!



Tutorials Scripts Web Hosting Developer Manuals
Resources