Questions tagged [composite]

The Composite pattern is a design pattern that allows a group of objects to be treated in the same way as a single instance of an object. It is one of the Gang of Four's structural design patterns.

Overview

The Composite pattern is a design pattern that allows a group of objects to be treated in the same way as a single instance of an object.

It is one of the Gang of Four's structural , first published in Gamma et al.'s book "Design Patterns: Elements of Reusable Object-Oriented Software".

The Composite pattern may sometimes coincide with the use of composite data types and composite variables.

See also

979 questions
1270
votes
25 answers

How to clear the canvas for redrawing

After experimenting with composite operations and drawing images on the canvas I'm now trying to remove images and compositing. How do I do this? I need to clear the canvas for redrawing other images; this can go on for a while so I don't think…
richard
  • 14,050
  • 8
  • 37
  • 39
88
votes
5 answers

How do composite indexes work?

I've created composite indexes (indices for you mathematical folk) on tables before with an assumption of how they worked. I was just curious if my assumption is correct or not. I assume that when you list the order of columns for the index, you are…
Joe Phillips
  • 49,743
  • 32
  • 103
  • 159
72
votes
11 answers

When should I use composite design pattern?

I don't understand when I should use composite design pattern. What kinds of benefits will I get from this design pattern? I visited this website but it only tells me about the structure of the design pattern and not the scenarios in which it is…
kevin
  • 13,559
  • 30
  • 79
  • 104
65
votes
7 answers

Difference between the Composite Pattern and Decorator Pattern?

What is the difference between the Composite Pattern and Decorator Pattern?
coder
  • 3,205
  • 5
  • 26
  • 14
61
votes
1 answer

Relations on composite keys using sqlalchemy

I have this simple model of Author - Books and can't find a way to make firstName and lastName a composite key and use it in relation. Any ideas? from sqlalchemy import create_engine, ForeignKey, Column, String, Integer from sqlalchemy.orm import…
mdob
  • 2,224
  • 3
  • 22
  • 25
47
votes
1 answer

SQL join with composite primary key

I have to join two tables. But in one table primary key is not there,composite primary key is there,means three columns put together uniquely define a row of that table. I have those three columns in the other table too.rest nothing is common. Is…
Anubh
  • 481
  • 1
  • 4
  • 3
39
votes
1 answer

Design patterns: Composite vs. Composition

I am finishing a course on design patterns, and while reviewing the notes came across something I missed during the semester: Composite vs. Composition. What I managed to understand is that composite is when an object actually encapsulates whole…
Baruch
  • 20,590
  • 28
  • 126
  • 201
38
votes
0 answers

How to make a composite manifest for Microsoft smooth streaming

I am new to Microsoft Smooth Streaming and have questions about the making of composite manifests. Following the guidance from here. I was able to make a composite manifest of a single clip element that played in Silverlight player. However, when I…
Lich
  • 621
  • 6
  • 10
33
votes
6 answers

Implementing MEF with ASP.NET MVC?

I am trying to find out if anyone has any experience or ideas of using MEF (Managed Extensible Framework (Microsoft's new plugin framework) with ASP.NET MVC. I need to create a standard ASP.NET MVC, which I have. But I need to offer additional…
mark smith
  • 20,637
  • 47
  • 135
  • 187
33
votes
2 answers

Check if a Postgres composite field is null/empty

With postgres composite types you can basically build a field with the structure being defined as another table. I have the composite field called "recipient" of type "person". This recipient field is often left empty in my specific scenario. What…
rockstardev
  • 13,479
  • 39
  • 164
  • 296
29
votes
3 answers

how can I set up multiple listeners for one event?

I want to set up multiple listeners for one event, and have found that using composite listener is the key. Could anyone give me an example?
Vicky
  • 1,379
  • 6
  • 18
  • 29
28
votes
2 answers

MySQL: how to index an "OR" clause

I'm executing the following query SELECT COUNT(*) FROM table WHERE field1='value' AND (field2 >= 1000 OR field3 >= 2000) There is one index over field1 and another composited over field2&field3. I see MySQL always selects the field1 index and then…
JoséMi
  • 11,642
  • 2
  • 21
  • 25
27
votes
15 answers

When are interfaces needed?

(In the context of .NET for what its worth) I tend to not use inheritance and rarely use interfaces. I came across someone who thinks interfaces are the best thing since spit. He uses them everywhere. I don't understand this and hence the…
4thSpace
  • 43,672
  • 97
  • 296
  • 475
26
votes
4 answers

How do I configure a RollingFileAppender to roll by date and size with log4net?

I am configure log4net to use a composite RollingFileAppender so that the current file is always named logfile.log and all subsequent files are named logfile-YYYY.MM.dd.seq.log where seq is the sequence number if a log exceeds a certain size within…
Ryan Taylor
  • 8,740
  • 15
  • 65
  • 98
24
votes
2 answers

composed_of in Rails - when to use it?

When should you use ActiveRecord's composed_of class method?
user65663
1
2 3
65 66