4 ms·
Sure, Well first off. IsNegative and Balance are idependantly mutable. I could do this: var account = new Account(); account.Balance = 500; a
by LandR 7y ago
Sure,
Well first off.
IsNegative and Balance are idependantly mutable.
I could do this:
var account = new Account();
account.Balance = 500;
account.IsNegative = true;
Or
var account = new Account();
account.Balance = 500;
account.Credit(-600);
Now Balance is - 100 and IsNegative is false.
Or vice versa for both.
I would expect anyone applying for a job that is asking for 5+ years of experience to pick up on something as basic as this.
- dekhn 7y agoThat was your criterion? OK... so you're complaining that the coder could use the api to violate an invariant. I've worked with millions of lines of code and this is certainly not a criterion I'd use to evaluate a serious programmer. Many codes I work with permit this sort of behavior (I guarantee you can mess up using the C library this way).