![]() |
Is Your Site's Code Bringing Down Your ROI?By Joe Lucas It's a well known fact that good site design is crucial to site performance. What’s not as easily understood, however, is exactly what constitutes 'good site design.' In my job as a Sales Engineer at ClickTracks, one thing I encounter almost daily basis are web sites that have been poorly built from the ground up. What I mean by this is that in addition to ignoring the 'basic' good site design rules-- unique page titles, smart navigation, CSS, etc.--these sites are also missing strong coding techniques. If your web site falls into the above category, does that mean you are doomed to a life of less than optimal performance from your site? Not necessarily—there are things you can do to help provide your site with the solid foundation it needs. In this article, I'm going to highlight some basic tips that you can implement that will enhance your overall site performance, lower your costs, and deliver higher ROI. Choose your platform correctly How important is your site’s platform to its overall performance? In my opinion, it’s the most important thing. Platform choices include everything from your server architecture, to your programming language, and your backend data choices. You’ll want to evaluate a few things here.
You’ll also want to choose your scripting language carefully. If you decide to go with a PHP/Linux server set up, make sure that the language will really allow you to do what you want with the site. Would your overall goals be better achieved on a Java platform? Look at your development resources as well as the type of content you wish to publish. Object-Oriented Design is your Friend Most web languages now support some type of object-oriented design—and if this option is available to you, you should use it. Maintaining your site and pushing updates will be much easier if you make use of an object-oriented backend. If object-oriented design isn't available, you can make the best of the situation by taking advantage of file includes and a template-based design. Taking this approach is a viable workaround if an object-oriented approach isn't in the cards for your site. Let’s take a look at how includes and templates can improve the ease of maintaining your site. Consider the following example written in PHP <? $html=”Some Page content Here”; include “/footer.php”; That seemed simple enough. I’ve got a common header file and a common footer file. So, if I needed to make any updates to my footer or header I can easily do it in one file and have the changes propagate live throughout the site. But should we stop there? No way! Maybe we can do something similar with a common navigation include to make updates to the navigation much more efficient, as well. Let's check out the code for that: <? $html=”Some Page content Here”; include “/footer.php”; One additional line of code is all it takes to make that happen—excellent! The code above should be fairly easy to maintain while still allowing a good degree of customization. This is probably the easiest way of building a large site in PHP, but it’s not without its own limitations—think about things like unique page titles. In order to give each page a unique title, we either need to give up the header include and hard code the header information into each page (the least appealing and most time-consuming option) or we could make the code more complex in order to facilitate a dynamic page title. So what's the answer? By deploying an object-oriented approach to the site, we can overcome these obstacles while still maintaining a template-like design. Let’s revisit this example using an object oriented approach. <? Example of page.php: <? In the above code snippets, we’ve succeeded in doing two things: First, we've shortened the code that initializes each page, which means a lower overall file size and a faster load. Then, we've also created a central access point for updates. Now, no matter what needs to be done to the overall page layout on your site, you only have one place to go to make changes and push them live. You can pass in custom content, or in the above example, just a page ID which could be used to grab content from a database and put into the page. We’ve also then succeeded in being able to have a template design for easy maintenance, as well as preserving a unique aspect of each page. Optimizing your Code Another great way to improve overall performance is to optimize your code. If you’re pulling content from a database, are you using the right SQL query, or are you pulling a lot more information from the database and then going through everything to pull just the content you need? Are you closing your database connections after running your query? Do you have a lot of white space in your code that unnecessarily inflates the file size? Can you accomplish in 5 lines what you’re doing in 10? I’ve certainly been guilty of all of these in the past--writing good code is hard on the first pass. That's why, after you’ve deployed your site, it makes sense to go back through your code and see where you can make improvements. This is a concept called 'code refactoring'—and it plays an important role in ensuring you’re your site code is as optimized as possible. Is this all there is to know about improving site performance? Certainly not—it's just the tip of the proverbial iceberg. This is what it comes down to: Building a web site correctly from the ground up will impact every decision you will make for the lifetime of that site. Making the right choices early on will save money and improve the overall financial performance of the site. And after all, isn't that one of the goals you're after? ### Joe Lucas is a Professional Services guru at ClickTracks. Our Professional Services department offers one-on-one interactive sessions to help you with search engine optimization, campaign management, and web analytics. Contact Professional Services or call us 877-773-2249 (+831-621-6380 outside the U.S.). |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
