composition

coldfusion: Invoke cffunction from the same component

This question might be naive as I'm new to ColdFusion programming. I have a task for which I have written a function, f1, inside a component. I want to call f1 from another function, f2 defined in the same component. f2 is being called in a cfm file. My question - Is this the right way to do it? Can I invoke f1 from f2? I can as well...

managing relationships between agregated / composited members of a class

I am creating entities for a simulation using aggregation and composition. In the following C++ example: class CCar { CCar( CDriver* pDriver ) { m_pDriver = pDriver; } CDriver* m_pDriver; CEngine m_Engine; CDriverControls m_Controls; }; in the above example, a car consists of an engine and a set of driving con...

PHP5 Classes: inheriting a composed class?

Hey all, I'm trying to get the following to work, but I'm at a loss... class Foo { public $somethingelse; function __construct() { echo 'I am Foo'; } function composition() { $this->somethingelse = } } class Bar extends Foo { function __construct() { echo 'I am Bar, my parent is Foo'; } } c...

What is the primary competing design pattern to concrete inheritance in application architecture?

Occasionally I'll come across comments about inheritance going "out of style" in enterprise application architecture, but I haven't come across a link to an article describing a competing theory. Also, is there a difference in implementation if the application is already built as opposed to starting from scratch? I gather this might have...

MEF: Calling Refresh() on a DirectoryCatalog throws ChangeRejectedException if new DLLs found in directory (C#)

I'm experimenting with MEF and created a test program to call "plugins" that implement some given interface, which follows: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ProbeContract { public interface IProbe { int DoProbe(string what); List<string> GetCapabilit...

WPF Composition/Agregation

Hi, I'm looking for documentation regarding WPF best practice for Compositing and agregating the user interface in a large project. I'm comming from a visual Inheriance world using Delphi and Winform. And I'm now try to replicate that kind of pattern well in fact reusability of those UI elements. I'm open to suggestion and reading. ...

UML Notation - Aggregations/Compositions vs "Vanilla" Associations

I've recently spent a good deal of time performing detailed UML designs of various SW components that I have since written. Looking back on what I have recently finished and comparing that to when I first learned UML, I see that I now almost strictly use Aggregation and Composition relationships, and have virtually abandoned "vanilla" no...

How closely related is music composition to coding?

It seems to me as if there are a higher proportion of musicians in the programming field than in the general public. Maybe it's just an illusion caused by the fact that I'm an amateur guitarist myself, so I tend to notice coding musicians (or musical coders?) more. But I wonder if there really is some connection. Perhaps a shared set ...

OOP: composition samples please suggest which is better and why

Please ignore language syntax, I want to discuss only OOPS here. I will present here 2 code snippets, each of which is a sample of Composition (if I'm not wrong). Problem Statement: I have an object which keeps the stats of an entity in the system. Let those stats be: Name LastName Salary *these fields can be anything, I just too...

What is web service composition?

What exactly is web service composition? ...

Encapsulation Aggregation / Composition

The Wikipedia article about encapsulation states: "Encapsulation also protects the integrity of the component, by preventing users from setting the internal data of the component into an invalid or inconsistent state" I started a discussion about encapsulation on a forum, in which I asked whether you should always clone objects inside...

Motivating factors for composing a particular object?

I know there are LOTS of reasons why you would compose a certain object inside another one. Some schools of thought have made explicit the reasons for architecting a program a certain way e.g. 'data-driven design' or 'domain-driven design'. I'm still a beginner to OOP, and it's often hard for me to understand why one object should be con...

java inheritance versus composition (implementing a stack)

Hey everyone, I am trying to implement a Stack in java (using the list interface: Interface List). I want to implement it two different ways: using composition and inheritance. For inheritance, so far I have: import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; public cl...

Haskell composition (.) vs F#'s pipe forward operator (|>)

In F#, use of the the pipe-forward operator (|>) is pretty common. However, in Haskell I've only ever seen function composition (.) being used. I understand that they are related, but is there a language reason that pipe-forward isn't used in Haskell or is it something else? ...

Haskell function composition

I am reading this tutorial on Haskell. They define function composition as the following: (.) :: (b->c) -> (a->b) -> (a->c) f . g = \ x -> f (g x) No examples were provided, which I believe would enlighten me as to what is being defined here. Can someone provide a simple example (with explanation...

Should I use inheritance or composition?

I would like to keep this one short. I build a HouseA that has two rooms, say BedRoom and StudyRoom, both deriving from a base class called Room. BedRoom and StudyRoom have a same parent called House. Also, any room in a house can access any other rooms only through the parent. If BedRoom has to access any attribute of StudyRoom, it has ...

Run Time Object Graph Builder Composition Library

I am working on a project and have started to use IOC/DI (Unity) and I've looked into MEF. I have come across something which is related to IOC/DI and could probably reuse many of the components that IOC/DI containers use but which isn't the same. This scenario is close to what MEF is trying to accomplish, but rather than assume that f...

How to deal with double composition and inheritance?

I found this related question: http://stackoverflow.com/questions/279158/how-do-i-use-composition-with-inheritance I would like to do the same with Objective-C, that is to say that a GenericView knows that its property obj is a GenericObject, and that a SpecializedView knows that the very same obj property is a SpecializedObject. Here ...

Circular compositional pattern with RSS Feed and FeedItem classes

I'm designing a small system to parse RSS feeds, and I have two classes: Feed and FeedItem. public class Feed { public string Title{ get; set; } public string Link{ get; set; } public string Description { get; set; } public bool IsTwitterFeed { get; set; } public List<FeedItem> Items { get; set; } } public class Fee...

C++ Templated return

Hey Folks, I have a program which is built on "Entities", which hold "Components" (composition FTW). Components may include many different types including scripts, assets, etc. I would like to build an Entity function called Entities have a map of strings, and actual Components, such that the Components can be searched for by type na...