Skip to main content
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. ...
Doc Brown's user avatar
  • 220k
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 ...
VoiceOfUnreason's user avatar
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 ...
Christophe's user avatar
  • 82.2k
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 ...
Jörg W Mittag's user avatar
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-...
Tulains Córdova's user avatar
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 ...
candied_orange's user avatar
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 ...
CorwinCZ's user avatar
  • 161
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 ...
Christophe's user avatar
  • 82.2k
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, ...
Erik Eidt's user avatar
  • 34.8k
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 ...
Philip Kendall's user avatar
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-...
Ewan's user avatar
  • 84.4k
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. ...
Stephen C. Steel's user avatar
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 ...
Michael Kay's user avatar
  • 3,599
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 ...
Robbie Dee's user avatar
  • 9,843
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. ...
Jacob is on Codidact's user avatar
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 ...
gnasher729's user avatar
  • 49.4k
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 ...
Christophe's user avatar
  • 82.2k
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 ...
jkone27's user avatar
  • 39
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 ...
Ivan Olshansky's user avatar
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 ...
Kilian Foth's user avatar
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 ...
Stack Exchange Broke The Law's user avatar
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 == ...
Christophe's user avatar
  • 82.2k
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 ...
Caleth's user avatar
  • 12.4k
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 ...
Hans-Martin Mosner's user avatar
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 ...
Martin Maat's user avatar
  • 18.6k
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 ...
candied_orange's user avatar
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 ...
DavidT's user avatar
  • 4,629
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 ...
JimmyJames's user avatar
  • 30.9k
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 ...
casablanca's user avatar
  • 5,004

Only top scored, non community-wiki answers of a minimum length are eligible