40,373 reputation
1394184
bio website
location London, United Kingdom
age
visits member for 3 years, 6 months
seen 17 hours ago

Jun
27
comment Passing central objects around or having global instances?
The second rule of thumb is "always take with a pinch of salt any rule of thumb that starts 'never'." However, in this case, I would err on the side of too-strict.
Jun
18
comment Why was C# made with “new” and “virtual+override” keywords unlike Java?
@C.Champagne: Any tool can be used badly and this one is a particularly sharp tool -- you can cut yourself easily. But that's not a reason to remove the tool from the toolbox and remove an option from a more talented API designer.
Jun
18
comment Why was C# made with “new” and “virtual+override” keywords unlike Java?
@C.Champagne: You're still confusing override with new. They're not the same; not even close.
Jun
18
comment Why was C# made with “new” and “virtual+override” keywords unlike Java?
One excellent use of new is in WebViewPage<TModel> in the MVC framework. But I have also been thrown by a bug involving new for hours, so I don't think it's an unreasonable question.
Jun
13
comment Combinatorial explosion of interfaces: How many is too many?
@mga: Not knowing what Foo and Bar do, it's hard to say. I can think of circumstances where I'd give either answer. And circumstances where I'd derive one interface from the other, and circumstances where I wouldn't. Unfortunately, this is the kind of thing where experience will tell you what to do. Whether that be an experienced colleague, or an answer to a specific question here or on codereview, or simply taking an educated guess and learning from getting it wrong. (Which is what most of us have done at some point.)
Jun
6
comment Liskov substitution principle with abstract parent class
Can you link to the blog post, so we can see that claim in context?
May
16
comment Coding: conciseness/efficiency vs readability
@svick: I would argue that for pretty much any change I can think of here, you're maintaining less code. You're either going to change one of the methods or the calling code; rarely more than one of them, certainly not all three. And you're going to find it easier to find the bit you're looking for, when you're not figuring out which bracket goes with which in (Regex.Split(unitsParam.Last(), ", ")[1]).
May
16
comment Coding: conciseness/efficiency vs readability
@svick: Going too far into what? What downside are you envisioning?
May
14
comment How to unit test without mocks and not be tied to a concrete implementations of an interface
@RobertHarvey: David Heinemeier Hannson. david.heinemeierhansson.com
May
14
comment Merging around 15 small Git repos of non-optional centralized web service components to a single large repo
Good question, but the answer may differ based on the IDE integration into source control, so can you give a bit more info on tools used.
Apr
29
comment Git: Branch or Fork?
Fork is a github concept, not a git concept. It simply clones and puts it in your account. So cloning is what you're looking for. See stackoverflow.com/questions/6286571/git-fork-is-git-clone
Apr
29
comment Backbone and JavaScript
It's very unclear what problem you're trying to solve here.
Apr
24
comment How would you explain this line of code to a complete beginner?
@Neil: It's not that obvious to everyone reading this question that Scanner would be a JVM class. That would be the answer to my question and would definitely have affected my answer, if the question hadn't been closed. Clarification of the question improves the quality of the answers.
Apr
23
comment How would you explain this line of code to a complete beginner?
@Neil: Well, yeah. At some point, you have to understand the concepts; if you can't follow the progression from code to method to class (not proper OO, just a place to store methods), you're probably not going to get what's happening above.
Apr
23
comment How would you explain this line of code to a complete beginner?
@Prog: Is there a reason you can't take it step-by-step? Write the scanner code in-line, then extract it to a method, then move it to a class?
Apr
23
comment Testing in procedural programming code
@user2250119: perl.org/get.html
Apr
15
comment Testing abstract class' behavior
Yeah, that's one of those cost-benefit decisions you have to make sometimes. I would test both, doing whatever I could to remove duplication from the test code. I don't know C++ testing frameworks very well, but in NUnit, you can have base test classes from which you can derive others, so you can very easily say "all classes that derive from type A must satisfy these conditions". Then if, later, that becomes untrue -- eg. if the implementation is moved to the derived classes -- you can also move the test to the derived test classes and run before changing your code.
Apr
14
comment Testing abstract class' behavior
@MetaFight: Correct.
Apr
14
comment Testing abstract class' behavior
@MetaFight: No, I'm not suggesting that. I'm suggesting that if I call DoStuff() on a derived class, the expected behaviour (which is what I should be testing) is a behaviour of that derived class, even if it is ENTIRELY implemented in the base class. I am distinguishing between behaviour and implementation details. That is, if I decide later that DoStuff() should be implemented in the derived class, or a helper class, instead then the behaviour of that class doesn't change (though other derived classes might) and neither should the tests.
Apr
14
comment Testing abstract class' behavior
Behaviour shouldn't belong to an abstract superclass though. That's the point of its being abstract, surely. The behaviour is a property of the subclass; that it has a superclass is an implementation detail.