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.
2
votes
1answer
48 views
Review of a generic request handler class (RestSharp)
I wrote a class that uses RestSharp to access Rest and HTTP API web services. I tested it and it works however I was wondering if any changes could be made to it to make it better.
public class ...
10
votes
3answers
151 views
Cast inside the method or let the client code cast, which one is better?
I have two choices of implementing a method, the first one is a generic type where the client code does not have to cast
public T GetControl<T>(string controlName) where T : Control
{
...
2
votes
3answers
113 views
ReadOnlyCollection - my alternative to .NET one
I wanted something more flexible than System.Collections.ObjectModel.ReadOnlyCollection.
The goal was: consuming classes should only see what I want to show them, not whole underlying collection.
For ...
1
vote
0answers
62 views
Generic delegates with multiple parameters [closed]
This is based on my question: http://stackoverflow.com/questions/12456568/generic-delegates-with-multiple-parameters
I have 2 classes, one that is a singleton based Database controller that is ...
4
votes
2answers
88 views
Online-Offline Class Manager
Router is a generic class that manage multiple contracts that. It is able to find out wheter it's an online or offline situation, on the very moment when an operation is being made.
There's a really ...
4
votes
1answer
107 views
OOP: Need tips of my approach in .Net
I am looking for some different approaches to this following OOP scenario.
Dim pb As Object = Nothing
If radCars.Checked = True Then
Dim productBase As ProductsBase(Of CarColumns)
...
1
vote
0answers
79 views
Generics: Is this improper use?
I have a class library in which I'm using generics as below. I'm not sure if it's an improper use or not. So aside from the fact that it works and everything "depends", id like some specific critique ...
1
vote
1answer
275 views
Polling loop to run in a background thread
I came up with the idea of a small utility class that will poll some delegate until the response received meets some condition, upon which it will notify the main thread which can take the appropriate ...
3
votes
1answer
146 views
Repository Pattern Review
I have following code for a library management system.
Is the following code a proper implementation of the Repository Pattern?
How can I adapt this code to use generics?
Should I let ...
2
votes
1answer
52 views
Generic pass_many(vals, pass_one) to unroll and call pass_one(val)?
I'm trying to create a generic function that takes a data-structure as input and then sends each non-empty item—e.g.: str, int—individually:
def print_this(v, delim1="", delim2=""):
print v, ...
2
votes
4answers
288 views
Is my Scala Option conversion to Java correct?
Summary:
I've implemented what I think is a complete Java implementation of the Scala Option class. Could you please review and let me know if I have correctly and completely implemented it? And if ...
1
vote
1answer
164 views
Java generics, convert nested list to array
I have to interface to some old code using nested arrays, so I have to convert my nested Lists to nested arrays. Any idea, suggestions, improvements are warmly welcomed.
public static <E> int ...
2
votes
1answer
113 views
How is the design of this Singleton implementation
I did this as an exercise just to practive/improve using generics.
Independent of how useful this implementation of a Singleton is, how is my coding in terms of using generics and any other aspect of ...