2,158 reputation
21130
bio website kristofclaes.be
location Belgium
age 31
visits member for 4 years, 1 month
seen yesterday

Develops for the web, enjoys ASP.NET MVC, intrigued by Ruby (on Rails) and node.js, amateur photographer, plays a bit of guitar, atheist.


Apr
4
comment Is there a better way to model a many-to-many relationship on the same table with Entity Framework?
Thanks. I've updated my question to include the solution based on your answer.
Apr
3
comment Is there a better way to model a many-to-many relationship on the same table with Entity Framework?
I know what the table in the database should look like, but it still needs to be mapped through Entity Framework somehow. But if I understand you correctly, you say that when I want to link Product 1 to Product 2, I should insert two records? { 1, 2 } and { 2, 1 }?
Feb
7
comment Helper static methods in TDD
@user960567 : Instantiating a class like that is really not expensive. Take a look at this blogpost: ayende.com/blog/4811/performance-numbers-in-the-pub - 7,715,305 instances created in one second.
Feb
7
comment Write tests for unit tests in TDD?
@MichaelBorgwardt : Maybe you can pass the roll-value to the Assert? Like Assert.IsTrue(sut.IsFullHouse(roll), roll.ToString()); with NUnit. This way you know what values caused the test to fail.
Feb
7
comment Write tests for unit tests in TDD?
I believe tallseth's motivation for randomizing the values is to test multiple valid and invalid combinations. After a while you have tested [1,1,2,2,2], [1,2,2,2,1], [1,1,3,3,3], [1,1,4,4,4], ..., [5,5,5,6,6].
Feb
4
comment How should you TDD a Yahtzee game?
A small extra question: there are a lot of valid full house combinations and even more combinations that aren't a full house. In scenario's like this, how much (or what kind of) test cases do you suggest writing to cover everything as good/much as possible? Tallseth suggests using random rolls to simulate different full houses and rolls that aren't full houses. I'm not sure I like random tests though.
Feb
4
comment How should you TDD a Yahtzee game?
@Carson63000 - All is forgiven :-) I was only following Roy Osherove's tips from TDD Masterclass and since he's believed to be somewhat an authority when it comes to unit testing and TDD, I figured this was actually the right way to do it. However, I always had a feeling something wasn't right with my approach, that's why I decided to ask the question here.
Feb
3
comment How should you TDD a Yahtzee game?
Thank you very much for your thoughtful and well-explained answer. It actually makes a lot of sense now that I think about it.
Feb
3
comment How should you TDD a Yahtzee game?
Thank you for summarizing Erik's answer, be it in a less argumentative or civilized way.
Feb
3
comment How should you TDD a Yahtzee game?
I have updated my question to add some more information on why I started with the literal approach.
Jan
29
comment Best Practices Returning Read-Only Object
Have a look at this article about this preview of new immutable collections for .NET 4.5: blogs.msdn.com/b/bclteam/archive/2012/12/18/… You can already get them via NuGet.
Jan
17
comment Cyclomatic complexity with two IFs - why it is 3?
Ah, I see. But what's the problem then? The article says it's 3, you say it has to be 3 according to the CC formula, yet you ask why it isn't 4?
Jan
17
comment Cyclomatic complexity with two IFs - why it is 3?
If the operations change, it is possible to have four instead of three possible outcomes. In this specific scenario, only three outcomes are possible. The reason is because the second operation is the opposite of the first one. So both happening is the same as none happening.
Aug
27
comment Is it Ok if Domain Object cross Service Boundary
If you're really doing a simple CRUD application, I don't think you need all those DDD principles.
Aug
27
comment How to unit test a function that is refactored to strategy pattern?
Yes, that's what I would do. I would indeed write seperate tests for the NameHandlerFactory and the NameHandler. When you have those, there's no reason to test their functionality again in the Employee.calculateTax() method. That way you don't need to add extra Employee-tests when you introduce a new NameHandler.
Jul
9
comment Database ERD design: 2 types user in one table
@9000 Isn't that something you'd enforce in the application instead of in the database?
Jul
3
comment Should this code/logic be included in Business Objects class or a separate class?
Is it possible to show some code from the User, Users, UserData and UserUtilities classes? It's hard to answer your questions based on classnames alone.
Jul
2
comment What's the point of passing a parameter by reference in C#?
Well obviously you would want to when you require any of the behaviour it provides :-) To quote Jon Skeet: " you almost never need to use ref/out. It's basically a way of getting another return value, and should usually be avoided precisely because it means the method's probably trying to do too much. That's not always the case (TryParse etc are the canonical examples of reasonable use of out) but using ref/out should be a relative rarity."
Jun
30
comment ORM has schema to generate classes, does the reverse exist?
Migrations are already available in EF 4.3. One of the new EF5 features shown in the video are spatial datatypes and spatial searches.
Jun
13
comment How much should I worry about modeling/analyzing a web application?
The problem is, once it is working and bringing in money, the non-technical decision makers don't see need to rewrite crappy quick 'n' dirty code. "Why do you need to do that? It's working, isn't it? Just add more features! The users don't see your code anyway so who cares!"