chr's People
chr's Issues
Readability of a fn
(defn changes
"Returns a collection describing, per field, the changes between `a` and `b`"
[a b]
(let [[only-a only-b _] (d/diff a b)
tuples (fn [coll [k v]] (conj coll [k v (get only-b k)]))
changes (fn [coll] (zipmap [:field :old :new] coll))]
(->> only-a
(reduce tuples '())
(flatten-data)
(map changes))))
It was not clear to me how this fn worked. In our team we do a lot of code reviews and try to make it that our code is easily understandable by our peers. Do you think this fn is readable enough, or could you make it more readable? And how?
Global vars
(p/connect "challange")
On the service namespace you have this. This means that whenever you load this namespace, you'll connect to the database? How could you make this so that the connection would only be made when needed?
Parallel parking
Hello,
Somewhere down the line, this service is deployed/delivered via several machines and has a considerable load. Because of some reasons that you cannot control, you start receiving duplicate requests for the same data. For example:
// request 1
{
"_id": 1,
"transactionId": "tx1",
"name": "Bruce Willis",
"address": {
"street": "Nakatomi Plaza"
}
}
// request 2
{
"_id": 1,
"transactionId": "tx1",
"name": "Bruce Willis",
"address": {
"street": "Nakatomi Plaza"
}
The systems that send these requests, also started sending a transactionId
that allows you to detect they are duplicate. For some more reasons, it's very problematic business wise to store duplicate data. You can only store one, even if you receive may. And all those many requests can be delivered at exactly the same time.
Can you elaborate on an approach to this?
Fast tracking
Hello mguinada,
I have followed your commits and read your code and nice work. Clean and total readable.
Now, imagine that this service is available and is been used by multiple machines that are calling the /save
endpoint like crazy.
How can you make sure that the data isn't getting messy? Something like different calls, on the same time, about the same user, maybe having the same timestamp but different street or name.
And on the other side, if this machines are requesting the creation of data like crazy, we can have a huge amount of data. How can you make sure that if we call the /changes
endpoint we will not be waiting big time?
Can your tell us your approach around these issues.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.