Reputation
7,741
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
2 23 43
Newest
 Good Answer
Impact
~233k people reached

22h
comment Repository pattern with service layer - too much separation?
@EsbenSkovPedersen There are more than one kind of "service" in DDD. Infrastructure services, Application services, and Domain services are a few. While Infrastructure and Application services should not contain business logic, Domain services can and do.
1d
comment Repository pattern with service layer - too much separation?
My answer to a similar question: programmers.stackexchange.com/a/135751/4127
Aug
24
comment Dependency Inversion Principle
A dependency is a module with behavior that another module depends on to get it's work done. A dependency has behavior, which can be abstracted. The dependency can be provided as a parameter, but it doesn't have to be. A parameter is an input to a subroutine. That input may be a dependency, but it may be a simple variable without behavior. I would not consider the parameters for a subroutine such as add(int x, int y) as dependencies.
Aug
24
comment Dependency Inversion Principle
Just wanted to point out that your paragraph starting with "We used to just call injections "parameter passing"" is a bit misleading. Not all parameters are dependencies. Equating the two can confuse somebody trying to suss out the nuances of Dependency Injection.
Aug
20
comment Why Session has implemented this way in Asp.net
The only other alternative would be to store the session object in some structure that holds <string, object, type>, so that the boxing/unboxing could be done for you. This adds overhead where it doesn't need to be. It's fairly simple to write a wrapper around Session to make the process strongly typed. I do this pretty regularly.
Aug
18
comment Unit Testing without DI
I agree with @MobyDisk... There are alternatives, and they're all worse than simple DI. Shims is a perfect example.
Aug
13
comment Excessive LINQ chaining - Is it considered a code smell, and why?
@MichaelT Agreed
Aug
13
comment Excessive LINQ chaining - Is it considered a code smell, and why?
I personally wouldn't consider this a violation of the LoD anyway. This isn't imperative code that looks through an object hierarchy picking out a chain of properties, it's a bit of declarative code that describes what data to select. Declarative code just looks awkward when you are thinking imperatively.
Aug
6
reviewed Approve Integer conversion with Console.ReadLine()
Aug
4
comment What is the term for an anonymous JavaScript function that's called immediately?
@LawrenceAiello I added an edit to show what I meant. Hopefully it still works for you.
Aug
4
revised What is the term for an anonymous JavaScript function that's called immediately?
add example of when to surround the function with parentheses
Aug
3
comment What is the term for an anonymous JavaScript function that's called immediately?
One nitpick: In your example using var area = ..., you don't need the "wrapping" parentheses on the function, because it's already a function expression by virtue of being on the right-hand side of the =. The wrapping parentheses are only needed when the function is written as a function declaration (i.e. without the leading var area = ...).
Aug
2
comment Are #regions an antipattern or code smell?
@Andy I only write off the people who misuse the metaphor, or toss it out completely without consideration. Its proper use is powerful.
Jul
29
comment Vertical Single Page App libs/patterns?
Bootstrap has a similar feature they call ScrollSpy. Here's a nice writeup on SitePoint.com.
Jul
29
comment How to promote code review as an employee?
I call it "asynchronous pair programming".
Jul
28
comment Does it make sense to use “ys” instead of “ies” in identifiers to ease find-and-replace functionality?
Using properly spelled and conjugated words while programming is not the same as "natural language programming". Edsger was not making the point that you should intentionally misspell words while programming.
Jul
27
comment Does it make sense to use “ys” instead of “ies” in identifiers to ease find-and-replace functionality?
Code is written for two reasons: for humans to read and for computers to execute. Some would say source code is written primarily for humans to read, since most of it gets immediately compiled into byte code before the computer executes it. So, while the computers may not care about proper grammar, the humans certainly do.
Jul
23
comment Why does convention say DB table names should be singular but RESTful resources plural?
There's no single convention in DB table naming nor RESTful resource naming that everybody follows. On the contrary, there may be many conventions. It's not surprising that some may clash.
Jul
14
comment Should my application's README be for developers or users
If you expect "regular everyday users" to open a readme file before using your product, I expect you're in for a rude awakening. :-)
Jul
1
comment Is testable code better code?
@gnasher729 Exactly my point. "Making this code testable" is a simple change that can solve a lot of (testing) problems. If you don't want to automate testing, then I guess the code is passable as-is. But it would be better once it's "testable".