Archive for 2010

Blog Seperator
December 21st, 2010

How Does Content Affect SEO?

This might be a silly question to some but you’d be surprised how many people don’t realize the effect that every feature, application, functionality or word has on search engine results.

For starters, the term content encompasses so much more that just the copy you see on the home page or about us page. It includes everything from what you want a visitor to learn about you to how you want them to learn it and what it takes for them to actually “get it”.

SEO (search engine optimization) has definitely evolved over the last several years. Content used to affect SEO through the miraculous keywords that were strategically placed in just the right part of the sentence and just the right amount of times on a page. And suddenly you appeared at the top of the SERP (search engine results page). Not anymore. The point here is that, as I said before, content is so much more than just copy.

Google’s Ranking Algorithm

Now optimization is about meta data, link building, pay layout and design, and compelling content. As you can see from the pie graph, keywords only account for fifteen percent of what makes a page trust worthy and relevant to Google.

Your site ranks well if it’s easy to use, easy to read, easy to navigate and easy to understand. In terms of content, search engines look for content that provides direct, actionable information that is relevant to a query, pleasing both the search engines and the human reader. Now this is looking at it from a very high level, but is what the content needs to accomplish.

December 21st, 2010 in SEO, Content Development, Marketing | Comments (0)
Blog Seperator
December 7th, 2010

Open Your Source

Pros and cons of making your application base publicly accessible

Introduction
Having spent a significant amount of time working with third-party APIs, application libraries and lifeBLUE’s own internal PHP framework, I noticed several trends in terms of usability and improvability. Obviously adherence to programming standards, organization and quality of code are huge factors that come into play for these categories, but I wanted to focus on the idea of open-sourcing application frameworks and how it can make or break your software. In this entry I’ll discuss the pros and cons of opening your source up to the community, and how you can manipulate community questions and solutions to improve upon your application model.

The Future Of Frameworks
Having an open-source solution is becoming a huge selling point for several applications, frameworks, and languages. Even Microsoft has considered open-sourcing C#, one of the strongest and most desirable web development languages available. Open-source projects arise from community demand for modular solutions, which are easily modifiable to one’s particular needs. These open-source frameworks are then subject to extension which means they have to be developer friendly, or at least have a considerable amount of documentation and community backing for it to be successful. This requires additional documentation, coding consideration, and an active support presence. Seems like more work right? Sure there are sacrifices and drawbacks to having a successful open-source project, but you have to realize you are trying to appeal to a very specific target audience. The audience: web developers.

Popular Demand
What is the most popular web development language around? Most would argue PHP. Is that because it has a widely accepted, well tested, extensive framework behind it? No, actually it’s lacking in that department. Is it because it holds up to programming standards? No. If anything, it goes against a lot of them! So why then is it so popular?

First of all it’s free. Second it’s open-source. Being free makes sense, but how does being open-source contribute to its popularity? It’s actually very simple when you look at it from the perspective of computer scientists. Extensibility and individuality! Give me another language library that provides just enough to do what I need and let me write the rest myself the way I want to write it.

The amount of time and effort it takes to understand PHP as a whole vs. C#.NET or Java is significantly less daunting, and most web applications require a mere fraction of the code present in an out-of-the-box .NET or Java install. The only drawback to this kind of thinking is that it puts a lot of responsibility on the consumer… or is this really a blessing in disguise?

E-Socialism
How you handle feedback is critical. Disregarding this free error and usability reporting is not only negligent on your part, but is also a slap in the face of your consumers. If you take the time and effort to make a well developed framework, make it public to the community, and take into consideration the feedback from that community, they will praise you and your product. Developers want to use your application because they know it works well and that they can rely on you and the rest of the community to continue improving upon the framework as well as answer their development questions. If anything, you will get free user testing from REAL end users with REAL business requirements. Obviously you can’t implement every single feature or address every single request, but the idea is to pick and choose which items are deemed necessary by the community or coincide with your own business plans.

Popular, But Is It Profitable?
Too many software development companies fall into the trap of thinking they can only make money by providing actual software solutions, yet there are free open-source projects that are obviously receiving funding from somewhere. Where does this money come from? Support plans, seminars, training sessions, donations, extension packages, consultant and development services, etc.

Stop thinking about how to sustain your business and start thinking as a community leader. You can focus on obtaining new users and businesses, retain fans and followers, and can more appropriately budget your business based on reliable, recurring income – not just the possibility of making a big sell.

Wrapping Up
Lastly, I would like to give kudos to my favorite open-source frameworks that have done a great job taking community feedback and delivering real, intelligent framework updates. If you are looking for good, potentially free software for your web project, I recommend you look up and consider some of the following open-source frameworks. No, they didn’t pay me to pitch their product I just have a lot of respect for their work ethic and business direction, and therefore support their product. In addition I will give a rating on the learning curve necessary to use the product, 1 being simple and 10 being difficult.

Note: Before you decide to turn to these as your web solution let me assure you that in no way will these frameworks be a one-stop solution for most web projects. You will have to spend a significant amount of time just to learn the frameworks, let alone construct and develop your own designs, functionality, and interactive components. This is where you should look for an interactive agency (such as LifeBLUE Media), a web development group, or even a freelancer to do development work. The good thing is that if you can find a team or individual that understands these open-source frameworks you can save yourself a considerable amount of time, money, and effort while coming up with a better, more stable result.

Umbraco, “the friendly cms”
Learning Curve: 5 out of 10
Umbraco is one of the leading ASP.NET content management systems out there. Having used it on numerous projects and having modified their source code myself, I can safely say that they have constructed a strong and versatile system that any competent developer can utilize to achieve a wide range of content delivery.

You still need to know the basics of web development including HTML, CSS and JavaScript. And if you are looking for any advanced functionality you will most likely need to know ASP.NET and take a little more time learning Umbraco’s class library, which is well organized and takes what I would consider to be an appropriate amount of time to understand and utilize properly. They provide a large amount of online support, have lengthy yet pertinent documentation, and have a great forum for feedback, Q/A, and bug reporting. Not to mention…IT’S FREE!
For more information visit - http://umbraco.org

jQuery, “write less, do more”
Learning Curve: 3 out of 10
If you have been in web development for any extended period of time, you’ve probably run across the jQuery framework. jQuery and other similar frameworks are quickly redefining interactive web components in a staggering manner. Unfortunately for proponents of Flash, the power and flexibility of these client-side scripting libraries is leveling the playing field for web animation. In addition jQuery has strong yet simple AJAX functionality which is becoming a standard web technology for web applications. The open-source nature of jQuery has allowed for the development of numerous jQuery extensions and plugins, some of which we have worked with and developed ourselves. jQuery is also free and is a powerful resource for developers no matter what the project requires. You will still need to know basic JavaScript, and finding the exact behavior you desire may take a little bit of digging online, but every adopted function and/or plugin is well documented on jQuery’s support website. If you can read it, you can implement it.
For more information visit – http://jquery.com

Honorable Mention:
Magento - Learning Curve: 7 out of 10
Widely accepted PHP based ecommerce solution
For more information visit - http://www.magentocommerce.com/

December 7th, 2010 in Nerd Matrix, Web Development | Comments (2)
Blog Seperator
November 23rd, 2010

Attitude is EVERYTHING

We live in an age of intellectual capitalism where thought leadership, total team engagement and a vested interest by all are the ingredients to success. In other words, attitude is everything.

Most businesses cannot propel themselves to new heights with the outdated practices stemming from the manufacturing age of the early 20th century. Business in the interactive world faces the same dilemma. Our ability to produce outstanding results, while differentiating ourselves from the competition, is a direct correlation to the attitude and effort of every team member involved.

Now, why is attitude so pivotal to an interactive agency? I was hoping you would tell me! But it doesn’t look like that can happen, so let me provide a few of my own insights into why attitude is so important.

First of all, the breadth of technical capabilities in our industry is endless. Overwhelming, actually. The world of Internet-based languages like HTML, CSS, Javascript and Flash combined with the application languages of Java, .NET, Actionscript and PHP, create ample opportunity develop something compelling and interactive online. Having a can-do attitude to first try and understand these elements as well as implementing wherever possible is key.

Don’t limit yourself and/or the ideas you bring to the table. Shoot high and create awesome design and interactive concepts. Remember that outstanding results come from infinite possibilities in the world of web.

Another point to consider is that the market is simply undereducated. While many clients think they are experts just because their office suite provided Photoshop, unfortunately you have to “nicely” convey to them that, in deed, they are not. Though you appreciate their opinion, even if it irritates you, you can’t let the fact that they want to also look like experts undermine the quality of your work.

It’s comparable to the fact that because we own a car, we should all be NASCAR drivers…no thanks. The work, knowledge, and expertise that goes into great interactive design and development is just as complicated as building an F-16 or even the Golden Gate Bridge. Not everyone has the skills to do this.

Yesterday’s mechanical and electrical engineers, scientists, and architects are today’s online programmers, designers and information architects. We have an opportunity to connect, understand, and educate clients to ultimately establish a long term relationship. We must be empathetic to the market and likewise seek to evolve cost effective means of education and ways to engage customers in our process.

Finally, the industry is young. At the age of 29 I feel like a senior citizen. Yet compared to the traditional advertising and marketing agencies who have years of experience, our learning curve is much different. The industry is young and those that service it are even younger. The industry expects you to really jump in and teach yourself what you don’t know. Overcome the obstacles of business as if you’ve been in the field for 25 years. Be ready to do what it takes to survive. That tenacity only strengthens your team.

Ultimately, attitude is the difference maker with an interactive agency that claims to be cutting edge. Constantly seeking ways to improve the quality, delivery, and effectiveness of your product helps offer results that are completely unique in every instance.

An attitude reflective of engagement, innovation, and “can do” combined with a desire to constantly learn and expand your skill set, sets the bar high. This approach creates a successful business model. Open new doors for yourself and your business.

November 23rd, 2010 in Web Design, Web Development, Web Business Basics 101 | Comments (0)
Blog Seperator
November 11th, 2010

ELEMENTS + PRINCIPLES = THE BASICS OF DESIGN

I ask myself, is there a language to graphic design? Are there governing “rules”? What makes a good design, good? How can the pros make it look so easy, yet when I try designing, it looks unorganized, full of clutter, unsettling, boring, and something I like to call digital vomit?

Okay, enough with the questions, here are some answers.

There are two basic governing bodies in design: elements and principles. Everything in a design falls into these two buckets, and more often than not, a design utilizes several of both, tying each one back to another.

First learning the vocabulary of design and then realizing how to practically and creatively apply the pieces, is part of what separates a professional from an amateur. It’s the skillful use of the elements and principles in design that bring our concepts to life.

Entering semester one of design school…

The elements of design are the basic building blocks of any idea. To make the concept of “elements” simple to understand, think of them as the physical attributes of a design, such as line, shape, or texture.

The principles of design can be thought of as the application of those design elements, or how we actually use them in a design. A lot of this skill comes from natural intuition, but it’s crucial to be able to understand the philosophy behind design. You must be able to speak intelligently about the concepts and creatively use them to build and rationalize impactful designs.

Let’s talk about the basics of design elements:

Line: used to define shape, the path of a point, has many characteristics of its own such as direction, width, and length.

Shape: a perceivable area, when a line intersects itself to create a contained and defined area, can be geometric or organic, any positive shape creates a negative shape, edges of shapes create lines.

Type: if graphic design is the synthesis of content and form, then we must have type! Type not only communicates with written words, but it is also a powerful design tool and can be used to create other design elements, such as shape and texture.

Texture: a surface quality, can be real (not in the realm of web design) or implied, the actual or simulated tactile quality of an object in a design.

Value: the range of lightness or darkness of color.

Color: also known as hue, has three properties - chroma (pureness of hue), intensity and value.

Space: the illusion of depth, the areas around, between, and within a design - both positive and negative.

Now, let’s talk about the basics design principles:

Balance: the concept of visual equilibrium, equalizing visual weight of elements, can be symmetrical or asymmetrical.

Scale: overall size of an element(s), proportional relationships of design elements, can be used to create dominance and emphasis.

Unity: relating design elements, the sense that everything in the design belongs, creating harmony.

Pattern: keeping your design to a certain format, using similar elements throughout the design to create cohesion, can also be thought of or described as rhythm.

Movement: the illusion of movement, suggests action and/or direction.

Contrast: juxtaposition of opposing elements, refers not only to the difference of color but also scale and direction, used to create interest, focal point, movement.

Emphasis: the focal point of a design, used to create a visual hierarchy of elements and/or information.

This list is not comprehensive but it at least gives you the basics.

Thinking a little more in depth about the philosophies, it’s easy to point out that principles of design are a little more complicated than elements of design. In my opinion, that’s because principles are more conceptual and objective, while elements are more tangible and subjective.

Certain interpretation of principles can obviously mean multiple things seeing as the definition of anything objective can be blurred. For example, using pattern in a design creates “rhythm”, yet many times you will even see rhythm as being defined as its own principle. Confusing, I know, but don’t pull your hair out. Seeing examples of these elements and principles being used in application should only help you.

So let’s take a look-see at a few design pieces, and I’ll point out some of the dominant factors and how they compliment each other, or tie back to one another over and over again.

Here are a few logos. They are simple and easy to understand.

Logo design with line

If you had to guess the dominant design element being used in this piece, what do you think it might be? Line maybe? Yep, it’s line!

I love the beauty and simplicity that the basic use of line can create. As for a dominant principle, this piece is a perfect and simple example of symmetrical balance. That’s easy, right?

Here are a few more, great, logo designs that utilize simplistic beauty from the concept of line alone (well okay, and type too):

Daily Jazz logo

Simple line logo with green background

simple line logo with texture

Now, notice how the use of variations in the width of the line creates interest, direction and drama.

Okay, moving on to some more complex examples, we go to another logo…

Jaguar logo

First of all, how cool is this logo? Let me just answer for you. Really cool! There are some great elements and principles working together here. Watch how the pattern - or repetition - and close proximity of these shapes form such a tight unity within the design, that it creates a texture. The dark background provides a really nice contrast as well.

The Bauhaus Exhibit

This poster design relies heavily on the use of a simple line, which creates shapes and textures. The use of space, more specifically negative space, plays an important role in this piece as well. The watercolor washes behind provide color, contrast, texture and shape, which helps define the negative space shapes. It has asymmetrical balance but feels like the weight of the elements are evenly distributed.

magazine cover design

This magazine cover design is another good example (though less obvious than previous examples) of line usage, creating a heavy sense of movement and direction. The edges of the geometric shapes are where the use of line really plays out in this piece. Bright primary colors add to the sense of movement by creating contrast, not only with each other but also with the darker less saturated background.

This also creates contrast is the mix of smooth vs. gritty texture. The use of negative space that is made by the runner’s silhouette creates emphasis - again with contrast and scale - and becomes a focal point.

Typography plays a large role in this design by displaying information, being used as a design element, and by giving emphasis to certain pieces of information.

So can we begin to see how heavily the relation of design elements and principles rely on, and play off of, each other?

magazine table of contents design

The table of contents design in this magazine shares many of the same elements and principles as the cover (creating a nice unity and rhythm to the overall design of the magazine), but the dominant element here is line by way of shape, which creates definite direction and movement. Secondary principles created by the use of line are repetition, rhythm, and unity.

beastie boys magazine design

What dominant elements do you see in play here? If I had to pick three, I’d say color, shape, and type. Texture is another big one being used. The swirls at the top create nice shapes with playful movement while the large scale and white color of the text, which creates contrast, helps to give the type emphasis. Texture lends unity to the piece. The amount of contrast and space around the text vs. the swirly shapes at the top, give it an interesting balance.

Okay, okay, for the sake of not getting into novel territory (because I could do this all day), let’s take what we have learned so far and see what elements and principles are being utilized in the following examples. Have fun! And be sure to study – you never know when I’ll be issuing a pop quiz.

magazine design

creative shapes and images

magazine design

no age design

global technology, complex line design

complex design, arms

obsesion, design

deep thought 2010

shigeru ban, paper tube

November 11th, 2010 in Web Design, Fun, Web Business Basics 101 | Comments (1)
Blog Seperator
November 3rd, 2010

It’s the most Wonderful time of the year…

November. It seems like October ends and November 1st marks the official start of the holiday season. Overwhelming really, with the smell of cinnamon sticks, the sea of green, holiday lights strung from every house and building in the neighborhood, and of course “Jingle Bells” playing the moment you open the doors of any retailer. But is it too early to “Deck the Halls”?

I scoped out a few holiday sites last year, but it was in December when the Christmas season was in full swing. Each year, it seems more and more that Christmas trees and gift wrap are being put on the shelves just as early as the pumpkins and costumes. So to start off the last two months of the year with cheer, I want to do a little net surfing to see who has already kicked their sites into high gear, and already shouting fa la la la la for 2010!

First stop, the malls. I mean, this is where you’ll be spending most of your time over the next several weeks, right? So they need to get an early start at reeling in the crowds.

Aside from presents, I’d say the next best thing is food! Sure they’re already getting your attention with the delicious photography, but are they upping the ante by adding some holiday spice?

Stores will soon be catering to the masses. So how quickly are they hanging the mistletoe from their websites?

Is it just me, or does the holiday season scream “get crafty”? Depending on your project timeline, you might want to get started right away. Are your craft resources ready for ya?

From what I’m gathering, it seems like it’s never too early to start spreading the holiday cheer! Have you stumbled across any other websites that are bringing in the holidays? Share them here!

November 3rd, 2010 in Marketing, Web Development | Comments (0)
Blog Seperator
October 28th, 2010

A Persona by any other name

As the use of personas has become a de facto standard in the web development process, there appears to be a missed opportunity with interactive web design. The application of user personas, or behavioral archetypes, in the design process offers many benefits, and can help guide decisions on a project. It also holds stakeholders accountable to maintaining user-centered design. Unfortunately the gross application of personas does not leverage as one of the greatest assets of interactive design. And maybe it should.

shyam10-27_1.jpgThe need really stems from the fact that personas have a multiple personality disorder. The two obvious examples apply to Amazon and Netflix. A persona for either of these brands takes on multiple personalities, some of which are never accounted for. For instance, when I rent the movie Iron Man on Netflix, I am fulfilling my archetypical behavior. But when I use the same account to rent the movie Dora the Explorer for my niece, my persona just falls apart. On Amazon I may make a purchase decision as a husband, brother, father, or as a business person. These multiple personalities are often not accounted for in the user experience planning phase, and what you are left with is a mess of recommendations and misunderstanding from the service provider’s perspective.

A similar concept also applies to social networks. Senior user-experience researcher at Google, Paul Adams, recently gave a presentation called “The Real Life Social Network”, where he demonstrates how the current paradigm of social networking fails to truly understand user relationships by pooling all of your relationships into one mass. Clearly the complexities of human relationships extend much further than those considered during a user experience exercise, and the tools we are given in the interactive world are merely a gross over simplification of a user.

shyam10-27_2.jpg

The application of user personas in design suffers from the same unintended consequence. In the online space the terms of “friend” and “recommendation” have become meaningless. If these online interactions were turned into real world experiences, we would suffer from moving from one socially awkward situation to another. There are ominous terms like the “Semantic Web” which hope to help alleviate these socially awkward situations, but still remain a light at the end of the tunnel.

The opportunity we have yet to explore in the interactive space is how to appropriately qualify our customers each time they visit our website. Great interactive experiences avoid creating socially awkward situations for the user by understanding the context of a use case first. Before you give personas carte blanche in developing your next interactive design project, be sure that you are truly taking care of your users, and their multiple personalities.

October 28th, 2010 in Web Design, Content Development, Web Business Basics 101 | Comments (0)
Blog Seperator
September 21st, 2010

Logic Busters - Part 1: Singletons

Identifying and eliminating double instantiation of objects and single-synchronous-request “caching”

“Logic Busters” is a continuation of the “Schema Busters” series with an emphasis on business-logic practices that you can implement when engineering your web-applications. The concepts discussed in this series will differ from the previous in that they are geared towards programming practices and tips as opposed to database schema and query design. In this first section we will discuss the concept of singletons, how to implement singletons, and efficiency gains from the utilization of singletons. Since singletons deal heavily with object management and objects have a tendency to be reflective of database entities I hope this subject will serve as a proper transition from our database studies into the realm of application logic.

What is a Singleton?

The singleton is a mathematical concept that simply states any instance of an object must be equivalent to itself and is universally unique from all other objects. If there were another object with the exact same properties it would be one and the same as the original. In programming it is quite possible and easy to violate the Singleton concept. Imagine instantiating two copies of an object and performing separate and distinct operations on them effectively make them unequal. This in turn destroys any possibility of maintaining object singularity.

Why use the Singleton pattern?

Before continuing let’s analyze the benefits and costs of such behaviors. Obviously being able to manipulate two copies of the same object independently provides great flexibility, but at what cost? An immediate concern rises in the situation of multithreaded or asynchronous environments (multitasking in laymen’s terms), where data integrity and symmetry can prove vital. This issue is best illustrated by looking at a concept called conflicting transactions which is more commonly associated with database transactions. Imagine that we have the following database table:

tblUser
userId login password email active

…and the following two transactions where the value of “@parameter-name-here” is passed at transaction call:

Name:
Trans_UpdateUserId
Description:
Updates the user id
Query:
UPDATE tblUser SET userId = @userId WHERE userLogin = @userLogin

Name:
Trans_UpdateUserEmail
Description:
Updates the user email
Query:UPDATE tblUser SET email = @email WHERE userId = @userId

If we are to run these two transactions independent of each other on a user with the below described data, we now have three scenarios:

User:
1. userId = 1
2. login = ‘JGFree’
3. password = ‘secret’
4. email = ‘jgfree@lifeblue.com’

Transaction Scenario 1:
1. Trans_UpdateUserId is run with @login = ‘JGFree’ and @userId = 2
2. Trans_UpdateUserId finishes
3. Trans_UpdateUserEmail is run with @userId = 1 and @email = ‘new@email.com’
4. Trans_UpdateUserEmail finishes
5. Final state of user:
userId = 2, login = ‘JGFree’, password = ‘secret’, email = ‘jgfree@lifeblue.com’

Transaction Scenario 2:
1. Trans_UpdateUserEmail is run with @userId = 1 and @email = ‘new@email.com’
2. Trans_UpdateUserEmail finishes
3. Trans_UpdateUserId is run with @login = ‘JGFree’ and @userId = 2
4. Trans_UpdateUserId finishes
5. Final state of user:
userId = 2, login = ‘JGFree’, password = ‘secret’, email = ‘new@email.com’

Transaction Scenario 3:
1. Trans_UpdateUserId is run with @login = ‘JGFree’ and @userId = 2
2. Trans_UpdateUserEmail is run with @userId = 1 and @email = ‘new@email.com’
3. Inconsistent behavior from here on out since both transactions will try to access same record at the same time.
4. Note that this inconsistency can also be caused by switching 1 and 2 of this scenario.

For the sake of our discussion we will disregard Transaction Scenario 3 since this kind of conflict is more appropriately addressed by Database Management Systems and Memory Access Systems and how they handle this kind of simultaneous access conflict, a concept that is not pertinent for us at this moment. The reason I use these transactions is to show that two copies of the same object, like the above user with the above described properties, subjected to two different transaction scenarios can result in different object states.
Now we should stop and consider that this behavior is either desirable or undesirable depending on your project’s technical specifications. If it happens to be desirable then we can disregard this entire study and get back to work (you time-thieving, blog-trolling slacker). Otherwise we can begin the implementation of Singletons to make sure that object state is maintained across multiple transactions.

Implementing Singleton objects and how they work

Implementing a Singleton requires little additional coding, but a strong consideration for consistency. The basic concept is to statically store an instance of whatever object we are creating a singleton out of, and upon redundant load calls we simply reference the static singleton object. Most object-oriented classes have a constructor or instantiate method that loads all of the properties of an object based on its identifier. When initially called, we should check if the identifier matches that of our singleton object. If so we return the singleton object. Otherwise we continue loading the new instance and replace our singleton object with the resultant object. In a similar manner, every time we make a change to our object we must also update the singleton.

Immediately we can see how this kind of structure can reduce our database calls significantly. Imagine that we load the same instance of an object three times throughout the span of a request. Utilizing the singleton concept we now reduce our database use by 66%. We can expand upon this idea by allowing for Singleton Dictionaries which is simply a static collection of objects mapped by their identifier. If we are loading all users three times throughout the span of a request, we are now producing significant traffic (dependent on your user pool obviously). Since it is semi-difficult to include code in this blog and the code I would provide is available elsewhere, I will simply refer those interested to sites already containing examples of singleton use:

-http://www.developertutorials.com/tutorials/php/php-singleton-design-pattern-050729-1050/
-http://www.talkphp.com/advanced-php-programming/1304-how-use-singleton-design-pattern.html

Now hopefully your program does not require you to load every single user three distinct times in a single request. Singletons are extremely situational and are not your primary means of reducing resource use. An obvious place to implement a singleton would be for managing the object currently logged in since it often gets referenced multiple times in a page load. Look for these kinds of situations to implement this data structure.

Conclusion

Looking back at our example where we performed asynchronous transactions on a non-singleton object yielding different possible results, we can now see how a singleton would enforce the legitimacy of both transactions. Each transaction would update the singleton which would then be the result of both transactions as opposed to any kind of deviation produced by the order of transaction operation. Transaction 1 will now produce the same results as Transaction 2 since the userId is consistent for both transactions, Trans_UpdateUserEmail and Trans_UpdateUserId.

Singletons are a great data structure to consider when tweaking your application to maximize performance. They are not the answer to all of your resource management needs, but they serve their purpose beautifully. If you enjoyed learning about this data structure and how it can be applied, I encourage you to seek out other data structures as they have the potential to improve your site/application performance and reduce the complexity of your code. I recommend beginning with the “Current User” example I provided above, and then reevaluate your program to see where this kind of technology makes sense.

September 21st, 2010 in Nerd Matrix, Web Development | Comments (2)
Blog Seperator
September 13th, 2010

PHP Factory Design Pattern Part 1

For my next several blogs I’m going to be discussing a powerful PHP design pattern, the factory. Since PHP applications and the data structures they interface with are getting larger and more complex there is a need to streamline and simplify how these data structures are loaded into useful objects.

For example, let’s take robust CMS. A simple CMS has only one content type: a page. However, for more complex CMS systems you have multiple content types such as events, publications, and even products. Each one of these content types needs to have its own properties and methods that are unique to that content type. We end up with a problem. How do we deal with the unique needs for each type of content and maintain an efficient application?

It makes no sense whatsoever to include all of the properties and methods for every content type into a single class definition and database table. The class would be a behemoth. Once the object was loaded it would be a resource hog, eating up memory and processor power. On a small site with little traffic this might be ok, but any high volume CMS would grind to a halt under these conditions.

On the flip side, doing a new unique class for each content type is not much better. To request a piece of content then render it properly to the browser you would need to search across multiple classes and database tables. Not only that, because there are multiple tables, there could easily be URL and naming conflicts. Also, great care would have to be taken to ensure that all of these objects followed a common interface. If not, loading appropriate content could become a “switch case” and “if else” nightmare. Maintenance on that kind of system gives me the shivers just thinking about it.

Enter the factory design pattern. This design pattern lays out a few nice rules that simplify situations just like our example. First it would allow for a unified method for loading all content types, from one place. Second it would require consistency within all the classes. Everything would have to work the same way on a basic level, and the unique functionality would be in addition to that. There would be one central place where the core data was loaded, and then any extra information would be held in it’s unique storage medium, such as a database table.

First let’s look at what a factory is:

  • A factory is a class that is designed to load various types of objects that all share a common interface.
  • A factory class does nothing but load objects.
  • A factory intelligently decides what object should be loaded based on the parameters it is given.
  • Most often the objects a factory loads have a shared purpose.

Let’s look at what defines the factory design pattern:

  • Classes the factory loads are structured in a similar way so that they can be loaded using the same basic method call.
  • Classes the factory loads follow a unified structure, most often defined by a parent class or an interface.
  • Classes the factory loads do not need anything from the factory once they are loaded. The factory’s job is done.

As you can see, the factory pattern provides a means to load similar objects from one place. It is an extremely useful pattern within PHP web applications. In my next post I’ll provide some UML and coding examples to flesh out this useful design pattern.

September 13th, 2010 in Nerd Matrix, Web Development | Comments (1)