Ask Freelock: Symfony?

Fri, 01/16/2009 - 08:32 -- John Locke

No, it's not a misspelling. Symfony is a framework for rapid development of PHP web applications.

Jim asks:

Our new programmer is suggesting that we use "Symfony" as a framework for future websites. He's very enthusiastic about it and so we're having him make a copy of an existing site using it. But he hasn't been able to effectively communicate to me the strengths of using a framework like this. What do you know about Symfony and what advantages are there for building sites using a framework like this?

My primary concerns are two: Will a client be able to maintain such a site (outside of incorporating a CMS) using Dreamweaver or Contribute? And, is a site created using Symfony really portable (if a client ever wished to move their hosting) or are they stuck only using hosts who support Symfony?

 Hi, Jim,

Symfony is a web framework, one of several dozens available. I think what you're getting at is what is a framework, and why should you consider using one? With an understanding of that, we can address Symfony specifically.

The short answers to your two questions are: 1. Probably not, and 2. Yes, if the person doing the move knows what they are doing. But there's a lot more to the story than that.

First off, what is a framework? It's a set of code libraries, often with code generation, designed to jump-start development of a project and minimize the amount of custom code required for a project. Frameworks are designed to create powerful code--helping you build interactive applications with a few lines. It's a bit like bringing in a cement mixer with one of those hoses to pour concrete, compared to mixing it yourself in a wheelbarrow--you can have the entire foundation for a pretty large application poured in a single day.

So why would you use one? To cut development of a project from months down to weeks, or weeks down to days.

The main question I would have for you is how much development do you need to do? A framework does not help you write marketing content to sell a business. It may give you a nice theme to start, but for the most part, a framework does not help you implement a graphic design in HTML or CSS. The main area a framework can help is when you are creating a site that interacts with its visitors. If you're creating a site to manage projects, or job listings, or products, or schedules, starting on a framework might be a solid way to go. You can definitely build a content management system on a framework, and design it exactly the way you want it to operate.

But why not just use a content management system? There are hundreds out there. You've already worked with Joomla, and Drupal is another fine choice. Content Management Systems go a step further than a framework--they provide a model and a structure that lets you start plugging in content immediately. They define a user model out of the box. The best have hundreds of thousands, if not millions, of users who have contributed improvements and add-ons back to the project.

I would only consider a framework if the project clearly does not fit in an already developed application. We're actually using Drupal as a framework-on-steroids for several projects right now--it provides a flexible enough structure that we can mold it into a surprising amount of purposes, and we don't even need our developers for a lot of the work. And it comes with a sufficiently powerful user and role authorization structure to meet any problem we've thrown at it.

Another characteristic of using a framework is that it forces you into a particular structure for the project. Most popular frameworks these days are designed around object-oriented design. Most support a variety of established design patterns, recipes for solving particular types of problems. And this can be a really great way to do green-field development. But one issue I see regularly is that someone new to programming finds a framework, thinks it's the greatest thing ever because they don't actually need to do much programming, and then get stuck somewhere pretty far down the line. We've rescued a few projects where the developer got stuck, and then just quit.

In experienced hands, frameworks are very powerful and effective. But they look so easy they lure inexperienced programmers into programming. This is not necessarily a bad thing--but it is risky. I'd rather have a programmer learn the fundamentals of programming, learn how to do everything possible to do with a language from scratch, with no framework or code libraries, before dumping them into a framework. With a strong understanding of what the framework actually does for you, and what the underlying issues in the language itself are, you can use a framework to best advantage (and choose a framework most appropriate to the project at hand).

So, all that said, what do I think of Symfony? It's actually a great framework. For a recent proposal, I asked our lead developer, Katherine, to check out a bunch of PHP frameworks to identify which one we should use. Symfony came out on top, as our first choice in PHP frameworks. However, we were able to do even better in that proposal with Drupal.

You're not going to be able to manage a Symfony site in Dreamweaver. Well, you could, but most of the workings will be pure code with no WYSIWYG output. You may be able to find an add-in to allow you to edit a template, but again, that's a risky thing to do. Done right, however, your customers should be able to manage the site directly in the site, with no other software needed beyond the browser.

Regarding moving to other hosts, you actually may have trouble running it on your server if you're still using IIS. It looks like Symfony depends on mod_rewrite in Apache. It does look like it will run on most hosts that provide PHP and MySQL, though some of the code generation parts may be tricky, and there are security issues around running on a shared host. See here for more detail.

In short, using a framework for a marketing-based site is a bit like using a pile-driver to push in a thumbtack. I do think you'd see some great benefits from offering a content management system to your clients, but if you're not programming the next Twitter or Facebook or Digg, I wouldn't recommend a framework.

Story Type: 

Comments

Symfony doesn't require mod_rewrite, and runs on IIS just as well as it does on Apache. mod_rewrite helps with removing the script name such as index.php, but you will still get pretty (SEO-friendly) URLs without the use of mod_rewrite.

Add new comment

  1. I recommend you use Linux for your server(s). Mine are so reliable, it shocked me that after years of Microsoft-based expectations, I have no complaints now after many many years experience with Linux servers supporting a mixed Win2K and Apple OSX workstation network. Freelock has really opened my eyes to what I should be expecting from enterprise software. Linux is simply much better than anything Microsoft has done, and even on Microsoft's best day, Microsoft is too expensive, too proprietary and too unreliable. There is just no reason to keep putting ourself through that grief, constant change, and endless high cost.

    George Roberston
    George Roberston & Associates

Need More Freelock

       

About Freelock

We are located in Pioneer Square, in downtown Seattle. 83 Columbia Street #401 Seattle, WA 98104  USA [P] 206.577.0540 Contact Us/Directions | Site Map Get Updates ©1995-2014 Freelock Computing