HOME

TheInfoList



OR:

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 Statistics (from German language, German: ''wikt:Statistik#German, Statistik'', "description of a State (polity), state, a country") is the discipline that concerns the collection, organization, analysis, interpretation, and presentation of ...
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 Sociology is a social science that focuses on society, human social behavior, patterns of Interpersonal ties, social relationships, social interaction, and aspects of culture associated with everyday life. It uses various methods of Empirical ...
,
economics Economics () is the social science that studies the Production (economics), production, distribution (economics), distribution, and Consumption (economics), consumption of goods and services. Economics focuses on the behaviour and intera ...
,
psychology Psychology is the scientific study of mind and behavior. Psychology includes the study of conscious and unconscious phenomena, including feelings and thoughts. It is an academic discipline of immense scope, crossing the boundaries betwe ...
, and
criminology Criminology (from Latin , "accusation", and Ancient Greek , ''-logia'', from λόγος ''logos'' meaning: "word, reason") is the study of crime and deviant behaviour. Criminology is an interdisciplinary field in both the behavioural and so ...
.


Computer programming

In ''
Design Patterns ''Design Patterns: Elements of Reusable Object-Oriented Software'' (1994) is a software engineering book describing software design patterns. The book was written by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, with a foreword ...
'', 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 Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
. def fibonacci(n: int): 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: int) -> int: total = 0 for x in fibonacci(n): total += x return total def fibsum_alt(n: int) -> int: """ Alternate implementation. demonstration that Python's built-in function sum() works with arbitrary iterators. """ return sum(fibonacci(n)) myNumbers = , 7, 4, 3, 22 def average(g) -> float: return float(sum(g)) / len(g) # In Python 3 the cast to float is no longer be necessary Python hides essentially all of the details using th
iterator protocol
Confusingly, ''
Design Patterns ''Design Patterns: Elements of Reusable Object-Oriented Software'' (1994) is a software engineering book describing software design patterns. The book was written by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, with a foreword ...
'' uses "aggregate" to refer to the blank in the code for x in ___: which is unrelated to the term "aggregation".
Design Patterns ''Design Patterns: Elements of Reusable Object-Oriented Software'' (1994) is a software engineering book describing software design patterns. The book was written by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, with a foreword ...
, 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.


See also

*
Visitor pattern In object-oriented programming and software engineering, the visitor design pattern is a way of separating an algorithm from an object structure on which it operates. A practical result of this separation is the ability to add new operations to ...
*
Template class Generic programming is a style of computer programming in which algorithms are written in terms of types ''to-be-specified-later'' that are then ''instantiated'' when needed for specific types provided as parameters. This approach, pioneered by ...
* Facade pattern * Type safety *
Functional programming In computer science, functional programming is a programming paradigm where programs are constructed by Function application, applying and Function composition (computer science), composing Function (computer science), functions. It is a declar ...


References

Software design patterns Articles with example Python (programming language) code {{compu-prog-stub