> 2021年05月22日信息消化 #### 如何提升你的软件架构设计 原文: [How To Enhance Your Software Architecture Design](https://betterprogramming.pub/how-to-enhance-your-software-architecture-design-58668c3a5670) ##### What Is Architecture? > “Architecture is the **fundamental organization** of a system embodied in its **components** their **relationships** to each other and the **environment** and the **principles** guiding its design and evolution.” — IEEE 1471 (2000) > > “Architecture represents the significant design decisions that shape a system, where significant is measured by the cost of change.” — Grady Booch There are different types of architecture — for example, enterprise architecture, project architecture, business architecture, and information architecture. This article talks about designing a software system and its cohesion with other applications and information systems. We call this software architecture. ##### Architectural vision 只做那些实现第一组用户故事所需的架构设计决策,优先级最高。这是基于精益开发的原则,称为 "最后的责任时刻"。 Making only those architectural design decisions needed to implement the first set of user stories with the highest priority. This is based on the lean development principle called “The Last Responsible Moment.” > “Concurrent software development means starting developing when only partial requirements are known and developing in short iterations that provide the feedback that causes the system to emerge. Concurrent development makes it possible to delay commitment until the last responsible moment, that is, the moment at which failing to make a decision eliminates an important alternative. If commitments are delayed beyond the last responsible moment, then decisions are made by default, which is generally not a good approach to making decisions.” - 创建垂直切片或尖峰,以证明和验证架构设计决策。峰值应该始终提供一个开发团队可以展示的工作产品。 - 在开发过程中不要害怕改变或优化现有的架构决策。架构应该在开发过程中不断发展。 - 让架构成为团队的努力。团队应该做出设计决定。设计的想法应该由团队通过共同梳理产品积压来发展。 - Creating vertical slices or spikes to prove and validate architectural design decisions. The spike should always deliver a working product that the development team can demonstrate. - Not being afraid to change or optimize existing architectural decisions during development. The architecture should evolve during the development. - Making architecture a team effort. The team should make the design decisions. Design ideas should evolve from the team by combing through the product backlog together. ##### Requirements - [Furps+ from IBM](http://web.archive.org/web/20201112020231/http://www.ibm.com/developerworks/rational/library/4706.html#N100A7) - [ISO/IEC 25010:2011](https://www.iso.org/standard/35733.html) - [Older ISO 9126](https://en.wikipedia.org/wiki/ISO/IEC_9126) Don’t let the ISO qualification scare you. Use these lists as an inspiration to talk to your stakeholders. Ask them what the most important non-functionals for the new system are. 不要让ISO资质吓到你。把这些清单作为一种灵感,与你的利益相关者交谈。问问他们新系统最重要的非功能性指标是什么。 ##### Non-Functional Requirements How do you translate the non-functionals into a software architecture? By using patterns. For example, if the stakeholder values **maintainability**, you could use the **layer pattern** to separate several parts of the application. If **performance** is important, maybe layering is not the best solution. - Pattern-Oriented Software Architecture Volume 1: A System of Patterns by Frank Buschmann - Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma - Patterns of Enterprise Application Architecture by Martin Fowler - Clean Architecture: A Craftsman’s Guide to Software Structure and Design by Robert Martin - [The Open Group Architecture patterns](https://pubs.opengroup.org/architecture/togaf8-doc/arch/chap28.html) - [Architectural patterns on Wikipedia](https://en.wikipedia.org/wiki/Architectural_pattern) ##### Document the Architecture It does not matter how you document the architecture. Communication is key. You could add diagrams to please visually oriented people. Currently I see many people using [the C4 model](https://c4model.com/) for visualizing software architecture. I really like the simplicity of C4. Instead, the explanations should include information explaining the context and reasoning. If possible, document the tradeoffs, criteria, and decision-making that led to selecting a particular design. A good way to document the rationale is by using an architectural decision record (ADR). This is a document that captures an important architectural decision along with its consequences. Several [templates](https://github.com/joelparkerhenderson/architecture_decision_record) exist for documenting ADRs. ##### Validate the Architecture The reasons to perform an architecture assessment are the following: - Problems found early in the software lifecycle are easier to correct. - Refinement of architecture into an implementation preserves the qualities necessary for the final product to achieve those qualities. - You cannot append software quality late in a project. - [Software architecture analysis method (SAAM)](https://resources.sei.cmu.edu/library/asset-view.cfm?assetid=29288) - [Architecture tradeoff analysis method (ATAM)](https://resources.sei.cmu.edu/library/asset-view.cfm?assetid=513908) #### 用于软件架构的 C4 模型 https://www.infoq.cn/article/C4-architecture-model/ C4 代表**上下文(Context)、容器(Container)、组件(Component)\**和\**代码(Code)**——一系列分层的图表,可以用这些图表来描述不同缩放级别的软件架构,每种图表都适用于不同的受众。 第1 层:系统上下文 第1 层是系统上下文图,它显示了你正在构建的软件系统,以及系统与用户及其他软件系统之间的关系。  第2 层:容器 第2 层是一个容器图,将软件系统放大,显示组成该软件系统的容器(应用程序、数据存储、微服务等)。技术决策也是该图的关键部分。下是互联网银行系统的容器图示例。它显示了互联网银行系统(虚线框)由五个容器组成:服务器端Web 应用程序、客户端单页面应用程序、移动应用程序、服务器端API 应用程序和数据库。  第 3 层:组件 第 3 层是组件图,将单个容器放大,以显示其中的组件。这些组件映射到代码库中的真实抽象(例如一组代码)。一个虚拟的网上银行系统的组件图示例,显示了 API 应用程序中的一些组件(而不是全部)。  第4 层:代码 最后,如果你确实想要,或者说有这个必要,可以放大个别组件,以显示该组件的实现方式。以下是一个虚拟的网上银行系统的UML 类图示例(部分),显示了组成MainframeBankingSystemFacade 组件的代码元素(接口和类)。  ##### 符号 C4 模型没有预定义任何特定的符号,你在这些示例图中看到的是一个个简单的符号,适用于白板、纸张、便签、索引卡片和各种图表工具。你也可以使用 UML 作为符号,并适当使用包、组件和原型。无论你使用哪种符号,我都会建议让每个元素都包含名称、元素类型(即“人”、“软件系统”,“容器”或“组件”)、技术选型(如果有的话),以及一些描述性文字。在图表中包含如此多的文本可能看起来很不寻常,但这些附加文本有助于消除软件架构图中通常会出现的不明确的表示。  #### 什么是Web3?解读未来的去中心化互联网 原文:[What is Web3? The Decentralized Internet of the Future Explained](https://www.freecodecamp.org/news/what-is-web3/) ##### Web 1.0 Web 1.0 was the first iteration of the web. Most participants were consumers of content, and the creators were typically developers who build websites that contained information served up mainly in text or image format. Web 1.0 lasted approximately from 1991 to 2004. Web 1.0 consisted of sites serving static content instead of dynamic HTML. Data and content were served from a static file system rather than a database, and sites didn't have much interactivity at all. **You can think of Web 1.0 as the read-only web.** ##### Web 2.0 Most of us have primarily experienced the web in its current form, commonly referred to as [Web2](https://en.wikipedia.org/wiki/Web_2.0#top). You can think of Web2 as the interactive and social web.If you want to craft a thought and share it with the world, you can. If you want to upload a video and allow millions of people to see it, interact with it, and comment on it, you can do that too. For many Web2 companies like Google, Facebook, Twitter, and others, **more data leads to more personalized ads.** This leads to more clicks and ultimately more ad revenue. The exploitation and centralization of user data is core to how the web as we know and use it today is engineered to function. In Web2, you don’t have any control over your data or how it is stored. In fact, companies often track and save user data without their users' consent. All of this data is then owned and controlled by the companies in charge of these platforms. Users who live in countries where they have to worry about the negative consequences of free speech are also at risk. ##### Web 3.0 Web3 enhances the internet as we know it today with a few other added characteristics. Web3 is: - Verifiable - Trustless - Self-governing - Permissionless - Stateful - Native built-in payments In Web3, developers don't build and deploy applications that run on a single server or that store their data in a single database (usually hosted on and managed by a single cloud provider). Instead, **Web3 applications either run on blockchains, decentralized networks of many peer to peer nodes** (servers), or a combination of the two that forms a [cryptoeconomic protocol](https://thegraph.com/blog/modeling-cryptoeconomic-protocols-as-complex-systems-part-1). These apps are often referred to as dapps (decentralized apps), and you will see that term used often in the Web3 space. ##### How to Build on Web3 [How to Get Into Ethereum, Crypto, and Web3 as a Developer](https://www.freecodecamp.org/news/breaking-into-ethereum-crypto-web3-as-a-developer/) – This is an introduction to the space in general, coming from a developer, for developers looking to break into the industry. ### 一点收获 - https://twitter.com/zebriez/status/1395434830385532932?s=21