invariants
How to implement a Stack class in C#, with pre/postconditions and invariants?
Does anyone have any examples or ideas on how / what is the best way to implement a Stack class in C#? I understand that there is already a Stack class, but I need to understand how to actually implem[详细]
2023-04-11 15:03 分类:问答DDD and Factories
Hi I have a few questions regarding Domain Driven Design and using Factories / Factory Methods. Per the Domain Driven Design Blue Book (Eric EVan\'s Book) it states that complex constructors should be[详细]
2023-04-07 17:53 分类:问答Enforce use of Getter / Setter within same class (C++)
Is there a way in C++ to enforce the use of getters or setters WITHIN the class? class C{ private: int x;// should only be Changed by setX();[详细]
2023-03-30 20:42 分类:问答Can I get Code Contracts to warn me about "illegal" subtyping?
Sorry if this question seems too long. Before I can ask it, I need to show where it\'s coming from. Set-up:[详细]
2023-03-26 07:11 分类:问答C# 3.5 Covariance issue?
I\'ve been hearing/reading a lot about covariance issues in C# and I wanted to pose a few questions & scenarios so hopefully I can clear up my confusion on the matter.[详细]
2023-03-17 01:42 分类:问答Where evaluate invariants after and before call a routine?
In the design by contracts, the class invariant must be satisfied on two occasions: after creating the object and after call a routine. Are there any examples or conditions, which I have to do the eva[详细]
2023-03-13 12:43 分类:问答Java loop invariant
int logarithmCeiling(int x) { int power = 1; int count = 0; while (power < x) { power = 2 *power; count = count +1;[详细]
2023-03-08 05:43 分类:问答Loop invariant of linear search
As seen on Introduction to Algorithms (http://mitpress.mit.edu/algorithms), the exercise states the following:[详细]
2023-02-23 08:34 分类:问答Does it make sense to throw a private exception?
I want to throw a runtime exception in case my class invariants are invalidated. Since this is a programming error (similar to a NullPointerException), clients should not catch that exception.[详细]
2023-02-16 12:02 分类:问答Binary chop: if list[middle] == key case
I\'m revising algorithms for my exams and I was trying to solve this exercise but I couldn\'t come up with a solution.[详细]
2023-02-14 17:46 分类:问答