42,679 reputation
13104193
bio website
location London, United Kingdom
age
visits member for 4 years, 4 months
seen 20 hours ago

2d
answered Design patterns for implementing optionally supported features
May
26
comment Design patterns for implementing optionally supported features
I think the point here is that P_User doesn't EXPECT anything of m_p, but if things are provided then it uses them. I don't see how DIP solves that problem.
May
26
comment Design patterns for implementing optionally supported features
I see why it appears that way, but it's not. As opposed to "if this condition, use this type, else if this condition, use another type, etc" this is "if the current protocol supports X, use it; if it supports Y, use it; if it supports Z, use it." The alternative is to have no-op methods in each protocol class and call them all, which is pretty hard to follow at scale. "Can" methods, as you point out, are no different from is and as.
May
26
comment Design patterns for implementing optionally supported features
"it does look suspiciously cumbersome" In what way?
May
24
awarded  Guru
Apr
16
awarded  Nice Answer
Apr
2
comment Is it a bad practice to separate the unit tests for a class?
@AvetisG: People don't have to elaborate on their downvotes and it's unfair to ask them to. But I'll try to help you ... Only the first paragraph here even attempts to answer the question. The rest is an opinion, which some people wouldn't share. I, personally, agree with your opinion but I don't agree with the one paragraph that's relevant to the question, and I don't see the connection you're making. Mike's answer is correct: "Each test class (like any other class) should have a clear focus." That may or may not be the same focus as for your classes under test.
Mar
19
awarded  Nice Answer
Mar
12
comment How to Use Python as a “Macro” runner for a C# Application
@Katana314: The question suggests he wants an application to which Python can send messages. Which would be a web service, even if it's not web-hosted. But the comment above suggests that he might want to send scripts to the app; in that case, I might suggest running Python, rather than embedding IronPython. Although, I've a gut feeling that Python isn't the answer either. Perhaps a DSL, perhaps in Boo. And that's why I'm looking for more information.
Mar
12
comment How to Use Python as a “Macro” runner for a C# Application
What is your app trying to achieve that couldn't be achieved with a RESTful web service?
Mar
11
comment Decorater pattern or strategy pattern
@8bitcat: Don't confuse the MVC for ASP.NET framework with the MVC pattern. There are other MVC frameworks out there that look entirely different (while still following the same pattern), particularly when you look outside the .NET world. Design Patterns (GoF, PoEEA) are a common language for problems that have been solved repeatedly in many different languages. programmers.stackexchange.com/questions/70877/…
Mar
11
answered Decorater pattern or strategy pattern
Mar
4
awarded  Enlightened
Mar
4
awarded  Nice Answer
Mar
4
comment Is using interfaces for datatypes an anti-pattern?
@Doval: I could create an IList that fulfils the contract IList and throws exceptions on each method, or make it delete a database on Add. But any method that calls Add on an object that fulfils the contract IList will still blindly call Add, no matter the behaviour of my implementation.
Mar
4
comment Is using interfaces for datatypes an anti-pattern?
@JeffO, Doval: That's my point, isn't it? It fits the interface, it fulfils the contract, the outlet will blindly send it electricity. If it doesn't do what it's intended to do at that point, that's a failure of the person who plugged that particular device into outlet. An interface does not guarantee behaviour, only that A will fit into B.
Mar
4
comment Is using interfaces for datatypes an anti-pattern?
@Doval: The distinction is that the contract is between the code passing the entity and the code receiving it (any object I pass you will conform to this contract, so you can make that assumption), not between the entity and either piece of code. Behaviour is the business of the entity. And seeing the behaviour as part of the contract leads to the question above. It's like seeing a 3.5mm jack socket as a behaviour, rather than a standard link between two undefined objects; my plugging headphones into my phone defines the overall behaviour of the circuit, not the connection.
Mar
4
comment Is using interfaces for datatypes an anti-pattern?
@Doval: I guess the name of the interface may describe the expected behaviour. But it doesn't have to; the interface could equally be named IHasIdAndDescription and the answer would be the same. The interface itself doesn't describe behaviour, it describes expectations.
Mar
4
answered Is using interfaces for datatypes an anti-pattern?
Jan
24
revised Why is using break considered bad practice?
added 90 characters in body