Giter Club home page Giter Club logo

axr's Introduction

AXR

Ruby architecture for simplicity and team adoption

Architecture is hard. It’s very easy to build a complex system; much harder to build a simple and adaptable one. The code doesn't matter and coding for the sake of writing code is foolish.

Few of us get to write software that survives 5-10 years or longer. 90% of our work is garbage that becomes obsolete 1-3 years after release. Most of our work hours are wasted on features that never get shipped.

This is just reality.

(c) Volodya Sveredyuk

Setup

gem install axr

or in your Gemfile

gem 'axr'

in console

bundle install

DSL

In your ruby app: (for rails app put it into config/initializers)

require 'axr'

AxR.app.define do
  layer 'Api'
  layer 'YourBusinessLogic'
  layer 'Repo'
end

By default, layers will get level from top to bottom.

Api -> 0
YourBusinessLogic -> 1
Repo -> 2

Layers with lower-level have less isolation.

  • Api knows about YourBusinessLogic and Repo
  • YourBusinessLogic knows about Repo but don't know anything about Api
  • Repo fully isolated and don't familiar with Api and YourBusinessLogic

Options

require 'axr'

AxR.app.define do
  layer 'A'
  layer 'B', familiar_with: 'C'
  layer 'C', familiar_with: 'B'
  layer 'D', isolated: true
  layer 'E', isolated: true
end
# app.define options
AxR.app.define(isolated: true) # All layers will be isolated by default
AxR.app.define(familiar_with: ['D', 'E') # All layers will be familiar with D and E by default

# layer options
familiar_with: [...] # Can operate with other layers
isolated: true # 100% isolated and should not operate with other layers
isolated: true, familiar_with: [...] # Isolated from all except familiars

Can organize knowledge structure like:

drawing

CLI

Run AxR checker in console

axr check . --load path/to/you/app/autoload.rb

For rails apps

axr check . --load config/environment

Run for a specific directory

axr lib/adapters

Run for a specific file

axr lib/adapters/youtube.rb

More examples

ERP system

drawing

require 'axr'

AxR.app.define(isolated: true) do
  layer 'Api',    familiar_with: ['ERP']
  layer 'UI',     familiar_with: ['ERP']
  layer 'ERP',    familiar_with: %w[Inventory Sales Supply]
  layer 'Sales',  familiar_with: 'Inventory'
  layer 'Supply', familiar_with: 'Inventory'
  layer 'Repo'
  layer 'Change'
  layer 'Query'
end

TODO

  • Add sublayers
  • Add axr check --exit-on-warning cli flag

axr's People

Contributors

skrix avatar sveredyuk avatar

Watchers

 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.