14
votes
Accepted
Is the IComparable interface outdated/"harmful"?
IComparable has the restrictions you mentioned, that is correct. It is an interface which was already available in .NET framework 1.0, where those functional alternatives and Linq were not available. ...
9
votes
"REST Vs GraphQL" is it a correct comparison?
REST is an architectural style, developed in parallel with the world wide web in the 1990s.
The World Wide Web is a reference application for the REST architectural style (with some deviations).
HTTP ...
8
votes
Isn't data migration a major benefit of MongoDB compared to the commonly used relational databases?
First, I’d like to rescope the migration benefit that you attribute to nosql in general to the sole segment of document-stores. Because migrating from anything to a row store, a graph database or a ...
7
votes
Accepted
Can writing Object-Orientated Code in a Functional style improve performance?
Modern high-performance garbage collectors are built on the assumption that most objects die young, and most objects are never mutated. Your functional version fits into that assumption: the objects ...
6
votes
Accepted
Isn't data migration a major benefit of MongoDB compared to the commonly used relational databases?
Both processes' simplicity and complexity have been greatly exaggerated, I'm sure the first one (RDBMS) can be both more complex or simpler, depending on a range of factors.
I believe the "every-...
5
votes
Accepted
Proving Two Zip file are identical
If you're sure the compression algorithm used to create both zip files is identical then you can just compare the zip files.
Otherwise you will need to decompress the zips and compare contained ...
5
votes
"REST Vs GraphQL" is it a correct comparison?
No, this comparison is not valid.
As you have said, GraphQL and REST are different things, so it is like comparing apples and oranges.
That is one view / perspective of this problem. Second one is ...
4
votes
Can writing Object-Orientated Code in a Functional style improve performance?
It would be misleading to make a general statement about such performance comparison: it simply depends on too many factors. Moreover, modern optimisers are really good at analysing the flow of ...
4
votes
Accepted
Simulating Comparison Without Using Comparison Primitives
Subtraction is the fundamental and more primitive mechanism: a - b vs. a > b. Following subtraction a-b most CPU's will set some flags such that we can determine: result > 0, result == 0, ...
4
votes
TIOBE Index: why c++ is in 3rd place and C is having more land in the last year?
TIOBE themselves comment on the large changes in language percentages:
we see a lot of other huge ups and downs. This has to do with Google re-indexing, which is quite volatile.
It clearly isn't the ...
4
votes
Date comparison with the last second of a day
I would always use
SomeDate < '2018-01-02'
Do you really want to worry about the resolution of the underlying datatype when you make the selection?
It's neater
It works with spans of time. 2018-...
4
votes
Get a hash from XML
In both your C# and Java code, you are simply hashing the byte sequence contained in the string variable result. This will only yield the same hash value if both strings are byte for byte identical. ...
4
votes
Accepted
Get a hash from XML
Your problem is that in the C# code, prior to canonicalization, you parsed the XML document with a parser that strips whitespace, whereas in Java, you preserved the whitespace. In general whitespace ...
3
votes
Best approach for name similarity
I cannot speak for all financial institutions, but when I was working in that arena, we maintained a list of names and surnames along with their origin. During a data factory run, names are compared ...
3
votes
Objectreference vs Equality
When you put booleans (the primitive type) into an Object[]-array, Java will box them into Booleans (the reference type). I assume C# does the same. So it is indeed an object reference comparison.
...
3
votes
Comparing Java objects with different member variables
The “different member variables” is irrelevant. It’s an implementation detail. What you need is a set of rules which of two people comes first.
You could for example sort by family name, then given ...
3
votes
Comparing Java objects with different member variables
Comparing objects with different fields sounds like bad polymorphic design, whether it's Java or any other OOP language:
If your comparator needs to know the precise subtype of an object to do the ...
2
votes
What are the biggest differences between F# and Scala?
this is also a good article on the topic:
comparing-scala-to-fsharp
as always, best way is to try for yourself!
//dotnet fsi --> starts F# interactive
//or open vscode and a .fsx file, install ...
2
votes
Date comparison with the last second of a day
The most reliable way is to always use '>=' when you need to define the beginning of a period, and '<' when you need to define the end of a period:
WHERE SomeDate >= '2019-01-01 00:00:00' AND ...
2
votes
Date comparison with the last second of a day
This depends on the resolution of your data type.
If all you can represent is seconds, then the two are equivalent, and there's no point in writing the more complicated expression. It's a smell ...
2
votes
Is comparing "dollar-hours" for running a specific piece of code practical as an estimate of rented system performance?
Yes, but they are called dollars, not dollar-hours. You are not multiplying cents and minutes; you are multiplying cents per hour, and minutes. The time units cancel out and give you cents. 7.5 ...
2
votes
Language design : use equals symbol = both for affectation and comparison, like in MySQL
Today, most mainstream languages use = for assignment and == for comparison. The main reason is that these allow an assignment inside any expression (C, C++, Java, C#, ...). Swift uses also = and == ...
2
votes
Language design : use equals symbol = both for affectation and comparison, like in MySQL
If your language is such that a = b could, in some particular situation, reasonably mean either, you are inviting people to mean one and get the other. Don't do this.
If there is a separation between ...
2
votes
Language design : use equals symbol = both for affectation and comparison, like in MySQL
Apart from concrete syntax details, many languages have common traits or design decisions which can be used to group them into families. One such trait is "every expression is a statement".
C is an ...
2
votes
How to identify whether or not 2 pieces of text are identical?
The purpose of a hash would be to save resources. The chances of a collision using a hash with good distribution would be very small.
You would not be worried about someone having changed something ...
2
votes
Accepted
Is it a common practice to compare HLDs with the source code?
Presuming HLD means a High Level Design document, the most likely goal is to confirm that the HLD is a valid over view of the actual project as built. If it is valid then:
It can be used as such
The ...
2
votes
Comparing Java objects with different member variables
Java has two interfaces that can be used for sorting (Comparator<T> and Comparable<T>) the first compares two objects of the same type (T) the second can be implemented by a class to ...
1
vote
How to identify whether or not 2 pieces of text are identical?
It's unclear what you mean by "anything else" but whitespace is simple. Just use a regex e.g. \s+ and replace with something deterministic like a single space or some other character of ...
1
vote
Can writing Object-Orientated Code in a Functional style improve performance?
At a fundamental level, code that creates new copies of objects is going to require at least as many instructions as code that modifies existing objects, so it will generally not be faster in absolute ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
comparison × 114algorithms × 15
java × 12
programming-languages × 10
c# × 9
sorting × 7
object-oriented × 6
operators × 6
php × 5
c × 5
functional-programming × 5
c++ × 4
language-design × 4
syntax × 4
language-features × 4
design × 3
javascript × 3
python × 3
web-development × 3
.net × 3
performance × 3
language-agnostic × 3
compiler × 3
xml × 3
scala × 3