﻿

# Aggregate pattern

An Aggregate pattern can refer to concepts in either statistics or computer programming. Both uses deal with considering a large case as composed of smaller, simpler, pieces.

Statistics

An aggregate pattern is an important statistical concept in many fields that rely on statistics to predict the behavior of large groups, based on the tendencies of subgroups to consistently behave in a certain way. It is particularly useful in sociology, economics, psychology, and criminology.

Computer programming

In Design Patterns, an aggregate is not a design pattern but rather refers to an object such as a list, vector, or generator which provides an interface for creating iterators. The following example code is in Python.mylist = ['apples','oranges','milk','eggs','flour']

for item in mylist: print "Mom, we're out of " + item + "!"

def fibonacci(n): a,b = 0,1 count = 0 while count < n: count += 1 a,b = b, a+b yield a

for x in fibonacci(10): print x

def fibsum(n): total = 0 for x in fibonacci(n): total += x return total

def fibsum_alt(n): """ Alternate implementation. demonstration that Python's built-in function sum() works with arbitrary iterators """ return sum(fibonacci(n))

myNumbers = [1,7,4,3,22]

def average(g): return float(sum(g))/len(g) #in Python 3.0 the cast to float will no longer be necessaryPython hides essentially all of the details using the [http://www.python.org/doc/lib/typeiter.html iterator protocol] . Confusingly, Design Patterns uses "aggregate" to refer to the blank in the code `for x in ___:` which is unrelated to the term "aggregation" [Design Patterns, p. 22: "Aggregation implies that one object owns or is responsible for another object. ... Aggregation implies that an aggregate object and its owner have identical lifetimes."] . Neither of these terms refer to the statistical aggregation of data such as the act of adding up the Fibonacci sequence or taking the average of a list of numbers.

* Visitor pattern
* Template class
* Type safety
* Functional programming

References

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• aggregate — (collectivity). Large collections of people may act as groups, with some degree of common purpose, but they may also act as non organized collectivities, or aggregates. For example, an audience or crowd may be said to be an aggregate, in so far… …   Dictionary of sociology

• Structural pattern — In Software Engineering, Structural Design Patterns are Design Patterns that ease the design by identifying a simple way to realize relationships between entities.Examples of Structural Patterns include:* Adapter pattern: adapts one interface for …   Wikipedia

• Software design pattern — In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into code. It is a… …   Wikipedia

• Behavioral pattern — In software engineering, behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.… …   Wikipedia

• Iterator pattern — In object oriented programming, the iterator pattern is a design pattern in which an iterator is used to traverse a container and access the container s elements. The iterator pattern decouples algorithms from containers; in some cases,… …   Wikipedia

• Specification pattern — In computer programming, the specification pattern is a particular software design pattern, whereby business logic can be recombined by chaining the business logic together using boolean logic.A Specification pattern outlines a unit of business… …   Wikipedia

• List of statistics topics — Please add any Wikipedia articles related to statistics that are not already on this list.The Related changes link in the margin of this page (below search) leads to a list of the most recent changes to the articles listed below. To see the most… …   Wikipedia

• AGRICULTURAL LAND-MANAGEMENT METHODS AND IMPLEMENTS IN ANCIENT EREẒ ISRAEL — Ereẓ Israel is a small country with a topographically fragmented territory, each geographical region having a distinctive character of its own. These regions include: the coastal plain, the lowlands, the hilly country, the inland valleys, the… …   Encyclopedia of Judaism

• ECONOMIC AFFAIRS — THE PRE MANDATE (LATE OTTOMAN) PERIOD Geography and Borders In September 1923 a new political entity was formally recognized by the international community. Palestine, or Ereẓ Israel as Jews have continued to refer to it for 2,000 years,… …   Encyclopedia of Judaism

• Economic Affairs — ▪ 2006 Introduction In 2005 rising U.S. deficits, tight monetary policies, and higher oil prices triggered by hurricane damage in the Gulf of Mexico were moderating influences on the world economy and on U.S. stock markets, but some other… …   Universalium