Skip to main content
5 votes
Accepted

Streams and clean architecture

As a C# guy, at a first glance, I tended to agreed to @GregBurghardt's answer. Then I had a look into the documentation of streams in Dart, which says: A stream is a sequence of asynchronous events. ...
Doc Brown's user avatar
  • 221k
3 votes
Accepted

Why does the collection library for Dart use a bit mask for hashing collections?

It's hard to know the exact reason for this. That it truncates the hash to fit into 31 bits suggests that it's related to compatibility with 32-bit signed integers. It's also true that the algorithm ...
JimmyJames's user avatar
  • 31.1k
3 votes

Streams and clean architecture

I associate streams with infrastructure-related code. As such, I would not expect a use case to return a stream. That being said, if the stream object is an interface or abstract class, you achieve ...
Greg Burghardt's user avatar
3 votes
Accepted

Is using an UId to hash Mutable Entities an anti-pattern?

There is no anti-pattern here. What you are observing is that when creating domain models, there are different ways how to model the concept of "identity" or "equality". Value ...
Doc Brown's user avatar
  • 221k
2 votes
Accepted

Where to place a common database connection in clean architecture?

I am currently trying to follow the clean architecture approach but i wonder where common things like a database connections should take place. Right here: Since i think a database connection usually ...
candied_orange's user avatar
2 votes

Best way to display errors from a model to the user?

There is a fundamental decision here that has locked you into this design. Your model is always available and known to everything. This has forced you to make your model mutable. Instead, you could ...
candied_orange's user avatar
2 votes

Why does the collection library for Dart use a bit mask for hashing collections?

It seems to be designed in a way where hashing resulting in 32 bit signed integers works. You get collisions, but only one in 2^31 hashes clash. That is enough so you need to have code to handle it, ...
gnasher729's user avatar
  • 49.4k
1 vote

Why does the collection library for Dart use a bit mask for hashing collections?

I can only guess, but here's what I think. First of all you would limit hashes to 32 bits. That's the size of hash that Java (and many other languages) expects. Now hash values are typically used in ...
freakish's user avatar
  • 3,085
1 vote

How do I model this scenario so that it adheres to OOP principles?

I can create a factory that maps all slide types to their respective subclass but that would require me modifying the factory for each subclass I add. Does that follow OOP principles? Such a factory ...
candied_orange's user avatar
1 vote

How do I model this scenario so that it adheres to OOP principles?

Having a factory method as the one-and-only place in the code that maps all slide types to their respective subclass is fine. It is a common approach in OO programming and often sufficient when the ...
Doc Brown's user avatar
  • 221k

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