Design Patterns
A delegation pattern is used for encapsulating generic functions within a single class instead of creating subclasses for specific needs
A mixin pattern is used for adding a dependant class as a parameter to a function that has relevant content
A composite pattern is used for defining methods that operate the same way on a single element as on a group of elements of the same type, such as a function which expands a folder to show its contents regardless of its child or parent folders
A chain of responsibility pattern is used for encapsulating sequential function calls between a group of dependant functions with robust exception handling at each step, such as a login verification or mailing list function
An iterator pattern is used for encapsulating functions which loop through large data structures using a chain of responsibility pattern, for example a search and sort function for a queue of movies
A facade pattern is used for wrapping complex functions within a single object that performs implicit operations within its subclasses, such as date formatting or regexp parsing
A prototype pattern is used for cloning a base class to implement its functions in child classes without creating subclasses or new instances for every call
A singleton pattern is used for encapsulating a function so it can only be called a single time
An object literal pattern is used for encapsulating functions within static objects instead of making them part of the global namespace
An abstract factory pattern is used for encapsulating related functions within scalable objects that use implicit or included parameters to call relevant subclasses, such as a button class that uses object detection to call browser or OS specific functions
A factory method pattern is used for encapsulating functions with parallel uses that depend on shared input parameters, like producing different graphs from the same raw data by specifying input data types based on which subclass is called.
A parameterized factory method pattern is a factory method where a subclass is called as a parameter of the class object instead of using dot notation
A builder pattern is used for creating a complex object through combining simple independent objects and subclasses, such as using a roof, floor, door, wall, chimney and window object to create a house object
A lazy initialization pattern is used for encapsulating instances of an object within a data structure and only creating new instances when unique conditions are met. This is useful for things such as caching dynamic data which only changes when tabs are clicked or preloading data that is only displayed when pagination is requested
The observer design pattern is used in application development to observe the state of an object. The best way to think about it is the publish / subscribe model. In this pattern you have one object that is being observed (the subject), and a group of objects watching the subject called observers or listeners. This pattern is an excellent example of loose coupling, because our classes can interact with very little knowledge of each other.
Data Access Object(DAO) is a pattern that encapsulates CRUD(CREATE, UPDATE, DELETE, READ) operations in an object that accepts arguments of a specific type that map to database column types within the database methods defined by the implementation. If the mapping is correct, the underlying database statement executes, and returns either the requested result set data structure or a success flag. But hard coding the data type of the storage format using DAO requires refactoring the code each time the schema changes or argument types need to be flexible.
An alternative solution to DAO is to create an object which checks an XML schema that defines the data model to get the data type of a column or XML, XLS, or CSV file.
Dependency injection is a pattern where the container passes objects by name to other objects, via either constructors, properties, or factory methods.
A master page pattern is an abstraction of HTML template code created by caching output buffer strings in a series of variables in order to store CSS links, script tags, HTML content, streaming media calls, and other URL specific references in a single settings file which maps the variables to a single template file instead of individual header, footer, navigation, and layout templates.
Communication Breakdown: Text/Images, Style/Layout, Actions/Reactions
User preferences:
1. User wants to save interesting snippets of text/images, search for related text/images, and advertise their collection of text/images, and share their opinions of text/images with each other
2. User wants to text/images to be easy to read and quick to load/save. User wants to sort text/images to fit their priorities, filter text/images to fit their mood, and edit text/images to share and personalize their messages
3. User wants actions to be simple yet powerful. User wants reactions to be fast and familiar. User hates complex and repetitive actions. User hates slow and irrelevant reactions. User wants consistent directions, relevant demonstrations, responsive support, specific tips, and optional instruction manuals.
API DESIGN MAPPINGS
Map database name to an object name(SQL object)
Map database actions to object functions(CRUD)
Map user save/search/advertise/share options to profile data and individual widgets(AJAX)
Map text/image font/color/background settings to user profile data and CSS widgets
Map user sort/filter/edit functions to profile data and Javascript objects(DOM)
Map directions/demos/support/tips/manuals to UI breadcrumbs/movies/forums/faqs/help
FRAMEWORK DESIGN MAPPINGS
Map text/image search function to database insert or file output function
Map sort/filter/edit functions to action/reaction functions
Map advertise/share functions to view customization functions
A design that is not limited to specific mechanisms for data filtering is itself usable in multiple applications. We call this design the Composite Filter pattern, which integrates the design of several well-known design patterns: Strategy pattern, Filter pattern, and Composite pattern.
References
Parasitic Inheritance and the Decorator Pattern
A jQuery Plugin Development Pattern
Using Delegates to Implement Event Handling
Introduction to Design Patterns
Personal Perspective on Design Patterns
http://www.selectorweb.com/patterns_all.html
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.