14
votes
Proving program correctness under all possible cases
Ensuring correctness of a computation mathematically is quite possible, just enormously expensive. Basically, you have to set down the requirements in a formal semantic system that is as rigid as a ...
6
votes
Proving program correctness under all possible cases
First you have to know what a "bug" is. In some projects this might be rigorously defined, in other projects it might be "I do not like the color". And opinions will differ about ...
5
votes
Accepted
Single code fragment to perform two different operations
What you are describing sounds like you want something similar to the relationship between a DateTime and a TimeSpan. Perhaps you could describe it as a Note and a NoteShift. I think that calling it ...
4
votes
Proving program correctness under all possible cases
It seems noone here answered your literal question:
Is it possible to know all possible defects in a program before I write a single line of code
For this question, the answer is trivial: it is ...
3
votes
Alternative To Generic Methods where Type is known at runtime
Curry generics
Since you don't want to use reflection to call generic methods, I'll give you an alternative: Curry the generic parameter. I hope that makes sense.
To handle operations that depend on ...
2
votes
General Excel Processor and Validator
Most extract-transform-load operations cannot be made generic. Generalizing something means finding an abstraction that works in all use cases, and as you've found, when the business rules are ...
2
votes
I've a doubt regarding Environment Model of execution
Yes, the concept of an “environment” is a language independent concept. The term is used frequently in programming language theory, though “bindings” is more generic: names are “bound to” something, ...
2
votes
How should I provide generic typing and allocation for a collection library in C?
How should I provide generic typing and allocation for a collection library ... ?
Establish boundaries
Without scope limits, this task will evolve into a re-creation of C++. Assuming that is not the ...
1
vote
Single code fragment to perform two different operations
The most elegant way to do this is to represent an OctiveNote as an integer. This is in swift but it should be easy to translate:
enum Note: Int {
case c, d, e, f, g, a, b
}
struct OctiveNote {
...
1
vote
Alternative To Generic Methods where Type is known at runtime
Classes that implement IEnumerable<T> also implement the non-generic interface IEnumerable, so you can just use that.
Change this:
private async Task<Ienumerable<?>> ...
1
vote
Accepted
Templates for generic code and code flexibility
This is part of why most of the standard library deals in iterators rather than dealing directly with containers themselves. Iterators were designed from the beginning to support iteration over the ...
1
vote
Adjective for function types on wether the values are received or sent
The set of valid inputs to a mathematical function is the domain, and the valid outputs the codomain or range. These should more or less equate to the values contrained by the types of your sent/...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
generic-programming × 27c# × 9
generics × 6
c++ × 5
java × 4
c × 4
design × 3
object-oriented × 2
programming-practices × 2
programming-languages × 2
inheritance × 2
templates × 2
stl × 2
design-patterns × 1
algorithms × 1
python × 1
database-design × 1
api-design × 1
data-structures × 1
sql × 1
refactoring × 1
dependency-injection × 1
asp.net × 1
libraries × 1
patterns-and-practices × 1