PradoSoft

Design patterns tutorial

From PRADO Wiki

This article is a draft under early authorship and is rapidly changing. Please consider suggesting your changes on the discussion page.

Written by David Strauss

This article is a work in progress and is organizationally incomplete.

Design patterns are a means of organizing an application's components. Without good use of design patterns, application development and maintenance become time consuming and trouble prone. Developers should carefully consider design patterns before writing too much of an application's code.

This article is not intended to teach developers design patterns. It is far too broad and complex a topic to fit in a wiki article. However, this article does explain how to map popular design patterns to the PRADO framework.

PRADO and design patterns

Unlike many frameworks, PRADO does not dictate a design pattern for developers. Most frameworks (like Rails) are based on MVC. MVC is an excellent pattern for web applications, so developers should seriously consider it for their PRADO applications. Because MVC is so predominant among web applications, this article focuses on using MVC with PRADO.

An MVC approach

A good MVC approach separates its model, view, and controller components, but it doesn't need to do so using directories.

Without any directory separation, PRADO already distinguishes controllers from views. ".page" files are views. Classes extending TPage or a decendant are generally controllers.

The concept of a model isn't inherent in PRADO, at least as of version 3.0.x, but programmers can create a directory under "protected" to store models. To keep with the convention set by the blog demo, call this directory "Common." Models in PRADO generally extend TModule or a decendant.

Personal tools
Your user name:

Your password:

MediaWiki