Questions tagged [generalization]
131 questions
132
votes
9 answers
Cache Invalidation — Is there a General Solution?
"There are only two hard problems in Computer Science: cache invalidation and naming things."
Phil Karlton
Is there a general solution or method to invalidating a cache; to know when an entry is stale, so you are guaranteed to always get fresh…

Greg
- 316,276
- 54
- 369
- 333
44
votes
9 answers
What's the difference between abstraction and generalization?
I understand that abstraction is about taking something more concrete and making it more abstract. That something may be either a data structure or a procedure. For example:
Data abstraction: A rectangle is an abstraction of a square. It…

Aadit M Shah
- 72,912
- 30
- 168
- 299
17
votes
11 answers
C# OOP Composition and Generalization at the same time
This might be a simple/basic OOP question, but I still cannot figure out how to solve it.
I had the following problem during an interview : make an UML class diagram and write the basic code for a "smart"phone which contains the functionalities of…

IonR
- 173
- 1
- 5
9
votes
2 answers
UML generalization and realization
I am pretty new to UML, so I have some questions about Generalization and Realization. I am modeling the behavior of an electronic microcontroller and I need to generate C++ code from the UML description.
As far as I know, a class realizes an…

Umberto D.
- 215
- 1
- 2
- 6
8
votes
3 answers
Generalized method to get similar object attributes
I have an object which has a few arrays as fields. It's class roughly looks like this:
public class Helper {
InsuranceInvoices[] insuranceInvoices;
InsuranceCollectiveInvoices[] insuranceCollectiveInvoices
BankInvoices[] bankInvoices;
…

DeMo
- 683
- 5
- 14
5
votes
3 answers
Generalizing *sql.Rows Scan in Go
I am developing a web API using Go and there is a lot of redundant database query scan code.
func (m *ContractModel) WorkQuestions(cid int) ([]models.WorkQuestion, error) {
results, err := m.DB.Query(queries.WORK_QUESTIONS, cid)
if err !=…

S. Sandeep
- 237
- 3
- 11
4
votes
0 answers
I don't understand this error when passing paramters by reference
I'm trying to run this program in another file(main.cc) but I get an error on this class, where this is the error.
ERROR
./Library.h:15:24: error: expected ')'
Library(Book[] &book, int ¤tNumOfBooks);
…

alroithmhelp
- 37
- 7
4
votes
1 answer
Generalizing the Policy for Model-based reinforcement learning algorithm with large state and action spaces
I am using a model-based single agent reinforcement learning approach for autonomous flight.
In this project I used a simulator to collect training data (state , action , ending state) so that a Locally Weighted Linear Regression algorithm can learn…

DaddaBarba
- 75
- 5
4
votes
2 answers
How to generalize union() to take N arguments?
How can I append/ push data into union dynamically?
For instance, I have 4 data sets to merge,
mydata <- union(data1, data2, data3, data4)
But sometimes I have less than 4 while sometimes more than that.
Any ideas how can I solve this problem?

Run
- 54,938
- 169
- 450
- 748
3
votes
1 answer
Limiting Child Objects in Class Diagram
I want to model a simple system using a Class Diagram:
I have 3 possible classes: Company, Employee, Manager.
The Company must have 20 Employees (aggregation?).
The Company must have 1 Manager (aggregation?).
A Manager is an Employee…

LP2LP
- 51
- 3
3
votes
2 answers
Applying vectorized subsetting across multiple columns in R
I try to find a straight-forward way to vectorize/generalize the subsetting of a data.frame. Let's assume I have a data.frame:
df <- data.frame(A = 1:5, B = 10 * 1:5, C = 100 * 1:5)
Every column has its own condition and the goal is subset the df…

Unit Root
- 45
- 4
3
votes
1 answer
How can I generalize my sampling framework?
In the context of a stochastic ray tracer, I'd like to decouple the MC integration (path tracing, bidirectional path tracing) from sample generation (uniform random, stratified, poisson, metropolis, ...). Most of this is already implemented, but…

Waldheinz
- 10,399
- 3
- 31
- 61
2
votes
1 answer
Can Have Parent Actor more than One Child Actors In Use Case Diagram
In my Usecase Diagram :
Bidder and Seller both inherit from Guest. Is this Correct? or is there another way to do it?

Sudila Jayasekara
- 21
- 1
2
votes
1 answer
create a reusable component in vue.js
How do I make my vue.js component more general and reusable and can pass only the neccessary data?
this is what I want to build:
Structure:
the component has a header
the component has different inputs
the component has a submit button
the…

wittgenstein
- 3,670
- 7
- 24
- 41
2
votes
1 answer
How to generalize a HashMap passed to a function with different types of keys?
I have a hm1: HashMap where K is a tuple (k1, 2, k3) and V is a tuple of 10 elements like (v1, v2, v3, /* ... */ v10).
I have a function which acts on that HashMap, so I pass it as a parameter:
fn do_something(hm1: HashMap<(&i64, &i64,…

Toni Kanoni
- 2,265
- 4
- 23
- 29