1,115 reputation
311
bio website cysoft.ch
location Switzerland
age
visits member for 3 years
seen Nov 5 at 11:33

Sep
9
comment What is the benefit of passing a delegate to the constructor instead of just having the client code create and pass the ParserSettings?
The constructor could execute some logic modifying the configuration before calling the delegate. And in future versions of the parser the delegate could be called later in the parsing process. This makes the code fit for the future. (This is what the Open-Closed Principle is all about.)
Sep
9
comment What is the benefit of passing a delegate to the constructor instead of just having the client code create and pass the ParserSettings?
Sure, if the default configuration is always the same. But the parser could decide to use different standard configurations depending on the file type being processed or even let preprocessor macros modify it. This would give the delegate the opportunity to just check a given configuration and make changes where appropriate instead of just providing a constant set of configuration settings.
Mar
19
comment Why is 'void' not allowed as a generic type in C#
@supercat: Yes, therefore the need for all the Func<> as well as Action<> overloads.
Jan
21
comment Unique and primary keys on a database (mysql)
@LucFranken: Look at the comments that follow the article. This statement seems to wrong.
Jan
13
comment How important is to initialize a variable
@DougM: Have you overseen my sentence "The really interesting question is whether a variable is initialized automatically or whether you have to do it manually."?
Jan
12
comment How important is to initialize a variable
@DougM: I know. It's not C# specific answer, I just took C# as an example.
Jan
1
comment Why we say Lisp are Human oriented and Fortran are Machine oriented´╝č
@delnan: I added a clarification.
Jan
1
comment Unique and primary keys on a database (mysql)
Values must be unique in a bank account? If I have 100$ on my account no one else is allowed to have 100$ on his account?
Dec
31
comment How do you read this line of code?
@Caleb: The link you mention makes a difference between statically allocated arrays that would effectively allocate one contiguous block of memory and dymanically allocated arrays that could be jagged.
Dec
31
comment How do you read this line of code?
You are right of course. I corrected my answer.
Dec
31
comment Emotional detachment from bad code
Yes, it can be as easy as finding a better name for a variable. No need to fix the whole application at once.
Dec
13
comment Design pattern for configuring objects
I don't know cocoa, so my comment might not apply to your problem. You could have a class that implements two interfaces. One representing the generated data, the other representing the configuration data. They would represent the two facets of the same object.
Dec
11
comment Is there a downside to using Access as a database?
I prefer C#, but VB is okay if someone feels comfortable with it. It gives you access to exactly the same libraries as C# and offers more or less the same programming concepts as C#, even if the grammar and the language concepts are very different. Microsoft said that new language features would be introduced in parallel in both languages in future.
Mar
19
comment Derived Class Method Naming
It says what it does instead of just saying where it is declared.
Mar
17
comment C# return variables
@JustAnotherUserYouMayKnowOrNot: Yes. There is also the possibility to print a message into the debug window from within a breakpoint. Right click the breakpoint and select "When Hit...".
Nov
30
comment Is it useful to unit test methods where the only logic is guards?
@gnat: It's up to you. If you don't have the InternalsVisibleToAttribute testing won't work with internal.
Nov
30
comment Is it useful to unit test methods where the only logic is guards?
Sometimes it is just necessary to declare things public for testing. There is, however, the possibility to declare it internal and to specify the InternalsVisibleToAttribute and to make the internals of the current assembly visible to a test assembly.
Nov
29
comment Is it useful to unit test methods where the only logic is guards?
@JimmyHoffa: I see your point of stateful-logic-less properties. It may not apply here, but when binding an object to a view you can do so only via properties. Therefore I have a lot of stateful/logicful properties. With MVC they have to be in the model, with MVVM/MVP they are in the viewmodel/presenter.
Nov
28
comment Is it useful to unit test methods where the only logic is guards?
+1. Yes, if the requirements change, the some tests will have to be adapted.
Nov
28
comment Is it useful to unit test methods where the only logic is guards?
The method OrderNewWidget is probably in another class than Widget, since it has a Widget argument. Since the method has no return value, testing it is not obvious. You would have to inject a WigdetOrderingService-mock that tracks the OrderNewWidgetAsync call.