Reputation
3,140
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
11 25
Newest
 Nice Answer
Impact
~108k people reached

Jul
29
revised Good Coding practice with respect to interface versus class versus super class
Fixed code formatting.
Jul
18
comment Is there any algorithm to calculate highest possible return on stock market?
Things get much more complex if there are trading fees. It's even possible for it to be optimal to hold onto a stock that very briefly goes down (very slightly) in value. For example, in the sequence [1,100,99,200,2], it may be more profitable to buy at 1 and sell at 200 than to buy at 1, sell at 100, buy at 99, and sell at 200).
Jul
10
comment What can go wrong with composing a method name out of a string?
Meh. Code injection doesn't really constitute a serious vulnerability if either A) the user providing the input is also the user who is at risk of being compromised or B) the user provided the input already has access to the machine. So, abusing reflection in this manner is not necessarily a significant security risk. Hence why the accepted answer asked where the value came from; if it came from the owner of the machine, it's not as much of a risk.
Jul
9
comment What can go wrong with composing a method name out of a string?
The accepted answer already mentions code injection.
Jul
8
comment What is the actual value of a consistent code style
@Alexus: Regarding backwards compatibility, React is still not at version 1.0. The current version, 0.13, did break compatibility in some pretty drastic ways, though whether these failures will happen depends on what mechanism is used to call React components. Having very consistent rules for how to call React may not prevent React upgrades from breaking code, but fixing consistent code is easier, faster, and more reliable. Your concerns about backward compatibility issues are definitely justified in the case of React. E.g., see my comment on stackoverflow.com/a/20913637/18192
Jul
2
comment When to use single-line if statements?
Your example assumes that a,b, and c are mutually exclusive.
Jun
29
answered How to store passwords which need to be re-read
Jun
27
answered Eclipse plugins - safe to install?
Jun
25
comment How to avoid calling String.Replace() in a loop?
If performance is a major concern, Phil Haack rewrote it without regular expressions . Though at that point it's probably not that different from what I'd expect you to come up with by following the advice of the current answers, other than the use of databinder to support complex named parameters.
Jun
25
comment How to avoid calling String.Replace() in a loop?
If your only justification for avoiding String.Format is lack of named parameter support, consider using James Newton's FormatWith2.0 code instead. It's a very simple wrapper around String.Format that uses a regex to convert arbitrary named parameters to ordinal parameters. It even supports complex named parameters (e.g., {Results[0].Name}).
Jun
23
comment Using auto-increment clustered key and guid primary key together
@kirie: It still makes no sense to me. I guess you could have only an objectGuid foreign key that mapped to multiple tables, but that's horribly confusing, very inefficient, and doesn't work well unless the tables you are joining to are similar. A database with that sort of design should probably be a document database, not a relational database.
Jun
23
comment Using auto-increment clustered key and guid primary key together
An identity column int key is also unique within the table, so #1 is not normally valid.
Jun
22
comment Using auto-increment clustered key and guid primary key together
@Crono: You may want to also investigate the use of Sequential GUIDs, which fix some of the performance problems of standard GUIDs...on condition that they're mostly generated by the same machine. The other alternative is a Comb Guid, which is performant even when used on multiple machines...but has less native support.
Jun
12
awarded  Nice Answer
Jun
12
answered How Do News Websites E.g. Forbes / Zdnet Seamlessly Merge One Webpage into Another?
Jun
10
comment Are (basic) SQL queries semantically equivalent to Higher Order Functions?
@Sridhar-Sarnobat: Normally, when a bunch of users vote to migrate your question to Programmers.SE, it will automatically be migrated. You closed your question before it reached the requisite 5 votes.
Jun
3
comment If possible, would it be a bad practice to use Nullable for non value types?
See also Jon Skeet's NonNullable<T> class inside of miscutil. It has a several features a production implementation of NonNullable should include (equality Operators, GetHashCode, and implicit conversions). I recommend any implementation of Maybe have these same features. Skeet does use a struct, though this also doesn't prevent a null NonNullable.
Jun
2
comment Is there a hashCode()-like method that can be used for state checking?
@LinkTheProgrammer: I encourage you to read Eric Lippert's Guidelines and rules for GetHashCode. It was written from the perspective of C#, but the guidelines are basically the same.
May
27
answered If I have a method that needs verification in order to proceed, do I call it inside the method or before?
May
13
comment How Do I Create A Module* For A Class That Relies On Another Module?
@Carcigenicate: Yes, my interface proposal is intended to allow external callers to tell any implementor of ICanRandomWalk to randomly walk. I admit this is slightly annoying in that every implementer of ICanRandomWalk must copy/paste an identical implementation of the randomwalk function. You could instead pass position to RandomWalk's constructor, though this means RandomWalk contains state information.