Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework readme #32

Merged
merged 7 commits into from Jun 19, 2017
Merged

Rework readme #32

merged 7 commits into from Jun 19, 2017

Conversation

boguslavsky
Copy link
Contributor

No description provided.

@boguslavsky boguslavsky changed the title WIP: rework readme Rework readme Jun 13, 2017
@boguslavsky boguslavsky requested a review from slowli June 13, 2017 11:25
@boguslavsky boguslavsky mentioned this pull request Jun 13, 2017
9 tasks
Copy link
Contributor

@slowli slowli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments as of d869456. Nothing criminal, but I feel that there is room for improvement.

README.md Outdated
@@ -1,858 +1,304 @@
# Client for Exonum blockchain platform

JavaScript toolkit to work with Exonum blockchain from both of browser and Node.js.
This is JavaScript toolkit to work with Exonum blockchain from browser and Node.js.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I think a variant of

exonum-client is a JavaScript toolkit ...

is more popular with READMEs of packages in npm.

README.md Outdated

Returns an object of format type.
Each primitive data type has its own segment length (`size`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move this paragraph upper, directly after the "field structure" table.

README.md Outdated

##### newType.serialize(data)
Total length of the byte array must be also specified.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this duplicates the information from the "field structure" table and can be safely removed.

README.md Outdated

#### Timespec
All this operations are useful while work with a blockchain.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick/grammar: "These operations are useful in working with an Exonum blockchain."

README.md Outdated

Unsigned integer value of the length of `8` bytes. Represents Unix time in nanosecond.
To describe a custom data structure next basic primitive data types can be used:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"To describe" seems pretty vague. I'd say that these types can be used as the type field of the field description.

README.md Outdated
var secretKey = '6752be882314f5bbbc9a6af2ae634fc07038584a4a77510ea5eced45f54dc030f5864ab6a5a2190666b47c676bcf15a1f2f07703c5bcafb5749aa735ce8b7c36';

var signature = someType.sign(secretKey, data);
var secretKey = '07038584a4a77510ea5eced45f54dc030f5864ab6a5a2190666b47c676bcf15a1f2f07703c5bcafb5749aa735ce8b7c366752be882314f5bbbc9a6af2ae634fc';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: maybe, split private key/signature into 2 lines to improve readability?

README.md Outdated

##### newMessage.serialize(data, cutSignature)
Field structure:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, just refer to a section above instead of repeating the table?

README.md Outdated

---
Returns random `Uint64` of cryptographic quality as a string.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... as a hexadecimal string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it is not a hexadecimal string, just number passed as string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about:

Returns random `Uint64` of cryptographic quality as a number passed as string.

README.md Outdated

| Type | Size (bytes) | Description |
|---|---|---|
| `string` | `8` | String of UTF-8 characters |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The size of 8 bytes may be confusing.

README.md Outdated

| Type | Size (bytes) | Description |
|---|---|---|
| `Array` | any | Array of 8-bit unsigned integers |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Size: any" can be confusing, imo. The size is fixed in the field declaration, right? Maybe, write it here explicitly?

@boguslavsky
Copy link
Contributor Author

@slowli ready for review

Copy link
Contributor

@slowli slowli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick comments as of 441acf3.

README.md Outdated
@@ -35,7 +37,7 @@ Requires a single parameter passed as `object` with next structure:
| size | `number` | yes | The total length in bytes |
| fields | `Array` | yes | Array of fields |

Field structure:
###### Field structure:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use level-6 header here? I'd either remove a header formatting altogether, or use level-4 as implied by the hierarchical structure of the document.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason I've used header here is to have anchor. It is used below in newMessage section:

Field structure is the same as for [custom type](#fieldstructure) defined through `Exonum.newType` method.

Changed it to level-4 header.

README.md Outdated
---
| Field | Type | Is mandatory | Description |
|---|---|---|---|
| type | built-in primitive type / entity of a `NewClass` | yes | Field type. Can contains fields of a `NewType` types |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewClass

Do you mean NewType?

README.md Outdated

#### newType
- serialize data into a byte array;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I'd remove blank lines between list items here to get consistent formatting with a list of built-in types below.

Similar nitpicks below.

README.md Outdated

##### newType.serialize(data)
These types can be used as the `type` field of the field description:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: "These" -> "The following".

README.md Outdated
name: {type: Exonum.String, size: 8, from: 8, to: 16}
}
});
And it is necessary to specify segment range in the resulting byte array (`from` and `to`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: remove "And" and unite with the previous sentence into a single paragraph.

README.md Outdated

var signature = someType.sign(secretKey, data);
var secretKey = '07038584a4a77510ea5eced45f54dc030f5864ab6a5a2190666b47c676bcf15a
1f2f07703c5bcafb5749aa735ce8b7c366752be882314f5bbbc9a6af2ae634fc';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By splitting, I meant producing valid JS code:

var secretKey = '07038584a4a77510ea5eced45f54dc030f5864ab6a5a2190666b47c676bcf15a'
    + '1f2f07703c5bcafb5749aa735ce8b7c366752be882314f5bbbc9a6af2ae634fc';

README.md Outdated
protocol_version: 0,
service_id: 0,
message_id: 0,
signature: '07038584a4a77510ea5eced45f54dc030f5864ab6a5a2190666b47c676bcf15a1f2f07703c5bcafb5749aa735ce8b7c366752be882314f5bbbc9a6af2ae634fc',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: a signature here can be split to 2 lines.

README.md Outdated

```
$ grunt
```

#### Test
## Test coverage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't see coverage tasks in Gruntfile.js, and there seemingly aren't any coverage-related dev dependencies (such as istanbul). If you don't mean measuring test coverage here, I think "Testing" could be a better header caption.

@boguslavsky
Copy link
Contributor Author

@slowli changes applied, ready for review

Copy link
Contributor

@slowli slowli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as of 66e566c. Probably will need to add a bunch of badges once we go public, but this can wait.

README.md Outdated
|---|---|---|
| `string` | `8`* | String of UTF-8 characters |

*\*Note that the size of 8 bytes is due to the specifics of string [serialization](http://exonum.com/doc/advanced/serialization). Actual string length is not limited.*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: well, it's limited by the general message size limits (2 MB, afaik).


```
$ npm install
```

To build minimised and development versions of library execute:
Compile browser version into `dist` folder:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: technically, the prepublish command (which includes building the browser version) executes during npm install in npm < 5 😃 So, in some cases, this step may be redundant.

@boguslavsky boguslavsky merged commit 7ac96b9 into exonum:master Jun 19, 2017
@boguslavsky boguslavsky deleted the docs branch June 19, 2017 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants