Code Monkey home page Code Monkey logo

playground's Introduction

playground

This repository is for all kind of small experiments with different languages, tools and technologies

Layered Architecture

Currently I'm in the process of better understanding different approaches of layered architectures. Here are some helpful links I found during the understanding process:

Non Uniform Data Passing in a Layered Architecture

Example Code

cd ./layered-architecture/non-uniform
npm install
# init db
node init-db.js
# run the example code
node index.js

Active Record Pattern

  • Good for small to medium sized applications, which are heavily database driven
  • An active record object contains: model properties, getters and setters, domain logic and sql operations
  • Domain layer and data access layer is the same class

Data Mapper Pattern

  • Is an improvement compared to the active record pattern, because it splits the active record class in two separate classes
    • domain class (properties, getter/setter, domain logic)
    • data mapper class (sql operations, creation of domain class)
  • Problem: It's not clear in which layer (domain layer or data access layer) the data mapper belongs. He has a dependency on the domain class in the domain layer and to the sql connection in the data access layer.

Table Data Gateway Pattern

  • The domain layer and the data access layer is divided properly
  • the table data gateway in the data access layer has no dependency to the domain layer
  • the data mapper in the domain layer is responsible to convert between the models and the data

Example Code

cd ./layered-architecture/table-data-gateway
npm install
node index.js # run the example code
node reset-db.js # reset the db

Repository Pattern

Mission: Understand the repository pattern better and especially what is are the differences to the table data gateway pattern.

playground's People

Contributors

daraff avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.