mafintosh / hyperdb

Distributed scalable database
MIT License
753 stars 75 forks source link

Writing Examples for HyperDB #91

Open simplygreatwork opened 6 years ago

simplygreatwork commented 6 years ago

I'd like to write some significant examples for using HyperDB. But I'd prefer to use some scaffolding. My current favorite options are either async/wait, Step.js, or Highland.js streams to zip sequential callback values. I'm leaning toward using Highland streams. I completely appreciate that Mathias is using simple JavaScript for HyperDB instead of every latest feature of JavaScript. Keep it simple. But does anybody have a favorite means for expressing sequential operation in JavaScript simply?

pfrazee commented 6 years ago

FWIW I'll be putting together the DatDB for Beaker, and probably create something like https://github.com/beakerbrowser/node-dat-archive

On Fri, Mar 23, 2018 at 2:00 PM, Philip Weaver notifications@github.com wrote:

I'd like to write some significant examples for using HyperDB. But I'd prefer to use some scaffolding. My current favorite options are either async/wait, Step.js, or Highland.js streams to zip sequential callback values. I'm leaning toward using Highland streams. I completely appreciate that Mathias is using simple JavaScript for HyperDB instead of every latest feature of JavaScript. Keep it simple. But does anybody have a favorite means for expressing sequential operation in JavaScript simply?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mafintosh/hyperdb/issues/91, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNhUwPwu34O7EKTFg_zvfDJM7AD-0Hlks5thUZpgaJpZM4S5On8 .

simplygreatwork commented 6 years ago

The answer to my question might be as simple as: https://github.com/mafintosh/hyperdb/blob/master/test/helpers/run.js But I'll need to review further.

Also, Paul @pfrazee created an amazing API for Beaker's WebDB. It's modeled after the API for Dexie DB. Definitely, take a look. Just another shout out for high-quality work built by people who get it.

pfrazee commented 6 years ago

@simplygreatwork appreciate that

m-onz commented 6 years ago

I think its better to use the lowest common denominator and to write examples in the style that the project is written in... its up to the developer using the library to add their paticular stylistic choice.

Streams, vanilla / simple JS with no modern Javascript features is the most portable and least opinionated way to write NPM modules. It should be up to the consumer to use the library with any modern JS feature or build chain they desire... thats why I like all of @mafintosh projects because they allow the consumer of the library the most freedom.

mafintosh commented 6 years ago

Ya the idea behind the APIs of hyperdb, hypercore etc is to provide small stable apis for people to build stuff on top. I'm completely behind writing higher level abstractions that make it easier to use in specific usecases. In fact I hope many different high-level modules will appear. Having guides for how to use it would be amazing! :)

philcockfield commented 5 years ago

@simplygreatwork - did you end up writing any guides?