Reputation
45,172
Next tag badge:
151/100 score
16/20 answers
Badges
13 112 203
Newest
 Guru
Impact
~1.5m people reached

Feb
20
comment Is it appropriate to not follow the O/C principle if you have unit test coverage?
@Euphoric, the answer is a little wordy, maybe even misleading at times, but it's not outright wrong. You can definitely fix, optimise, refactor, extract code under the hood; otherwise, you'd end up with a new implementation for every bug fix and all the common code duplicated. The interface is by far the most important thing. But, interface is a misleading term in this context, because of the implementation of some languages. Interface includes things like "I return an empty string if not found" which should never change to "I return a null if not found", even if it makes more sense.
Feb
19
comment Distributing work between TCP Clients
@Berio: There are literally no ways to guarantee a listener is always listening from the side of the listener. It's the responsibility of the sender to check that the message got received. If you have no control over that, you have a problem, and the best possible solution is to make the listener super-simple, so it almost never fails (and have auto-recovery, which Windows offers for services). And yes, Redis would also work, I believe ... "any queuing system that allows distribution of messages across multiple subscribers".
Feb
9
comment Where in scrum methodology do you define the approach/concept for a certain task
Of course it's a hard sell. Without estimates, you'll ALWAYS choose the tasks with the highest value, even if they're going to take a disproportionately long time. That's insane business.
Feb
8
comment How to improve our source control process
@Murph: Did not know that. It's been a while since I've used TeamCity (probably v3). Will add a link to that.
Feb
8
comment How to improve our source control process
@DocBrown Fair point, but I think package managers are easier than any other approach to ... managing packages. Personally. I will accept there are other ways.
Feb
8
comment How to improve our source control process
Do you use a package manager (nuget, gem, npm, bower, etc) to deliver those shared projects to your applications? Or do you link to the project and build it directly into the application? If the latter, that's the problem you need to solve, I suspect.
Dec
17
comment How to Code Faster (Without Sacrificing Quality)
@AndresCanella Every answer in this question is basically a long comment. You're right, there's a lot to discuss. This really isn't a good format for discussion (nor is it intended to be). But it was a good question to start with, which is why it's closed and marked as Community Wiki -- for which no one gets reputation points -- rather than deleted.
Nov
22
comment Creating database connections - Do it once or for each query?
@AlexVPerl: I'd need to profile and see evidence that a) there is an actual saving in not returning the connection to the pool and b) that cost isn't a result of hitting the max connection pool (cause, if it did, then any saving would mean a cost elsewhere -- potentially even timeouts waiting for a connection). I'd also need to know that there weren't any other costs, like problems caused by connections dropping between calls. I'd also need to be worried about millisecond-level efficiency savings. An unlikely use-case, but never say never.
Aug
10
comment Is that good idea to add ViewModel exactly same as Model
@MehdiDehghani: It's not as simple as yes or no, it's more that the security issues with direct access to data model are rare and easily coded around. If security were the only reason to use a View Model, I would suggest other solutions (server-side validation, for example). But I'd recommend a ViewModel for decoupling and it will, almost incidentally, help you protect your data model.
Aug
9
comment Is that good idea to add ViewModel exactly same as Model
@MehdiDehghani: Security isn't really a good reason to separate the two objects. The best reason is that the model as viewed in the UI (possibly in multiple formats) is not necessarily the same as the model stored in the database (never in multiple formats and more likely to "model" the business). Even if they look the same now, they are likely to diverge as an application scales; it's better to handle them separately, so there's no temptation to force one model into the other when that time comes.
Jul
30
comment What if the “catch” block is empty - “{}”
@Wilman: Whilst I agree that never is a strong word, NEVER catch (Exception) and swallow it. That will catch OutOfMemoryException, for example, which really should be thrown up to a handler at the top level. If you want to catch a specific kind of exception and swallow it then a comment is enough -- but that should be a rare case.
Jul
1
comment Is testable code better code?
Doesn't really answer your question, but you should keep in mind that good test coverage makes code easier to refactor and refactoring often leads to better code.
Jun
8
comment A Factory could be replaced by a key on the web.config? How would be the trade-offs of each approach?
Are you sure that it was instead of the factory? It seems to me that you have a factory either way, but one uses the environment name to decide which class to return and the other uses a config setting.
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?
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
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/…