Knowing when to say no

As a freelance developer sometimes it's tempting to take on every bit of work that comes along. But a short term gain now is not always in your long term interests.

Some projects are not well thought out/ rely on existing code or have too many strings attached.

Not well thought out projects

Sometimes I'm asked to quote on building a site like website X. Or quote on a project after a 5 minute conversation.

This is never enough to go on. At least you want some sort of written up project brief which you can turn into a workable spec which outlines all the pages and functionality therein. At best you might even be given a sitemap or detailed project plan. The more information the better, because once a quote is agreed there can't be any room for misinterpretation. Otherwise the project will drag on and on and become less and less profitable.

Projects that rely on existing code

You should take extra care when taking on a project that relies on existing code. If the project was done by a previous developer - make sure you have a good look over the code and see what condition it's in before you commit. Sometimes it's quicker and easier to redo a site than it is to work with badly written code. This will also help avoid any security issues with existing code and make the whole project a lot easier to maintain.

The other type of projects with existing code are those that rely on drupal/ mambo etc or other off-the-shelf systems like shopping carts.

In some ways these systems are worse. They are inflexible, require more hacking, often low-budget and a nightmare to maintain. I personally avoid them like the plague.

The only exception I make to this are forums like phpBB which are self-contained and can be cordoned off from the rest of the website.

Too Many Strings Attached

Don't compromise on your policies without serious considerations. Don't back down over your payment terms and read contracts very carefully before agreeing to them. Make sure you reserve the right to re-use code that you've developed. And don't agree to any personal liabilities.

That's it for now, feel free to leave a comment.

23/06/2009 permalink | Posted in web development | 6 Comments »

Separating PHP from HTML

Very often PHP coders will output HTML like so:
'; foreach( $links as $link=>$title ){ print '

  • '.$title.'
  • '; } print ''; ?>
    This causes the following issues:

    It's harder for web designers to work with
    Tthe code won't display properly in dreamweaver design mode. And designers will need some knowledge of PHP and good knowledge of HTML to be able to edit it.

    It gets in the way of syntax highlighting
    Syntax highlighters will just highlight the printed line as one big string. They will not be able to highlight the different tags and attributes. So the code is much harder to read.

    It gets in the way of code-assist
    Code assist or intellisense won't be able to help you with your HTML because it will be treating the code as a string much like with syntax highlighting.

    You have to watch out for quotes.
    Any singe quotes will need to be escaped like so \' . This can be time consuming if you are dealing with lots of text and it's also something that most web designers who are working with your code won't be aware of.

    So what's the answer. Well here's how I do it.

      $title ){ ?>

    This approach involves a few more PHP tags but it solves all of the above issues. It works better in IDEs, is easier to read and maintain and helps keep PHP and HTML separate.

    06/06/2009 permalink | Posted in web development | 3 Comments »

    Bookmark and Share

    About me

    Adam Jimenez is a freelance web developer who has been professionally developing websites since 2000.

    Find me