41,562 reputation
13102190
bio website
location London, United Kingdom
age
visits member for 4 years
seen 1 hour ago

Dec
18
comment Is it poor practice to call methods through multiple objects?
@supercat: I like that. I'm going to ponder it, and then probably steal it. :)
Dec
18
comment Is it poor practice to call methods through multiple objects?
@supercat: Lists and arrays are definitely one of those examples where common sense has to kick in. Although a List<Car> is an object in and of itself, I'd argue that every element in that list is really one of "O's direct component objects". Take your point one step further and we'll talk about each character in a string being owned by the string, not by the object that owns the string. Or maybe ban bitwise operators for working on bits owned by an int. Strict adherance to LoD could definitely get that silly, but that doesn't nullify the guideline.
Dec
18
comment Is it poor practice to call methods through multiple objects?
@supercat: If I'm understanding what you mean, that's exactly what LoD advises you not to do. Each object should have only one owner, which should pass it to child objects as method parameters or expose methods that allow parent objects to access the "grandchild" indirectly. Again, I'm not arguing for the LoD as a hard-and-fast rule here, I'm explaining why there's no mention of multiple ownership in an article about the Law of Demeter -- because the two things are orthogonal.
Dec
16
comment Shortest Common Superstring: find shortest string that contains all given string fragments
@majidgeek: Thanks for letting me know.
Dec
5
comment Is “White-Board-Coding” inappropriate during interviews?
@KyleStrand: It was weird. He totally managed to model the problem I gave him in the interview, but he couldn't apply the same thinking to the business. But, also, he had a more general problem with laziness, so perhaps it was more that he wouldn't than couldn't. And perhaps that's the lesson to be learned, with 5 years of hindsight: technical tests are all well and good, but can't identify a fundamental character flaw.
Dec
3
comment Creating a sort of 'in-language compiler'
Might want to have a look at this book: manning.com/rahien
Dec
2
comment Scrum: Is it ok for the design/UX of user story to occur in the same sprint as implementation
@Allan: What your scrum master is failing to understand is that, if the designer has to complete their work before a developer can begin their work, that IS up-front design. Making it happen within the sprint removes none of the cost of up-front design but it does make it less-visible AND makes it harder to estimate your development. If you can find a way to iterate with your designer, that's great, make it part of the sprint and make the effort appropriate to a collaborative task. But up-front is OK, as long as it's honest and, preferably, done before the sprint.
Dec
1
comment Scrum: Is it ok for the design/UX of user story to occur in the same sprint as implementation
Worth mentioning that your question in the subject line is very different from the questions at the bottom of your text. Would be helpful if you edited that to choose one or the other.
Nov
18
comment Understanding the static keyword
@Allan: Arguably, if you're calling a public method on a class that doesn't affect the state of an instance of that class, it SHOULD be static, to make that clear to the client developer. If that method does so much that it needs mocking, that's a different problem that can be solved a number of different ways.
Oct
30
comment Should I store images in my database or file system in this application?
@EsbenSkovPedersen: "Moving to a CDN" is the "that" in the sentence you quote ... maybe I should edit that line.
Oct
15
comment What is the difference between the factory pattern and abstract factory?
@SerG Well, in fairness, you've picked up that quote from Wikipedia, on a page that read very differently three years ago. I would argue that the current Wikipedia page contradicts itself in several places, but I don't have the desire to get involved in picking that apart. What I would concede, in hindsight, is that the example I've provided here is a specific kind of Factory Method, known as the Parameterized Factory Method. But the point about the difference between Factory Method and Abstract Factory holds across all types of Factory Method.
Aug
4
comment Best practices for unit testing methods that use cache heavily?
@Jonathan: "Just have a Repository and a Caching Wrapper that use the same interface" -- if they have the same interface, you can use the same methods. The calling code doesn't need to know anything about implementation.
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?