FACTOID # 75: Two-thirds of the world's executions occur in China.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

FACTS & STATISTICS    Simple view

  1. Select countries to view: (hold down Control key and click to select several)

     

     

    Compare:

     

     

  1. Select fact or statistic: (* = graphable)

     

     

     

  2. (OPTIONAL) Compare to statistic: (both need to be graphable)

     

     

     

  3. View result as:

     

       
(OR) SEARCH ALL encyclopedia, stats & forums:   

Encyclopedia > Facade pattern

In computer programming, a facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can: HTML and JavaScript in an IDE that uses color coding to highlight various keywords and help the developer see the function of each piece of code. ... Illustration of an application which may use libvorbisfile. ...

  • make a software library easier to use and understand, since the facade has convenient methods for common tasks;
  • make code that uses the library more readable, for the same reason;
  • reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system;
  • wrap a poorly designed collection of APIs with a single well-designed API.

The facade is an object-oriented design pattern. In computer science, a library is a collection of subprograms used to develop software. ... Object-oriented programming (OOP) is a computer programming paradigm in which a software system is modeled as a set of objects that interact with each other. ... In software engineering, a design pattern is a general repeatable solution to a commonly-occurring problem in software design. ...


Facades are very common in object-oriented design. For example, the Java standard library contains dozens of classes for parsing font files and rendering text into geometric outlines and ultimately into pixels. However, most Java programmers are unaware of these details, because the library also contains facade classes (Font and Graphics) that offer simple methods for the most common font-related operations. It has been suggested that this article or section be merged into Object-oriented analysis and design. ...


Examples

Java

The following example hides the parts of a complicated calendar API behind a more userfriendly facade. The output is:

 Date: 1980-08-20 20 days after: 1980-09-09 
 import java.util.*; /** "Facade" */ class UserfriendlyDate { GregorianCalendar gcal; public UserfriendlyDate(String isodate_ymd) { String[] a = isodate_ymd.split("-"); gcal = new GregorianCalendar(Integer.valueOf(a[0]).intValue(), Integer.valueOf(a[1]).intValue()-1 /* !!! */, Integer.valueOf(a[2]).intValue()); } public void addDays(int days) { gcal.add(Calendar.DAY_OF_MONTH, days); } public String toString() { return new Formatter().format("%1$tY-%1$tm-%1$td", gcal).toString();} } /** "Client" */ class FacadePattern { public static void main(String[] args) { UserfriendlyDate d = new UserfriendlyDate("1980-08-20"); System.out.println("Date: "+d); d.addDays(20); System.out.println("20 days after: "+d); } } 

External links

  • Description from the Portland Pattern Repository
  • Description by Vince Huston
  • [1] Java Facade patterns

  Results from FactBites:
 
Encyclopedia4U - Facade pattern - Encyclopedia Article (238 words)
In computer programming, a facade pattern is one of dozens of design patternss which are currently in print.
A design pattern is useful because part of the effort of documenting a design has already been accomplished.
A pattern is independent of the implementation language.
Memento pattern - Wikipedia, the free encyclopedia (304 words)
The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo by rollback).
When using this pattern, care should be taken if the originator may change other objects or resources - the memento pattern operates on a single object.
Classic examples of the memento pattern include the seed of a pseudorandom number generator and the state in a finite state machine.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.