Mon Apr 05 2021Journal

Coding tricks, software design

avatar
Xavier Bruhiere
linkedintwitterfacebook
intro picture
HEY:

Work in progress so considere this more like a brain dump than battle-tested knowledge (although the ideas do come from the trenches).

Project layout

Layout

src/
 |  entry.js
 |- config/
 |- models/
 |- services/

Dependency injection

Wrap the actual logic with a layer taking the DB service (instead of importing a client). It makes the code easier to test (mocking), less tied in implicit dependencies.

exort default (db) => {
  movies.userInfo = (usernamce, cb) => {
    db.query( /* … */ )
  }
}

From The perfect architecture flow





#coding#design#tips

Read Next

Reactive Python: Events processing

When developers spot an interesting approach to solve a recurrent issue in our industry, they formalize it as a design pattern. Today, we will discuss a powerful member of this family: the pattern observer. We won’t dive into the strict rhetorical details (sorry, not sorry). Instead, we will delve how reactive programming can level up the quality of our work.