520 reputation
28
bio website
location
age 29
visits member for 4 years, 1 month
seen 2 days ago

Nov
20
comment Why do browser Javascript libraries pass the window object as an argument?
Also, it helps JS code minifiers in their work, as they can change the parameter name inside the function.
Nov
20
suggested suggested edit on Why do browser Javascript libraries pass the window object as an argument?
Nov
19
revised Why do browser Javascript libraries pass the window object as an argument?
added 56 characters in body
Nov
19
asked Why do browser Javascript libraries pass the window object as an argument?
Nov
10
comment What advantages are there to using Flex/Bison over just writing a compiler straight in a programming language?
@gnat: The question could be rephrased as "Why would someone use a compiler generator instead of writing a compiler directly?" (and, indeed, has been answered as such). However, I do not see a reason for taking it to Programmers Meta, unless the question gets closed.
Oct
28
comment Is it permissible to use explicit interface implementation to hide members in C#?
You could also have mentioned that Java does not have explicit implementation either, despite having the same "single inheritance of implementation+interfaces" design. However, in Java, the return type of an overriden method can be specialized, obviating part of the need for explicit implementation. (In C#, a different design decision was made, probably in part because of the inclusion of properties).
Oct
28
comment What is meant by Open Source Programming Language?
@spaceknarf: The OP has clarified - "is it the implementation (compiler/runtime) of the language which can be open or close in nature or something else" - he explicitly asks what part of the language should be open in order to qualify.
Oct
28
comment What is meant by Open Source Programming Language?
@GlenH7: "is it the implementation which can be open or closed in nature, or something else"? The question is clear, and the wikipedia definition is not.
Oct
28
comment Should the sender of an event always be a generic Object?
@Dunk: I cringe at the idea of defining and using events. The event feature has been superseded by Microsoft libraries multiple times (see WPF routed events/WPF change notification/WPF weak events, Prism events, Reactive Extensions), for in my opinion good reasons. Still, if I write events in my library, I will make sure to follow these guidelines in order to reduce the learning curve for users of the library. (If I know my users have a reasonable tolerance for less conservative choices, I will use an observable instead of an event).
Oct
28
comment Is it permissible to use explicit interface implementation to hide members in C#?
"There are prominent authors/experts that consider it a kludge of a feature." Who is? What is the proposed alternative? There is at least one issue (i.e. specialization of interface methods in a subinterface/implementing class) that would require some other feature to be added to C# in order to solve it in the absence of explicit implementation (see ADO.NET and generic collections).
Oct
28
answered Should the sender of an event always be a generic Object?
Oct
28
awarded  Critic
Oct
10
comment Should I declare the most specific type as return type of method?
@LeonidSemyonov: It is hard to know why they did it without having been there when the API was written - given that all these methods exist since API level 1, it could be an oversight, performance considerations, convenience, or something else.
Oct
8
comment Why does dependency injection encourage collaboration to be exposed via constructors?
@DanielDavidson: I will admit that I speak from a C#/Java perspective. Mocking a complete database is generally a waste of time (if only because you will never have the same SQL parser) - my recommendation for testing business code that accesses a database would be to encapsulate database access behind repository objects, the main role of which is to define functions that correspond to the queries executed on the database. Unit testing these repository objects can be done by connecting to a small, isolated database.
Oct
8
comment Why does dependency injection encourage collaboration to be exposed via constructors?
With singleton, client code specifies that it gets the instance of the object. With dependency injection, client code only specifies that it needs an instance of the object. As a trivial example, dependency injection allows me to refactor away from singleton easily. E.g. if I have a hash map that represents my configuration properties, it is easy with DI to change from a unique instance to passing (e.g.) a filtered view of the properties that will differ for each object. Or it is easy to go from a "single object per process" to "single object per task".
Oct
8
answered Why does dependency injection encourage collaboration to be exposed via constructors?
Sep
16
comment To subclass or to wrap for “default” implementation?
@justhalf: Then, is one of the implementations more accurate than another? In that case, why the hell would you tell clients to choose between two?
Jun
26
comment Why is the finalize method included in Java?
@MooingDuck: #2 is a separate point because, if the native peer does not hold critical resources (e.g. it is purely an in-memory object), then there is no need to expose an explicit termination method. The safety net from #1 is explicitly about having a termination method.
Apr
13
comment Why should passwords be encrypted if they are being stored in a secure database?
"Read this entire page before you hash your passwords" - that page mentions that you should not use rounds of hashing, but a hashing method that has been specifically designed to be as slow as necessary, such as PBKDF2.
Apr
4
comment Can a Java interface declaration enforce parameter properties?
@MichaelT: The code that you cite is part of sample code for a JSR that is still very early in the implementation stages (creation of the expert group). It does not seem to have been implemented as part of Java 8.