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
54
votes
7 answers
Why is chaining setters unconventional?
Having chaining implemented on beans is very handy: no need for overloading constructors, mega constructors, factories, and gives you increased readability. I can't think of any downsides, unless you want your object to be immutable, in which case…
Ben
- 992
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
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
- 671
54
votes
7 answers
What is the preferred way to store application configurations?
Most of the time, I store development application config in root directory of the project, like this:
app
|-- config.json
But that doesn't seem to be the best approach, since this config ends up being stored in version control system - possibly…
Rogach
- 739
- 1
- 6
- 7
54
votes
8 answers
Is there a reason to have a bottom type in a programming language?
A bottom type is a construct primarily appearing in mathematical type theory. It is also called the empty type. It is a type that has no values, but is a subtype of all types.
If a function's return type is the bottom type, that means that it does…
GregRos
- 1,783
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
- 877
54
votes
6 answers
How much business logic should be allowed to exist in the controller layer?
Sometimes we have some business logic represented in the controller code of our applications. This is usually logic that differentiates what methods to call from the model and/or what arguments to pass them.
Another example of this is a set of…
jellyfishtree
- 1,241
54
votes
3 answers
What is a lambda, and why would it be useful?
So far I heard about :
Lambda calculus
Lambda programming
Lambda expressions
Lambda functions
Which all seems to be related to functional programming...
Apparently it will be integrated into C++1x, so I might better understand it…
jokoon
- 2,280
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,877
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
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
- 10
- 14
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
54
votes
7 answers
Why are semicolons and commas interchanged in for loops?
In many languages (a wide list, from C to JavaScript):
commas , separate arguments (e.g. func(a, b, c)), while
semicolons ; separate sequential instructions (e.g. instruction1; instruction2; instruction3).
So why is this mapping reversed in the…
Piotr Migdal
- 551
- 1
- 4
- 8
54
votes
3 answers
What is constructor injection?
I have been looking at the terms constructor injection and dependency injection while going through articles on (Service locator) design patterns.
When I googled about constructor injection, I got unclear results, which prompted me to check in…
TheSilverBullet
- 1,091
- 1
- 11
- 22