Archive

Archive for March, 2009

Five common PHP design patterns

March 30th, 2009 Gertjan 2 comments

Design patterns are just for Java architects or at least that’s what you may have been led to believe. In fact, design patterns are useful for everyone.

The core concept behind design patterns are simple. Over their years of developing software, developers found certain patterns of solid design emerging, just as architects designing houses and buildings can develop templates for where a bathroom should be located or how a kitchen should be configured. Having those templates, or design patterns, means they can design better buildings more quickly. The same applies to software.

It’s difficult to demonstrate the value of patterns using small examples. They often look like overkill because they really come into play in large code bases. That’s not to say that you shouldn’t use patterns in small applications. Most good applications start small and become big, so there is no reason not to start with solid coding practices like these.

The article handles 5 common PHP design patterns

Read more…

Creating a MySQL Database Class Using the Singleton Design Pattern

March 27th, 2009 Gertjan No comments

When creating a database class using mysql, we would create a class, and call it’s constructor in the script.

One potential problem with this approach is that each time we create a new database object, we allocate more and more memory to those operations. In some cases, it might make sense to do it that way, but a lot of times we only need one instance. This will help keep things organized and save memory.
Read more…

Categories: PHP Tags: , , , , ,

Building an interactive map with jQuery

March 18th, 2009 Gertjan No comments

To make a map as engaging as possible, there needs to be smooth animations and crisp graphics.  Traditionally such a map would require the use of Flash. Joel Sutherland tried to avoid Flash whenever possible, so he began to consider how the map could be accomplished in jQuery.

There were a number of advantages of using jQuery over Flash:

  1. Updates were Easy: Since the map was going to be a visual representation of html, it would be easy to update the data with a CMS.
  2. Content was Search Engine Friendly: Since all of the data was represented in html, it would be easy for search engines to index and spider the content.
  3. Architecture would be naturally layered: All of the data would be stored in a database by the CMS.   jQuery and CSS would then take the html content and display it appropriately. 

His biggest concern using jQuery was performance.  An important requirement of the map was that the map should zoom when switching between areas.  In Flash this would not be a problem, since transformations like these would be executed at a very low level on computer hardware.  This is not the case with jQuery, instead the DOM would need to be manipulated and then displayed. Fortunately this turned out not to be a problem in the end.

Link: Building an interactive map with jQuery instead of Flash

Data Recovery Software