2,160 reputation
2616
bio website github.com/CodesInChaos
location Frankfurt, Germany
age
visits member for 3 years, 4 months
seen 4 hours ago

Jan
30
comment How to convey your approach is faster than the built-in, alternative approaches?
@JeffO If you claim that, it better be true. Else I'd mark the product down due to lying marketing. Exponential speedups are rare, since it implies that the original algorithm had exponential cost in the first place.
Jan
30
comment Why should passwords be encrypted if they are being stored in a secure database?
In general it's preferred to use a random salt instead of the username.
Jan
29
comment Unit testing methods with logical dependencies on other classes
That you're using QueryBuilder is an implementation detail. You can produce equally valid implementations that don't use it. So I wouldn't mock it, even if it increases the size of the system under test.
Jan
29
comment How to unit test a missing case in a switch statement where all cases are true
Duplicate on stackoverflow: How to test or exclude private unreachable code from code coverage
Jan
29
comment How to unit test a missing case in a switch statement where all cases are true
IMO the best solution is telling the code coverage tool that the branch is designed to be unreachable.
Jan
29
comment How to unit test a missing case in a switch statement where all cases are true
At least in C# you can trigger it: Error((eERROR)-1). .net enums are just fancy integers, any value is valid, even those without name. Your code looks more like java, but you didn't specify a language.
Jan
29
comment Preventing some downsides of a static class
I'd use abstract instance methods or an interface together with dependency injection. Accessing global state through static members is generally a bad idea.
Jan
29
comment Are there programming languages that allow you to do set arithmetic on types?
@RobertHarvey At least intersection & would be extremely useful IMO. It simplifies interface hierarchies since you can simply have one interface for each feature, without needing inheritance. For example collection interfaces with & instead of just inheritance would be more flexible and cleaner.
Jan
29
comment Are there programming languages that allow you to do set arithmetic on types?
Support for & and | seems useful, but ^ and ! not so much.
Jan
26
comment When must arbitrary precision arithmetic functions be used in PHP?
Chord might interpret a SHA-1 hash as a large number. Not because of SHA-1 is related to big integers, but because the protocol built on top of it might find it convenient to do so. DHTs use a distance metric between hashes, theirs might be expressed using big integers.
Jan
26
comment What is the most effective grammar to use for issue titles?
One problem with the imperative variants is that they assume that you know the solution when creating the issue.
Jan
26
comment C++ Performance vs. Java/C#
My own experience is that for standard C the typical factor between C and C# is between 1.25 and 2.5. When you compare C# with intrinsic heavy C, a factor of 6 is possible. With mono instead of MS's .net the gap seems to be even bigger.
Jan
26
revised If we close browser window without getting logout, what will happen when we provide same URL in the browser?
Format quote as quote, not text. Better tags. Grammar and formatting fixes.
Jan
26
comment C++ Performance vs. Java/C#
Theoretically there is no reason for C# to be slower than C++ in most scenarios. Practically it's significantly slower since the .net JITter implementation doesn't perform many optimizations. Another big downside is that C compilers typically offer many intrinsics which you can't express efficiently in C#.
Jan
26
suggested suggested edit on If we close browser window without getting logout, what will happen when we provide same URL in the browser?
Jan
26
comment If we close browser window without getting logout, what will happen when we provide same URL in the browser?
If you're using cookie based authentication, it depends on the kind of cookie. Session cookies will be deleted when the browser closes, persistent cookies may survive longer. What exactly closing a window/tab means if it isn't the only one, depends on the browser.
Jan
26
comment When must arbitrary precision arithmetic functions be used in PHP?
SHA-1 operates on several 32 bit integers internally. Externally it operates on byte sequences. So it's closer to strings than to big numbers. It's rarely helpful to treat it as a 160 bit integer. (There are other areas of crypto, such as RSA which use big integers internally, but you shouldn't implement those on a general purpose big integer library since that will open up side channel attacks)
Jan
23
comment Is it good to create static method at Visual Studio refactoring?
There is very little difference between static methods and instance methods. The main distinction is that instance methods have an implicit parameter for this.
Jan
21
comment Summary of C# naming conventions (official Microsoft conventions)
The framework conventions only apply to externally visible types/members (visibility is public or protected). For the rest you can use project/company specific conventions.
Jan
14
comment What should be the maximum length of a function?
@CaffGeek Or perhaps the function is simply doing something non trivial. I've seen functions which would take me days to fully understand. Even functions where I understand all the concepts involved can easily take half an hour to work through the details. While it's nice to have trivial functions, many problems are simply inherently difficult.