Questions tagged [generic-programming]
Generic programming is one method for code reuse. It involves defining a general-purpose data or code structure that can be further specialized to work with concrete types at the location it is used.
27 questions
-1
votes
1
answer
110
views
General Excel Processor and Validator
I've been working on this project where my responsibilities are to code for validating, processing and then dumping into database excel file.
Me and my colleague tried multiple approaches to make it ...
0
votes
0
answers
69
views
How to map translated variable names for column names, so I can export them?
In short story, I want to make some universal generators for different formats (CSV, XLS, XLSX and JSON for now). Just to be clear, I will make different classes for all formats.
I have different ...
0
votes
2
answers
99
views
I've a doubt regarding Environment Model of execution
I came across Environment Diagrams,it is described below
Whenever Python needs to work with an object, that object is stored in
memory; and, additionally, Python also needs a way to associate names
...
1
vote
1
answer
193
views
Templates for generic code and code flexibility
I have a data which is a std::vector of a "small collection" of items of a given type struct Bunny {};.
I was vague about "small collection" because for now it's a collection of ...
0
votes
1
answer
214
views
How should I provide generic typing and allocation for a collection library in C?
I am in the process of implementing a persistent collection in C, specifically, an immutable hash trie. In order to increase acceptance and reusability, I have identified the following key areas that ...
2
votes
3
answers
344
views
Single code fragment to perform two different operations
I want to manage music notes in a C# program, and I wrote a couple classes for that. However, I think I'm having trouble respecting the DRY principle. Either this or I'm overthinking things. Sorry if ...
0
votes
3
answers
1k
views
Definition of Generic function
1)
Below is a python function summation, that can perform sum of cubes/squares/.., similar operations.
def identity(k):
return k
def cube(k):
return pow(k, 3)
def square(k):
return ...
-1
votes
1
answer
122
views
What is the reason behing Tuples instead of HList in akka-http
As I can see in recent releases of akka-http, successor of spray, spray-routing's approach of using shapeless HList was replaced in favor of self-included Tuple
What is the motivation for this ...
0
votes
2
answers
3k
views
Java - Does extending a class which itself extends a class which itself... and so on... is healthy..?
NOTE : Feel free to edit the title if it is somewhat different than my question.
In one of our application, we are maintaining a lot of properties inside Instance object. Obviously it's maintained as ...
5
votes
2
answers
4k
views
Generic Sorting of Lists<>
I have several Lists<> that holds objects of different classes.
List<classA> listA;
List<classB> listB;
List<classC> listC;
//...
List<classM> listM;
The classes do not ...
0
votes
2
answers
555
views
Practical use of generic inheritance and interactions with non-generics?
I've been trying to learn more about generics, and I finally felt that I ran into a situation that it would be more useful to use it instead of only regular classes. Would the following be a practical ...
1
vote
0
answers
150
views
Why isn't there parallel reduction in the Standard Template Library?
Alexander Stepanov stated in talks and interviews that his realization that eventually lead him to generic programming and the Standard Template Library, was from the case of the parallel reduction ...
7
votes
2
answers
4k
views
Writing generic code when your target is a C compiler
I need to write some algorithms for a PIC micro controller. AFAIK, the official tools support either assembler or a subset of C.
My goal is to write the algorithms in a generic and reusable way ...
3
votes
4
answers
5k
views
Are generic programming and OOP mutually exclusive?
I never did generic programming before, being more of a python guy, and generally using OOP. As I moved into generic programming, I faced some issues. I read the FAQ, but I am not satisfied. What I ...