Composition is the process of combining, or composing, parts of a program into a larger program.
Questions tagged [composition]
1737 questions
0
votes
2 answers
How to load data with class composition?
Here are my classes :
class PriceScale
-int ID
-float bookingFees
-Product product
-List periods
Class Product
-int ID
-string name
-List priceScales
class PricePeriod
-DateTime begin
-DateTime end
-float price
-PriceScale…

remi bourgarel
- 9,231
- 4
- 40
- 73
0
votes
1 answer
Angular2 composure
I'm looking into microservices and to be more exact Angular2 microservices. The main idea seems easy enough but it gets complicated as I want to make a composure of different Angular2 apps.
What I mean by this, imagine I have 2 apps which I don't…

taigi100
- 2,609
- 4
- 23
- 42
0
votes
2 answers
Javascript Object Composition with assign & Object.create
trying to wrap my head around javascript composition using assign. The property on my base object is unexpectedly being shared between instances. What am I doing wrong? I have...
Stat.js:
import assign from 'object-assign';
var Stat = assign({}, {
…

Robert Lombardo
- 152
- 1
- 9
0
votes
6 answers
Java composition - Constructor
Today I came across composition. From what I understand, for each instance of composition I need to create new object in constructor, like this :
public class Human {
private String name;
private Adress adress;
public Human (String name,…

D.Walker
- 15
- 1
- 3
0
votes
2 answers
Java: Is It Better Practice to Return an ArrayList or to Update Directly in Method
Say, for example, I have an array of Object that I will be iterating through in a helper method; in the helper function, I will be extracting and processing the relevant/important information and adding it to an ArrayList.
My questions are as…

Tacocat
- 1,134
- 8
- 23
0
votes
1 answer
How to create composable scopes for plain Ruby arrays
One of the things that I really like about Active Record is its named scopes and being able to chain scopes together to build expressive queries.
What would be a similar way to achieve this with plain Ruby Enumerables/Arrays, ideally without…

gingerlime
- 5,206
- 4
- 37
- 66
0
votes
3 answers
Do you extract interface out of any class that can be instantiated?
Is it generally considered a good practice to have every single class (excluding domain models) of your application based off of an interface? Even if the class is called only within your package?
Update: Based on the comments, here is a sample…

developer747
- 15,419
- 26
- 93
- 147
0
votes
1 answer
How to integrate two applications as a single application
Hi,
I am new to iPhone. I created two separate applications. What I want to do now is integrate the two applications into one. For example, I could show two buttons and clicking the first takes the user to the first application, while clicking the…

Mahesh Babu
- 3,395
- 9
- 48
- 97
0
votes
2 answers
Accessors Composition in ES6 Classes
Let's say I have a Thing class which I want to be both Hideable and Openable.
Using a similar approach to Douglas Crockford's object creation through composition, I have been able to "inherit" from multiple classes.
This approach does not work with…

evolutionxbox
- 3,932
- 6
- 34
- 51
0
votes
1 answer
haskell, function composition
I need some help to solve a task on function composition in Haskell. I need to write a function that given an Integer n and a list of inner lists of elements, returns the list of n-th element in each inner list. So it would be like:
select 2…

Paweł Poręba
- 1,084
- 1
- 14
- 37
0
votes
1 answer
python serialization of composite object
I have the following code snippet:
import pickle
class Date:
def __init__(self, d=1, m=1, y=1):
self.Day = d
self.Month = m
self.Year = y
def __str__(self):
return str(self.Day) + "-" + str(self.Month) + "-"…

Dr. Debasish Jana
- 6,980
- 4
- 30
- 69
0
votes
3 answers
How to prune an object of some of its fields in Java?
Suppose we have an object obj of type Object such that System.out.println(obj) produces {a=Some text, b=Some more text, c=Even more text}.
Now we want to make a new object obj2 that is just {a=Some text} (i.e., the fields b and c are pruned from…

George
- 6,927
- 4
- 34
- 67
0
votes
1 answer
Drawing a picture in Java using composition and inheritance
this is my first post here.
I'm a student taking AP Computer Science in high school. For a project, I have to draw a picture of a basketball. Okay, easy enough. The problem is that I have to do this using correct Composition and Inheritance. I can't…

wildeca
- 3
- 2
0
votes
1 answer
WSO2 API Manager & Web Service composition
Here's the scenario,
WS_A and WS_B are Web Services published in different endpoints.
WS_A receives personId, makes some processing, logs some data, and returns the name and the lastname of the Person with personId.
WS_B receives two Strings name…

DiegoS
- 816
- 1
- 10
- 26
0
votes
1 answer
Composition and inheritance in VB.Net
So here is the case. I have class A and B. Class A has a member in it which is Class B
Public Class A
public _lstB as list (of B)
public sub new()
_lstB = B.Init()
end sub
end Class
Public Class B
public shared sub Init() as…

Programmer
- 7
- 3