@7rabbit/lead 中文文档教程

发布于 5年前 浏览 23 项目主页 更新于 3年前















lead

精益企业架构分布



简介安装插图




Introduction

所有的中小型公司都面临着同样的问题:代码杂乱无章,存在多种不同的命名约定、文件夹和文件约定以及实现约定。 动作以不同的方式分类并放入不同的文件和模块中,这对某些人来说很有意义,但对其他人来说却很难理解。 look and feel的实现没有太大的一致性,CSS在不同的实现中遍地开花。 总的来说,前端没有清晰和系统的方法来清理约定和实现样式,同时保持简单。

这个项目就是解决这个问题的。 它只有很少的代码行,并且是免费和公开许可的,因此可以在任何公司使用。 它所做的只是创建一个约定,将您的所有操作放在一个地方,并且操作管理状态。 正如您将了解到的,这解决了管理供应商锁定、代码的可测试性、集中知识库以及知道在哪里可以找到东西的问题。 它不是过度抽象,它只是按原样对待一切:作为行动。 所有动作都从一种状态开始,到另一种状态结束。 如果编程中有两个主要的东西,那就是对象和动作。 该项目在没有任何依赖性的情况下管理它们,因此它尽可能安全。

希望控制其代码的公司应该从这里开始。 控制应用程序中的操作。 删除使操作孤立的多余文件。 为每个操作编写测试以验证其行为。 这将有助于改进代码库。 此外,在这里保存您的操作对象。 将配置和设置以及任意数据保存在一个地方以简化调试。 使复杂的操作变得简单。 帮助新手轻松掌握代码,这样他们就不必通过复杂的导入和文件网络进行筛选。 这将使每个人都更容易理解代码,并提高产品开发的速度。

Installation

npm install @7rabbit/lead


Illustration

通用对象操作管理系统 (OAMS)

import { Lead, Zone } from '@7rabbit/lead'

let lead = new Lead()

lead.flow(...)

lead.zone('Button', props => <Zone border='b' click={open}>Click</Zone>)

lead.size('small', {
  minHeight: 100
  maxHeight: 100
  height: 100
  orientation: 'landscape'
})

lead.mark('font-fill', {
  a: 'black',
  b: 'white'
})

lead.live()

function open() {
  lead.call('openWindow', 'https://7.rabbit.cx')
}















lead

Lean Enterprise Architecture Distribution



IntroductionInstallationIllustration




Introduction

All small and medium sized companies suffer the same problem: code is a mess and disorganized, there are multiple different naming conventions, folder and file conventions, and implementation conventions. Actions are classified in different ways and placed into different files and modules, which makes sense to some and is difficult to understand for others. There is not much consistency in the implementation of the look and feel, and CSS is all over the place in different implementations. Overall, there is no clear and systematic approach to the frontend that cleans up the conventions and implementation styles and at the same times keeps it simple.

This project is a solution to this problem. It is very few lines of code and is freely and openly licensed so it can be used at any company. All it does is create a convention to place all of your actions in one place, and actions manage state. As you will learn this solves the problem of managing vendor lockin, of testability of the code, of centralizing the knowledge base and of knowing where to find things. It is not an over-abstraction, it just treats everything as they are: as actions. All actions start at one state and end at another. If there are two main things in programming they are objects and actions. This project manages them both without any dependencies, so it is as secure as it can be.

Companies looking to take control of their code should start here. Gain control over the actions in the application. Shed the excess files that kept the actions siloed. Write tests for each action to verify its behavior. This will help improve the codebase. In addition, save the objects of your actions here. Keep configuration and settings and arbitrary data in one place to ease debuggability. To make it simple to stub out a complicated action. To help ease newcomers into the code, so they don't have to weed through a complicated network of imports and files. This will make the code easier to understand for everyone, and will increase the velocity at which product is developed.

Installation

npm install @7rabbit/lead


Illustration

Generalized Object Action Management System (OAMS)

import { Lead, Zone } from '@7rabbit/lead'

let lead = new Lead()

lead.flow(...)

lead.zone('Button', props => <Zone border='b' click={open}>Click</Zone>)

lead.size('small', {
  minHeight: 100
  maxHeight: 100
  height: 100
  orientation: 'landscape'
})

lead.mark('font-fill', {
  a: 'black',
  b: 'white'
})

lead.live()

function open() {
  lead.call('openWindow', 'https://7.rabbit.cx')
}
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文