So, you've got a little website you're working on as a side project. The requirements are pretty simple but there are a few pieces, maybe internationalization, feedback forms or even a shopping cart that sound like they're going to need some server-side programming. Being the geek-ified programmer that you are, you start evaluating what tools and bits of knowledge you can bring to bear on this problem. What should the database look like? Should I use ASP.NET or something like Python or PHP for the dynamic parts?
It is easy to start building a monster this way. If you think about it, most of the features above can be built with simple programs, javascript and a completely STATIC website. No dynamic content, no server side scripting at all (well, at least not for you).
"So what?", you ask. Well, static websites have several advantages over dynamic ones:
1) They are SIMPLE. Static websites are easy to build and debug. There's really not a ton of tricky things that can happen when the page you store on the server is exactly the same as the one that gets rendered in the browser.
2) They are FAST. Static web pages can be cached by browsers and web proxies. This improves performance for the end user and reduces the load on the web server.
3) They have no STATE. If you want to update the site, you don't need to migrate the database. If you want to back it up, just keep a copy of the html. If you're site gets big, scaling it up is just a matter of a load balancer and some more servers.
4) They are generally CHEAPER. Many hosting providers charge more for dynamic content and databases. A static site needs neither of these. Of course, you might be uploading more static content to the server, so disk space could become a consideration.
Of course, none of this helps you solve the issues mentioned above. You still need that feedback, internationalization and shopping cart. A lot of that can be provided without resorting to server-side programming.
Feedback: There's an amazing variety of stuff that can be built just using cloud service these days. Uservoice.com for example, is a great solution for adding user feedback to your site using a little block of HTML and some javascript. Theirb smallest offering is free and is still pretty customizable. If you're fussy about the URLs looking like they're all from the same site, you can opt for their paid version and they will allow a DNS CName record to point your users to your uservoice site.
Internationalization: If you're building an e-tail site these days, it's tough to ignore the international market. You could build some crazy database-driven resource lookup solution, or, you can simply generate the site on your local computer and upload the files to the web server with no dynamic content at all. That might sound a bit confusing at first, so let's take a step back and go through an example.
You're getting ready to start selling your gourmet jelly beans overseas. In fact, you've discovered that there's a HUGE market in France for jelly beans, so you decide to translate your site into French to better target this market. You could just make an /fr directory on your web server, copy the website into it and change all the English to French (assuming of course you speak French, which as another issue entirely). The problem is if you decide to alter the HTML of the main English site, you're going to have to copy the changes over to your French site as well. If you have a dozen different languages, this gets hairy pretty fast. Instead, consider building the site with some unique strings in place of your descriptions. Maybe something like JELLYBEAN_DESCRIPTION_SOURAPPLE. Then write a script in the programming language of your choice to copy the site into the /fr directory and replace the dummy string with the real content in French (or English, or Italian, etc). Once you're ready, run your script, build the site and upload the whole thing. Of course, you will still need to check and make sure the text looks ok and doesn't get cut off anywhere, but you need to do that if you're building a dynamic site too.
Shopping Cart: Shopping carts are a really common reason to add back-end scripting to a site, but there are tools that will allow you to put this in the cloud as well. Paypal has a nice little forms-based API that will allow you to host an entire shopping cart with them. You can even brand the shopping cart page so that it matches your site's look. You won't get the kind of flexibility you would get from a customized cart, but it's quick, easy and pretty inexpensive. (Disclaimer: Apologies to those of my friends out there with a really deep-seated hatred of Paypal. They were just the easiest example.)
It doesn't solve every problem, but you can do more with a static site these days than most people would think. They can be a lot easier, faster and cheaper than a dynamic site and can save you boatloads of work and headaches. It's at least worth strong consideration before diving into a pile of database and server-side coding.
Subscribe to:
Post Comments (Atom)


0 comments:
Post a Comment