Skip to main content

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.

-1 votes
1 answer
97 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 ...
procrastinator1771's user avatar
-1 votes
1 answer
153 views

Injecting Adapters Into Client

So I'm building a client for a third API and I want to be able to Get() and GetMany() for each type this controller can provide. So I've built this adapter, that provides generically typed methods for ...
ScottishTapWater's user avatar
0 votes
0 answers
55 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 ...
Lube's user avatar
  • 109
-1 votes
5 answers
693 views

Proving program correctness under all possible cases

There are techniques of proving program correctness under all possible cases, but that is a more advanced topic, for a later subject in your curriculum. I always had this doubt: Is it possible to ...
Dennis's user avatar
  • 25
0 votes
2 answers
88 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 ...
Dennis's user avatar
  • 25
4 votes
2 answers
8k views

Alternative To Generic Methods where Type is known at runtime

I've written a class that synchronizes a table between two databases using Dapper. The public and private Methods in the class are generic and the generic parameter is the POCO class that is being ...
GisMofx's user avatar
  • 379
1 vote
1 answer
155 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 ...
Enlico's user avatar
  • 130
1 vote
2 answers
133 views

Adjective for function types on wether the values are received or sent

I don't know how to phrase this better, but I remember reading an article about type theory, that categorized the values being received by a function and the values being sent back from the functions. ...
Antoine Catton's user avatar
0 votes
1 answer
167 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 ...
ammut's user avatar
  • 159
1 vote
0 answers
114 views

Practice for modeling class - multiple container relationship

I have a class that could: Have multiple types of containers Have multiple types of implementations and what I did to model so far is: public interface ChildClass { Container getContainer(); ...
Hasan Can Saral's user avatar
2 votes
3 answers
315 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 ...
qreon's user avatar
  • 339
5 votes
2 answers
1k views

Differences between streams and iterators in C++?

I'm working on code which will provide a generic C++ interface to relational datasets. Some of the data will be in tables in memory (e.g. std::set or std::vector), but some of it will be computed - ...
Dennis's user avatar
  • 206
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 ...
overexchange's user avatar
  • 2,305
3 votes
3 answers
2k views

Wrapping Controller / ApiController to remove boilerplates

We are aiming to reduce code noise that would be common for all Controllers such as basic CRUD. public interface IGenericController<T, Y> where T : BaseMaster { IEnumerable<T> Get(); ...
jbalintac's user avatar
-1 votes
1 answer
115 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 ...
Odomontois's user avatar

15 30 50 per page