快速 开发平台 架构

by Daniel Deutsch

由Daniel Deutsch

快速介绍清洁架构 (A quick introduction to clean architecture)

In an open source project I started to contribute to, the concept of “clean architecture” was brought to me.

在一个我开始参与的开源项目中 ,“清洁建筑”的概念被带给了我。

First, it was pretty overwhelming, but after some reading it made sense. I thought it might be helpful for others if I wrote down my thoughts.

首先,它非常令人难以理解,但是经过一番阅读之后,它才有意义。 我认为如果我写下自己的想法对他人可能会有帮助。

目录 (Table of Contents)

  • Visual representations

    视觉表现

  • The concept — presented in bullet points

    概念-以要点表示

  • Code example

    代码示例

  • Resources

    资源资源

视觉表现 (Visual representations)

I think it’s always good to start with some visualization.

我认为从一些可视化开始总是好事。

Here are the most common pictures of this concept.

这是此概念的最常见图片。

概念-以要点表示 (The concept — presented in bullet points)

Extended from Source and credit: Mattia Battiston, under CC BY 4.0

摘自来源和信誉: Mattia Battiston,根据CC BY 4.0

它可以提供的价值 (The value it can provide)

  • An effective testing strategy that follows the testing pyramid遵循测试金字塔的有效测试策略
  • Frameworks are isolated in individual modules. When (not if) we change our mind, we only have to make a change in one place. The app has use cases rather than being tied to a CRUD system框架隔离在各个模块中。 当(如果不是)我们改变主意时,我们只需要在一个地方进行更改即可。 该应用程序具有用例,而不是绑定到CRUD系统
  • Screaming architecture a.k.a. it screams its intended usage. When you look at the package structure, you get a feel for what the application does rather than seeing technical details尖叫的架构又称它的预期用途。 当您查看包的结构时,您会感觉到应用程序的功能,而不是看到技术细节
  • All business logic is in a use case, so it’s easy to find and not duplicated anywhere else所有业务逻辑都在用例中,因此很容易找到并且在其他任何地方都不会重复
  • Hard to do the wrong thing because modules enforce compilation dependencies. If you try to use something that you’re not meant to, the app doesn’t compile很难做错事情,因为模块会强制执行编译依赖关系。 如果您尝试使用不需要的内容,则该应用程序将无法编译
  • It is always ready to deploy by leaving the wiring up of the object for last. Or by using feature flags, so we get all the benefits of continuous integration通过将对象的布线留到最后,可以随时进行部署。 或通过使用功能标志,这样我们就可以获得持续集成的所有好处
  • Multiple works on stories so that different pairs can easily work on the same story at the same time to complete it quicker多个故事作品,以便不同的配对可以轻松地同时处理同一个故事,从而更快地完成故事
  • Good monolith with clear use cases that you can split in microservices later on, once you’ve learned more about them具有清晰用例的良好整体,一旦您了解了更多有关微服务的信息,便可以在以后将其拆分

实体 (Entities)

  • Represent your domain object代表您的领域对象
  • Apply only logic that is applicable in general to the whole entity (e.g., validating the format of a hostname)仅应用通常适用于整个实体的逻辑(例如,验证主机名的格式)
  • Plain objects: no frameworks, no annotations普通对象:无框架,无注释

用例 (Use Cases)

  • Represent your business actions: it’s what you can do with the application. Expect one use case for each business action代表您的业务行为:这就是您可以使用该应用程序执行的操作。 预期每个业务操作都有一个用例
  • Pure business logic, plain code (except maybe some utils libraries)纯业务逻辑,纯代码(也许某些utils库除外)
  • The use case doesn’t know who triggered it and how the results are going to be presented (for example, could be on a web page, or — returned as JSON, or simply logged, and so on.)用例不知道是谁触发了它,以及结果将如何显示(例如,可能在网页上,或者-以JSON返回,或者只是记录下来,等等)。
  • Throws business exceptions引发业务异常

接口/适配器 (Interfaces / Adapters)

  • Retrieve and store data from and to a number of sources (database, network devices, file system, 3rd parties, and so on.)从多个源(数据库,网络设备,文件系统,第三方等)检索数据并将数据存储到其中。
  • Define interfaces for the data that they need in order to apply some logic. One or more data providers will implement the interface, but the use case doesn’t know where the data is coming from为它们需要应用某种逻辑的数据定义接口。 一个或多个数据提供者将实现该接口,但用例不知道数据来自何处
  • Implement the interfaces defined by the use case实现用例定义的接口
  • There are ways to interact with the application, and typically involve a delivery mechanism (for example, REST APIs, scheduled jobs, GUI, other systems)与应用程序进行交互的方式很多,通常都涉及一种交付机制(例如,REST API,计划的作业,GUI,其他系统)
  • Trigger a use case and convert the result to the appropriate format for the delivery mechanism触发用例并将结果转换为交付机制的适当格式
  • the controller for a MVCMVC的控制器

外部介面 (External Interfaces)

  • Use whatever framework is most appropriate (they are going to be isolated here anyway)使用最合适的框架(无论如何它们都将在这里被隔离)

代码示例 (Code example)

See the structure on GitHub.

请参阅GitHub上的结构。

First of all, it is important to understand that clean architecture is a bundle of organising principles. So therefore everything is open to personal adjustments as long as core ideas are kept intact. The linked repository is a fork of the original project that brought this architecture design idea to me. Feel free to check out the original project as well, as it reflects further improvements.

首先,重要的是要了解干净的体系结构是一整套组织原则。 因此,只要保持核心思想不变,一切都可以进行个人调整。 链接的存储库是原始项目的分支,该项目将这个体系结构设计思想带给了我。 也可以随时检查原始项目,因为它反映了进一步的改进。

The webminer folder is structured into the basic layers:

webminer文件夹分为以下基本层:

  1. entities实体
  2. use_cases用例
  3. interfaces_adaptersinterfaces_adapters
  4. external_interfacesexternal_interfaces

It shall reflect the very basic approach for the design pattern.

它应反映出设计模式的最基本方法。

  • Starting from entities, you can see that the core model of this project is the arxiv_document

    entities开始,您可以看到该项目的核心模型是arxiv_document

  • The next folder, use_cases shows our use case, namely to request the arxiv page

    下一个文件夹use_cases显示了我们的用例,即请求arxiv页面

  • After that, we go through the interface_adapters folder that provides adapters for process requests in a REST application or for serializing

    之后,我们浏览interface_adapters文件夹,该文件夹为REST应用程序中的流程请求或序列化提供适配器

  • The final and last layer is external_interfaces. This is where we use the flask server to implement the REST functionality

    最后一层是external_interfaces 。 这是我们使用Flask服务器实现REST功能的地方

All of those layers are dependent on the core layers but not the other way around.

所有这些层都依赖于核心层,而不是相反。

One important note: This is not 100% correctly implemented in the repository.

重要注意事项:这不是在存储库中100%正确实现的。

Why? Because the use cases are actually different. In reality the main use case is to provide the structured data. Another use case is to get the data from the arxiv page.

为什么? 因为用例实际上是不同的。 实际上,主要用例是提供结构化数据。 另一个用例是从arxiv页面获取数据。

Did you spot this error in the architecture? If yes, congratulations! Not only did you bring enough curiosity to this article but you likely understand the principles well enough to build your own case and apply the concepts in reality!

您在架构中发现此错误了吗? 如果是的话,恭喜! 您不仅为本文带来了足够的好奇心,而且您可能充分理解了这些原理,可以建立自己的案例并在现实中应用这些概念!

Do you agree? If not, why? Thanks for reading my article! Feel free to leave any feedback!

你同意吗? 如果没有,为什么? 感谢您阅读我的文章! 随时留下任何反馈!

翻译自: https://www.freecodecamp.org/news/a-quick-introduction-to-clean-architecture-990c014448d2/

快速 开发平台 架构

快速 开发平台 架构_快速介绍清洁架构相关推荐

  1. 度量快速开发平台端口映射的介绍

    度量快速开发平台在客户中部署的时候,可能会想内网与外网用户同时使用.一般情况下,服务端都是部署在内网的,那外网用户要访问,就可能用到端口映射的功能.端口映射基本都是在路由器上进行. 下面就是几个常用的 ...

  2. 快速开发平台分享-UCML快速开发七种武器

    传统的快速开发平台强调的是组件重用.构件重用,主要解决功能重用层面,一般提供了软件开发最常用的功能:表单设计.BPM(业务流程管理).报表.组织机构及权限等功能.但只有功能重用,没有过程重用,要么只能 ...

  3. pythonweb快速开发平台_30分钟快速搭建Web CRUD的管理平台--django神奇魔法

    加上你的准备的时间,估计30分钟完全够用了,因为最近在做爬虫管理平台,想着快速开发,没想到python web平台下有这么非常方便的框架,简洁而优雅.将自己的一些坑总结出来,方便给大家的使用. 准备环 ...

  4. 道一云七巧-低代码快速开发平台 JNPF快速开发平台 3.4 更新介绍说明

    道一云 道一云是业内领先的云计算公司,致力帮助政府和企业,在智能时代不断提升管理和营运水平,持续数字化创新,让工作更高效.道一云是中国新一代协同云产品领军企业.腾讯战略投资企业.腾讯生态核心合作伙伴. ...

  5. NW(New World)快速开发平台介绍(完整的中小型管理系统解决方案)

    在公司做了3年多的web平台开发,自己(和同事)总结了一套快速开发平台,定位于快速开发中小型的管理系统.NW开发平台是一个完整的解决方案,包括前端组件.权限.事务.dao.报表.vo生成器.eclip ...

  6. 最近在推广一款快速开发平台,C/S架构中最好的快速开发平台

    度量快速开发平台,是度量科技自主开发的基于SOA面向服务的应用系统开发平台,可以方便快捷的搭建企业.医院.工厂.学校等行业的企业级运营管理平台.平台采用.net.技术构架,webservice服务搭建 ...

  7. vue手机端回退_推荐3个快速开发平台 前后端都有 接私活又有着落了

    经常性逛github,发现了一些优秀的开源项目,其中的框架及代码非常不错,现在给大家推荐三个快速开发平台. 第一个就是优秀的Jeecg-boot快速开发平台 前端采用阿里的ant-design-vue ...

  8. JeecgBoot 2.0.2 版本发布,基于SpringBoot快速开发平台

    项目介绍 Jeecg-Boot 是一款基于SpringBoot+代码生成器的快速开发平台!采用前后端分离架构:SpringBoot,Ant-Design-Vue,Mybatis,Shiro,JWT.强 ...

  9. JeecgBoot 2.1 Online表单版本发布,基于SpringBoot+AntDesign的快速开发平台

    项目介绍 Jeecg-Boot 是一款基于SpringBoot+代码生成器的快速开发平台!采用前后端分离架构:SpringBoot,Ant-Design-Vue,Mybatis,Shiro,JWT.强 ...

  10. Jeecg-Boot 一款基于SpringBoot 快速开发平台

    Jeecg-Boot 一款基于SpringBoot 快速开发平台 Jeecg-Boot 是一款基于SpringBoot+代码生成器的快速开发平台!采用前后端分离架构:SpringBoot,Mybati ...

最新文章

  1. ecshop去掉“云服务中心”或者是“模板堂知识库”
  2. C++ dll 类型与 C#类型对应关系
  3. TC(Table Control)自定义F4
  4. bootstrap checkbox选中事件
  5. eayUi panel实现上一页下一页
  6. win8 - 学习资源
  7. Android官方开发文档Training系列课程中文版:与其它APP交互之从Activity获得结果
  8. JavaScript基础---字符串方法
  9. 查看程序用运时占用的内存
  10. 【代码优化】equals深入理解
  11. Oracle之现有表上建新表、操作符、字符函数
  12. IDEA 社区版配置 Tomcat
  13. JAVA图书管理系统不用数据库_java简单的图书管理系统(只用java代码不用数据库和可视化界面,一个管理员表和图书表)...
  14. CTFshow-萌新
  15. php写的微信聊天界面,Android_Android高仿微信聊天界面代码分享,微信聊天现在非常火,是因其 - phpStudy...
  16. JS:函数中的arguments
  17. python获取gps数据_Python GPS模块:读取最新的GPS数据
  18. sql语句ding_Navicat写sql语句的具体方法步骤
  19. element组件------form
  20. android studio 光标 输入法,解决IDEA2018.1.5或者Android Studio 3.0版本的输入法不跟随光标问题...

热门文章

  1. 用html怎么 显示直线,html怎么用鼠标画出一条直线,鼠标移动时候要能看到线条...
  2. iOS 仿微信灵活添加标签
  3. iOS 根据数组中的字典的value值进行排序
  4. 【iOS】Socket/TCP 通信 发送 NSString 字符串格式数据
  5. ORA-08002: sequence MySeq.currval is not yet defined in this session
  6. Nginx—核心配置location匹配规则说明
  7. Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException
  8. 1004_C/C++笔试题_13:16道c语言面试【8/9】
  9. Swift快速入门之getter 和 setter
  10. 记住这35个英文单词,你就可以在RPA界混了!