Most Popular
1500 questions
54
votes
5 answers
Are Python mixins an anti-pattern?
I'm fully aware that pylint and other static analysis tools are not all-knowing, and sometimes their advice must be disobeyed. (This applies for various classes of messages, not just conventions.)
If I have classes like
class related_methods():
…

cat
- 734
- 1
- 7
- 15
54
votes
8 answers
Is the use of NoSQL Databases impractical for large datasets where you need to search by content?
I've been learning about NoSQL Databases for a week now.
I really understand the advantages of NoSQL Databases and the many use cases they are great for.
But often people write their articles as if NoSQL could replace Relational Databases. And there…

Leo Lindhorst
- 862
- 1
- 7
- 8
54
votes
5 answers
What is the exact ingenuity of Unix pipe
I have heard the story of how Douglas Mcllroy came up with the concept and how Ken Thompson implemented it in one night.
As far as I understand, pipe is a system call which shares a piece of memory between two processes where one process writes and…

aoak
- 661
- 5
- 7
54
votes
7 answers
Referencing database values in business logic
I guess this is another question about hard coding and best practices. Say I have a list of values, lets say fruit, stored in the database (it needs to be in the database as the table is used for other purposes such as SSRS reports), with an ID:
1…

Kate
- 643
- 5
- 7
54
votes
5 answers
What's the use of .Any() in a C# List<>?
I've been discussing this with colleagues, and we couldn't figure out what the use is of .Any for any given List<>, in C#.
You can check the validity of an element in the array like the following statement:
if (MyList.Any()){ ...} //Returns true or…

Gil Sand
- 2,173
- 3
- 18
- 22
54
votes
2 answers
What is the difference between function() and function(void)?
I have heard that it is a good practice to write functions that do not receive anything as a parameter like this:
int func(void);
But I hear that the right way to express that is like this:
int func();
What is the difference between these two…

Grizzly
- 569
- 1
- 4
- 5
54
votes
2 answers
REST API - Should API Return Nested JSON Objects?
When it comes to JSON APIs is it good practice to flatten out responses and avoid nested JSON objects?
As an example lets say we have an API similar to IMDb but for video games. There are a couple entities, Game, Platform, ESRBRating, and…

greyfox
- 869
- 1
- 8
- 11
54
votes
3 answers
Is it actually worth unit-testing an API client?
This is something that's been troubling me for a while now. Is it actually worth unit-testing an API client?
Let's say you're creating a small class to abstract-away the calls to a petshop REST API. The petshop is a very simple API, and it has a…

Phillip B Oldham
- 643
- 1
- 5
- 6
54
votes
9 answers
Is immutability very worthwhile when there is no concurrency?
It seems that thread-safety is always/often mentioned as the main benefit of using immutable types and especially collections.
I have a situation where I would like to make sure that a method will not modify a dictionary of strings (which are…

Den
- 4,827
- 2
- 32
- 48
54
votes
6 answers
Choosing a functional programming language
I have read a lot of threads about functional programming languages lately (almost in the past year, in fact). I would really like to pick one and learn it thoroughly.
Last [course] semester, I have been introduced to Scheme. I loved it. Loved the…

Joanis
- 1,364
- 2
- 12
- 14
54
votes
3 answers
C++ strongly typed typedef
I've been trying to think of a way of declaring strongly typed typedefs, to catch a certain class of bugs in the compilation stage. It's often the case that I'll typedef an int into several types of ids, or a vector to position or velocity:
typedef…

Kian
- 643
- 1
- 5
- 5
54
votes
5 answers
Builder Pattern: When to fail?
When implementing the Builder Pattern, I often find myself confused with when to let building fail and I even manage to take different stands on the matter every few days.
First some explanation:
With failing early I mean that building an object…

skiwi
- 1,138
- 3
- 9
- 14
54
votes
7 answers
What is wrong with Java's generics?
I have seen several times on this site posts that decry Java's implementation of generics. Now, I can honestly say that I have not had any issues with using them. However, I have not attempted to make a generic class myself. So, what are your issues…

Michael K
- 15,539
- 9
- 61
- 93
54
votes
11 answers
Writing my problem solving approach on paper?
I'm a freshman Computer Science student and we just started doing some actual projects in Python. I have found I'm very efficient when I use the pen and paper method that my professor suggested in class. But when I can't write my problem down and…

ComicStix
- 656
- 6
- 7
54
votes
3 answers
Why is an anemic domain model considered bad in C#/OOP, but very important in F#/FP?
In a blog post on F# for fun and profit, it says:
In a functional design, it is very important to separate behavior from
data. The data types are simple and "dumb". And then separately, you
have a number of functions that act on those data…

Danny Tuppeny
- 896
- 6
- 13