Questions tagged [streams]
13 questions
6
votes
4 answers
Separate unidirectional streams vs single bidirectional stream
Over the years I've run into (and created) APIs around device communication (Serial, USB, TCP, Bluetooth, etc). At the bottom of these APIs are usually byte streams that can send data to the device and receive data from the device. Where they…
Rick de Water
- 171
6
votes
4 answers
How do you honour the principle to only do "one thing" in a method in reactive streams?
Uncle Bob mentions in his book "Clean Code" that "[f]unctions should do one thing [...] only" and advocates that a method should stick to one abstraction level (I'd call it flight level). I struggle a bit on how to do that in reactive programming,…
Christian
- 171
- 1
- 5
5
votes
3 answers
How to visualize a Stream object (and some other data types)?
I want to make a small programming tutorial which will have a number of images visualizing various data types, but I am not sure how to draw these images of the data types.
Assume that I have a FileOutputStream object that writes to the file…
johnny92
- 251
4
votes
3 answers
Alternating between Java streams and parallel streams at runtime
This is a question I constantly ask myself when designing a data intensive application: When is it appropriate to use stream() over parallelStream()? Would it make sense to use both? How do I quantify the metrics and conditions to intelligently…
user0000001
- 263
2
votes
2 answers
How to protect class invariants when using the extraction operator?
The C++ "standard" method for serializing and deserializing a data type is to use streams with the insertion (<<) and extraction (>>) operators. This has some flaws, but it does neatly allow you to use the same semantics to write anything to/read…
Patrick Wright
- 789
- 4
- 12
2
votes
4 answers
Is the Java Stream API intended to replace loops?
I mean the question in the sense of: Should the occurrence of simple loops on collections in code in Java 8 and higher be regarded as code smell (except in justified exceptions)?
When it came to Java 8, I assumed that it would be good to treat…
Matthias Ronge
- 517
1
vote
3 answers
Synchronized Web Audio Playback on Multiple Smartphones Using Timestamped Chunks and Manual Time Shifting
Note: I am not super knowledgeable web javascript or streaming, but I have read this and this and this I am proposing an alternate idea and just trying to verify whether I have a sound starting point in theory to build on.
Problem: You have an…
1
vote
2 answers
How do the SOLID principles apply in the context of Lambdas and Streams?
How are these principles applied in the context of streams and lambda expressions? In particular, the applicability with respect to the following three principles: - Single Responsibility Principle (SRP) - Liskov-Substitution Principle (LSP) -…
L m
- 133
1
vote
1 answer
What is the relationship between reactive programming and stream processing engines?
When would I use reactive programming libraries like RX Java and Project Reactor compared to stream processing engines such as Storm and Flink?
I am aware that these concepts might not be directly comparable, but I would like to understand the…
Hyggenbodden
- 157
1
vote
2 answers
How to refactor function chains for Java 8 Streams
I have a stream of data recordStream that I am collecting into a Map. Using a chain like this.
recordStream
.filter(Objects::nonNull)
.map(RoomSchedule::new)
.map(roomSchedule ->…
0
votes
0 answers
How does each application replica read a unique message from the message broker
In RabbitMQ streams or Kafka, messages are not deleted after being consumed. If you have a consumer application replicated across multiple Kubernetes pods, how can you ensure that each pod picks up a different message? For instance, if you store the…
Klention
- 9
0
votes
1 answer
Are RabbitMQ Streams overkill for 1 machine event-driven architecture aplication?
If developing event-driven application(more precisely event sourcing application) that will run solely on 1 machine are RabbitMQ Streams an overkill, or maybe a misfit?
In theory RabbitMQ Streams seem nicer than manual callback in code that are hard…
NoSenseEtAl
- 253
-1
votes
1 answer
Event Processing a Lack of Events
I am facing an issue that I don't believe is novel but none the less am having trouble finding a solution that fits well with our system. We have a constant stream of events going into AWS Kinesis. The way Kinesis works (to my understanding) is it…
Osman
- 107