Increasing Developer Productivity
Usability, design, accessability are key for the user. For the developer, we worry about productivity. My time is valuable, just like the users. I don’t have precious minutes to waste on hunting for files, rewriting whole sections of code, or find a hack for a (free or not-so-free) CMS. I’ll try to lay out a few ideas that have helped me save time in my production work, as well as personal work.
Use Dynamic Pages
Server-side scripting is not as scary as some might think. Even working with databases these days can be done using a few short lines of code. The few hours it might take to learn the right commands and implement them are short compared to the days it might take you to change a whole folder of files. For you programmers out there, you know what I’m talking about. For those of you who don’t, resources are available to help you learn. It’s hard to find a host these days that doesn’t support <a href=”http://www.php.net” title=”Some are better than others, in my opinion”>one server language or another, so there’s no excuse not to learn, at least enough to save yourself time.
Use Include Files
Making modular code has probably been the most time-saving and productivity-increasing thing I can do. I use separate files for functions, classes, settings, actions, etc., all of which can be included into one dynamic page. To simplify it even further, you can include these files into one all encompassing file, and include that in your scripts. Something like this:
ignition.php<br />
<?<br />
include('includes/settings.php');<br />
include('includes/functions.php');<br />
include('includes/classes.php');<br />
include('includes/actions.php');<br />
?><br /><br />
index.php<br />
<?<br />
require('includes/ignition.php');<br />
//site content and script below<br />
?>
This makes utilizing these same file on other sites as easy as cut-and-paste. Only slight modifications to files are required instead of reworking entire documents. Including any site-specific information, such as URL’s, file roots, database settings, and the like, in one ‘settings’ file can make site transition a breeze, and increase your overall productivity.
Use URL Rewriters
Some web hosts do not allow for URL rewriting, but for those that do, this can make your website all that more attractive to search engines, and make your URL’s more human-readable and memorable. For those of you not familiar with URL rewriters (ISAPI_Rewrite for IIS, mod_rewrite for Apache), they take an incoming URL such as www.domain.com/automobiles/dodge/stratus and run it through a series of Regular Expressions, and spit out something like www.domain.com/automobiles.php?brand=dodge&model=stratus
which the server can understand. This virtually eliminates the need for file directory structures, and allows for minimal file counts. (I should mention that if you use this method, all local links, images, stylesheets, etc.
should be called by their full URL, not referenced locally.) My website utilizes a grand total of 9 PHP pages with with a handful of include files and a database. That’s it. When I make an adjustment to a page template, it’s updated everywhere immediately. And that saves me time.
There are countless other methods, and I’d like to hear some more, so bring them on. Let’s get this site update off our plate, and go lay on the beach for the rest of the day.
Post and Author Info.
Published May 19, 2004 by:
Commenting is currently off for this post.
So far there are 4 comments.
This is a great post. I have really enjoyed reading your posts, especially this latest entry. You have some great ideas and tips that I hope you continue to share with the world.
May 19th, 2004
Good fun.
To avoid a performance hit on Apache, only do this if you can mod httpd.conf, and not by using individual .htaccess files.
See notes/ forums on:
devshed
webmasterworld
apachefreaks
sitepoint
May 23rd, 2004
“Along with great power comes great responsibility.” Each of these points gives you the power to increase productivity, but can also give you the power to screw some things up, if you do them without thinking. That said, I doubt that you could crash a server using any of them. Always do as much research as possible before delving into new material. That’s just a given.
May 23rd, 2004
That’s very good advice. However, would it not be better practice to use the require_once construct in place of include?
August 11th, 2005