codenow / code-styleguide Goto Github PK
View Code? Open in Web Editor NEWcontains runnable coding guidelines to maintain consistency across all our repos
contains runnable coding guidelines to maintain consistency across all our repos
Let us discuss our new coding patterns now that we moved everything to promises:
Method 1 Linear program w/ comments
Promise.try(() {
// JSDoc
... code ...
})
.then(doSomething1 () {
// JSDoc
... code ...
})
.then(doSomething2 () {
// JSDoc
... code ...
})
.then(doSomething3 () {
// JSDoc
... code ...
})
Pro: looks linear
Cons: unit testing is harder, requires more setup
Method 2 Functional
Promise.try(() {
return fn1()
})
.then(() {
return fn2()
})
.then(() {
return fn3()
})
.then(() {
return fn4()
})
// JSDoc
fn1 = {
... code ...
}
// JSDoc
fn2 = {
... code ...
}
// JSDoc
fn3 = {
... code ...
}
// JSDoc
fn4 = {
... code ...
}
Pro: functions are broken up into smaller components. Each function can have proper unit tests and docs
Con: have to look at different areas on the page to understand full function.
Any other methods people prefer & which do you like the most?
Writing some notes down before committing so everyone can agree and provide input
Some discussion arised regarding testing patterns
https://github.com/CodeNow/api/pull/1208/files#r46918040
This is related to #1 but with more narrow focus.
The questions is when do we stub function:
beforeEach
/afterEach
for stubbing/restoring. Not using parent beforeEach
/afterEach
and being explicit. Also it's ok to create describe
with single it
in order to stub everything specific for a test inside beforeEach
beforeEach
/afterEach
Please correct options I provided and please express your opinion with more details.
Let's settle one some convention and use it across all the codebase.
@anandkumarpatel, @bkendall, @cflynn07, @Myztiq, @thejsj, @rsandor
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.