Generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters.
-1
votes
0answers
17 views
Generic xml data extractor [closed]
This is my Python code for parsing XML responses, with the help of xml.etree module.
...
5
votes
1answer
61 views
Message Based Communication Design
I'm trying to design an API.NET for some communication purposes with Testing Equipment and I cannot figure out a proper way for designing the architecture.
Basically, we have different (physical) ...
4
votes
3answers
130 views
8
votes
2answers
139 views
C++(11/14) intercalate implementation
I wrote a simple generic intercalate function (that should be semantically equivalent to the Haskell intercalate).
...
3
votes
1answer
75 views
Is this a good way to deal with this tricky generic situation?
I have a project which should be thought of split into two layers: an IO layer which consists of sensors (input) and effectors (output), and a core layer which contains logic for determining which ...
5
votes
2answers
205 views
5
votes
1answer
64 views
Generic property with AOP-functionality in Java
After playing around with Java 8 and Generics for some time, I came across an idea while reading some posts about Apple's new programming language Swift.
Swift has AOP-like methods for properties ...
1
vote
0answers
39 views
Feedback for a mostly auto-generated generic data layer
I'm trying to make a reusable data layer that is mostly generated from a database via T4 templates. On top of this data layer, I'd like to have WebAPI endpoints for each repository, with most of the ...
2
votes
1answer
43 views
Generic util method to convert in single map from list of array of Object generally result of JPQL/ hibernate
I have designed a generic method to convert list of array of Objects to result into single map. This is working fine, but I want to check weather a key object is valid key (whether it is overriding ...
1
vote
3answers
92 views
Would ignoring generic types to provide default behavior when client uses my default constructor confuse people?
I'm wondering if providing default behavior is ever worth the confusion caused by ignoring generic type passed in. Another question brought up this issue:
...
5
votes
1answer
42 views
Having children call parent's public events with data generated from a protected event
I don't know that my title describes the code I want reviewed. Hopefully the code is explanatory.
I have an abstract parent class with two children. The parent listens to some hardware notifications ...
1
vote
1answer
205 views
Generic, thread-safe MemoryCache manager for C#
Using this question as a base, and using some of the advice in the answers, I wanted to build out something that would be generic, thread-safe, and easy to use for at least one current and several ...
7
votes
1answer
94 views
Generic radix sort
This started out with my answer to Radix Sort on an Array of Strings?. Since I intend to write a generic radix sort for my own purposes anyway, I continued a little bit, and here is a version tested ...
5
votes
1answer
87 views
Is there a simpler way to create this Inheritance structure for overriding an internal Generic Type?
I have some code below which is designed for the following purposes:
Implement a cache structure which stores cached elements, as well as a method for reloading those elements.
Ensure the new ...
7
votes
2answers
219 views
9
votes
3answers
315 views
Recursive Fibonacci with Generic delegates
Here is fast recursive fibonacci like for loop. How it be more readable and is possible remove TArg's ?
...
4
votes
2answers
59 views
Pattern for storing object of varying type
I have a situation where I need to store fields of differing types of some data structures along with some similar metadata (The application takes data from one of many sources, some data possibly ...
3
votes
1answer
102 views
Genericizing PropertyValues
This should be the last iteration for this code.
Question 1
Does this approach make sense or am I heading down the wrong path?
Question 2
The only thing I can see to make this better is to ...
3
votes
1answer
94 views
Session state wrapper, extending an existing application
I'm adding additional functionality to an existing MVC .net application, and to help prevent or at least reduce repeated reads to the dB I'm dumping a few custom entities in session. I'm limiting what ...
6
votes
2answers
891 views
Empty Interface usage - is this a code smell?
I've recently made a set of interfaces/classes to work with converting a spreadsheet into an object but I utilise an empty interface in my design:
So first off I have my interface which defines what ...
7
votes
1answer
119 views
Model simulation using Java annotations
A couple of days ago I posted my code that models systems made up of moving parts. I got several great tips and ideas and here is my latest version. My actions are now methods annotated with @Action ...
7
votes
2answers
201 views
Game passive skill system
I'm trying to create some easily accessible database of different skills. General idea is that every skill should do something different and be able to act on different things (ex. one skill which ...
2
votes
1answer
142 views
Delegate that selects a writable property on a generic
In the following contrived example, I have a collection of PropertyManagers that each contains selector and assigner delegates to read from and write to a property ...
6
votes
1answer
66 views
Monadic Immutable Linked List in the Least Functional Language Evar
I've written a List monad as an example for a related question. This is a rather frustrating experience as I wanted to use Java, which (as of Java 7) still lacks lambda expressions and lacks ...
6
votes
2answers
98 views
A monad in Java (FriendSpace and People)
After asking a similar question on Stack Overflow, I'm picking up on the answer there to improve my monad. I'm not trying to solve the general case, just come up with one to see how it works. If I'm ...
11
votes
2answers
424 views
Is this C# 'hack' a bad idea?
As C# doesn't have generic specialisation like C++ template specialisation and I wanted a way to be able to do it, I came up with a little hack that goes a bit like this:
...
6
votes
3answers
157 views
Factory for classes unknown at compile time
I have a class called Machine. It contains a list of parts and a list of actions. The list of parts will contain instances of the ...
6
votes
2answers
90 views
Abstract Factory Experiment
While I should probably be using Dependency Injection via Ninject or a similar project, I have been attempting to implement an abstract factory design that would provide me with the following easy to ...
8
votes
1answer
186 views
Cache wrapper - Generics vs Dynamic
I've implemented a common wrapper pattern I've seen for the .NET cache class using generics as follows:
...
1
vote
1answer
260 views
A genric extension method to filter Linq-EF queries
I have various types of EF entities, all of them have a navigation property called "Employee". When generating reports the user will have the option to filter the report according to the different ...
4
votes
1answer
145 views
Mapping from multiple sources to destination using JMapper
I am using JMapper to map from multiple sources to a destination class. Could you review it and let me know if the code looks OK to you? Please suggest any changes that I can make to improve it.
...
3
votes
3answers
84 views
Forcing type-safe IDs for use with Collections and Maps
Introduction
I have a hierarchically nested tree class (like SampleFolder, s.b.) that I want to serialize.
The problem arises with the collection of sub items ...
6
votes
1answer
187 views
Genetic C++ programming with Brainfuck
This was a project I worked on for fun that basically uses a genetic algorithm to produce simple Brainfuck programs that output whatever the user specifies.
I was just was hoping for criticism of the ...
6
votes
1answer
334 views
PriorityQueue<T> Implementation — Flaws, Thoughts, General Feedback
I have been looking desperately for some more experienced .NET (C#) software developers to take a look at my code, and provide me with some good ol' honest feedback and/or criticism about it. It only ...
2
votes
1answer
100 views
VARIANT structure deserialization code organization
In my project i work with COM object via System.Reflection. COM object returns pointer on structure VARIANT, that i cast as ...
4
votes
1answer
107 views
Generic 'temporary instance' class
I've been reading about WeakPointer and WeakPointer<T> today, and it looks very useful. Rather than just using it as-is ...
1
vote
1answer
148 views
Java reflection: Inject data generically and safely
I have become interested in reflection and I wrote a class to wrap an Object so that I can access its private instance fields. The code works great. I do not need to wory about the exceptions in the ...
2
votes
2answers
220 views
Add item to an Array 2D using LINQ
I've wrote a generic function to add an item to an Array 2D
This is what I have:
...
1
vote
2answers
97 views
1
vote
1answer
232 views
Opening a list of URLs and splitting the queries into different files
I recently made a program in Python to open a list of URLs and split the queries into different files. I want to make this code more generic and simple. I am open to suggestions.
...
3
votes
1answer
58 views
How can I improve my Java MethodPointer?
This was just an experiment to see if I could replicate something like C++ function pointers in Java. Basically, the idea was to have an object which represented a method call, and when you call ...
2
votes
1answer
617 views
Using generic methods for basic crud operations
Regarding re-usability, is this OK? What might go wrong? What would be a better design? Performance-related issues and any other comments are welcome.
...
0
votes
0answers
328 views
Binding and iterating a database table to a List<T> in C#
I would like to iterate through the records of a database table using a C# List of my custom class. Is this the most performant way to handle this? (Simplified for ...
3
votes
1answer
45 views
Refactoring my windowsFormApp code
I have around 150 lines of code that I managed to optimize.
But, because my two methods and the six if-statements almost are identical, could there be room for improvement? Maybe it could be done ...
2
votes
1answer
156 views
How to remove duplicated code? AOP and Generics are Ok
I have figures - TriangleItem and CircleItem:
...
2
votes
3answers
506 views
Better way to write generic method to convert List<List<T>> to T[][]
I was working through getting myself past the creation of a generic method, that converts a List<T> or ...
3
votes
0answers
1k views
Review my Generic ASP.net MVC controller that generates many pages?
I recently set out to create an open-source ASP.net MVC web development framework. Specifically, I wanted to automate some of the tasks associated with the creation of data-driven applications. I've ...
3
votes
2answers
759 views
Tips on multiple key Map-wrapper
I'm creating a simple generic Map-wrapper with multiple keyed values.
I'm intending to use it with storing edges in a graph, where an edge goes from one vertex to ...
2
votes
2answers
85 views
5
votes
2answers
595 views
Generic Task Blocking Queue
A generic blocking queue has the following properties:
It is thread-safe.
It allows queuing and de-queuing of items of a certain type (T).
If a de-queue operation is performed and the ...