Sluggish database view? Materialize it!

The other day we were having some slow database view at our project. It was the main view of the new module we were developing, and it was slowing down the whole application to an unacceptable point. It was a rather complex view and could not be optimized much more. So, what was the solution we adopted? We materialized the view.

Regular views store just the SQL script needed to retrieve the data, and every time they are consulted the stored SQL query is executed. However, materialized views not only store the script, but the retrieved records as well, making it much faster.

Read the rest of this entry »

Software design patterns (IV): behavioral patterns

We’ve already been through a brief introduction to design patterns, and a description of the most important creational design patterns and structural design patterns. In this article we’ll take a look at the last category of design patterns: behavioral patterns.

Behavioral design patterns are concerned with the relationships among communications using different objects. They identify common communication patterns and provide a well-known solution to implement this communication, offering a higher degree of flexibility.

The most used behavioral patterns are:

Read the rest of this entry »

Software design patterns (III): structural patterns

We already saw what design patterns are and took a look at creational patterns in earlier articles. Today we’ll deal with the second category: structural patterns.

These design patterns are all about class and object composition. Class-creation patterns use inheritance to compose interfaces, whilst object patterns define ways to compose objects to obtain new functionality. All of these patterns aim to ease the design by identifying a simple way to realize relationships between entities.

The most common structural patterns are:

Read the rest of this entry »