This repository has been archived by the owner on Apr 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Define the APIs #1
Comments
Current infinitive verbs match well with the Daybed.session(server)
.records(modeld, function(records) {
// ...
}); Daybed.session(server)
.definition(modeld, function (definition) {
// ...
}); And use number of arguments to distinguish read / write : var records = [{age: 3.14}, ...];
Daybed.session(server)
.records(modeld, records, function(saved) {
// ...
}); var definition = {title: "tada", fields: [...]};
Daybed.session(server)
.definition(modeld, definition, function (saved) {
// ...
}); Or like : Daybed.session(server)
.model(modeld, function (model) {
// ...
}); Daybed.session(server)
.model(modeld)
.records(function(records) {
// ...
}); Daybed.session(server)
.model(modeld)
.save(record, function (saved) {
// ... if record.id was undefined, it was POSTed
}); |
Distinguishing between read / write operations with the number of arguments sounds like a terrible idea in the first place, especially for the code reader. It might be a cool thing for the person who's writing the code but it seems very complicated to distinguish between the read/write cases for a code reader if he doesn't know this rule about the number of arguments. Using single words for read operations could be an idea, but I prefer explicit over implicit. My python background maybe ! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
One thing that could be interesting to look at is how they propose some dream code, really simple to use, that we could use to start with. It's all here: http://nobackend.org/dreamcode.html
The text was updated successfully, but these errors were encountered: