Composition is the process of combining, or composing, parts of a program into a larger program.
Questions tagged [composition]
1737 questions
29
votes
4 answers
Specifying multiple interfaces for a parameter
I have an object that implements two interfaces... The interfaces are:
public interface IObject
{
string Name { get; }
string Class { get; }
IEnumerable Properties { get; }
}
public interface ITreeNode
{
T Parent…

TerrorAustralis
- 2,833
- 6
- 32
- 46
25
votes
1 answer
When using templating, where should I declare the ?
I have made a lot of progress in converting my JSF applications to book-markable pages, but I am wondering if I am doing it the right way. One question is that is there a best-practice location for the f:metadata tags?
My typical Facelets client…

AlanObject
- 9,613
- 19
- 86
- 142
25
votes
4 answers
Delphi support for Aero Glass and the DoubleBuffered property - what is going on and how do we use them?
I am confused by Delphi 2009/2010 support for the Aero Theme Glass features in Windows, and by what, exactly DoubleBuffered means, and what it has to do with Aero glass. I have found that DoubleBuffered is not only a property in the VCL, it also is…

Warren P
- 65,725
- 40
- 181
- 316
23
votes
3 answers
Composition vs. Delegation
Is there any difference in terms of implementation as how a composition design can be different from delegation. For example the code below seems to be doing delegation since the user cannot access the composed object (i.e "a") without using b.…

Frank Q.
- 6,001
- 11
- 47
- 62
22
votes
2 answers
Avoiding duplicate ids when reusing facelets compositions in the same naming container
I have a that contains a few elements with explicit ids and some ajax events which reference these ids for partial processing/updating. I encapsulated this fragment of xhtml inside the composition simply so I could use it in a few…

Daniel Loiterton
- 5,073
- 5
- 33
- 46
22
votes
4 answers
Combining Predicates in F#
Is there a standard way of logically combining predicates in F#?
For example, let's say I have isCar x and isBlue x then I want something that gives me:
let isBlueCar x = isCar x && isBlue x
But using some sort of composition, rather than…

GregRos
- 8,667
- 3
- 37
- 63
21
votes
2 answers
Are 'currying' and 'composition' the same concept in Javascript?
Recently I read about function composition in a Javascript book, and then on a website I saw someone reference it as currying.
Are they the same concept?

Dino Liu
- 500
- 4
- 17
20
votes
2 answers
How does class composition work in iOS?
Let's say I have property A on classA and property B on classB and I want classAB to have both properties A and B. I still don't understand how to make this all work with composition.
I realize this can be done with inheritance, but I want to learn…

Jacksonkr
- 31,583
- 39
- 180
- 284
20
votes
2 answers
Composing trait behavior in Scala in an Akka receive method
Consider these two traits:
trait Poked extends Actor {
override def receive = {
case Poke(port, x) => ReceivePoke(port, x)
}
def ReceivePoke(port: String, x: Any)
}
trait Peeked extends Actor {
override def receive = {
case…

Hugo Sereno Ferreira
- 8,600
- 7
- 46
- 92
20
votes
4 answers
UML association vs. composition and detail level
Actually, make that a couple of amateur UML questions! When creating a UML diagram to model some domain concepts and you come across a domain concept that "holds" some information about another concept, is it better to hold a stamp/reference to that…

Roger2233
- 231
- 1
- 2
- 3
20
votes
5 answers
Composition vs Inheritance in MVP
I'm using MVP pattern to develop a large scale application. While working in the development I have come up with the question whether if composition or inheritance should be used. For example: Let's assume that I have a form called Foo with fields A…

Sednus
- 2,095
- 1
- 18
- 35
19
votes
3 answers
When to use C++ private inheritance over composition?
Can you give me a concrete example when is preferable to use private inheritance over composition? Personally, I will use composition over private inheritance, but there might be the case that using private inheritance is the best solution for a…

Armando
- 688
- 6
- 15
19
votes
3 answers
Create a new object class or write a method which converts sub-class objects? or something else? Performance NOT Preference
I've put together two separate programs which play a card game called 'Crazy Eights'.
The classes I've written for this program are based on a default 'card' package which provides playing card objects and some generic methods for playing…

Josh Hardman
- 721
- 6
- 17
19
votes
2 answers
Python: Inheritance versus Composition
I am working with two classes in Python, one of which should be allowed to have any number objects from another class as children while keeping an inventory of these children as an attribute. Inheritance seemed like the obvious choice for this…

Arne
- 385
- 1
- 6
- 15
19
votes
1 answer
Extend JPA entity to add attributes and logic
I need to know if it's possible to add some attributes and behaviours to some POJO JPA entity (using hibernate provider) by extending it, and then to make entityManager to return extended objects instead of just pojo entitys, like the following…

jmoreira
- 1,556
- 2
- 16
- 26