64 热度

Event Sourced Aggregate Design: Focus on Business Logic

Separating data and behaviors can have a pretty profound impact on your design. An Event Sourced Aggregate allows you to focus on business logic by having capabilities to produce data (Events). Event Sourcing does exactly this by limiting the amount of state you require only to that needed for business logic within an Aggregate.

收录时间: 2021-09-10
分类: 架构设计
贡献者: Rector
65 热度

Refactoring to Value Objects

Value Objects are a part of Domain-Driven Design, and Julie Lerman and I cover them in our DDD Fundamentals course on Pluralsight. Even if you're not applying Domain-Driven Design to your application, you can take advantage of refactoring your business classes to avoid code smells like primitive obsession (follow the link for more on refactoring and code smells). To demonstrate this concept, I'm going to show a simple class as it might start out, and then show how I would refactor it. (This is actually based on a conversation I just had with one of NimblePros' clients. I figured I might as well share my thoughts more broadly than just with that team! The actual types have been changed, but the principles can be applied generally.)

收录时间: 2021-09-09
分类: 架构设计
贡献者: Rector
106 热度

Comparing Techniques for Communicating Between Services

In distributed software applications, different services or processes or apps frequently need to communicate with one another. Modern architectural trends toward microservices and containers and cloud-native apps have all increased the likelihood that apps will increasingly be deployed not as single monoliths, but as collections of related services. There are only so many different ways these applications can communicate with one another, and each choice brings with it certain benefits as well as consequences and tradeoffs. Let's consider the options and assess each one based on its relative performance, scalability, app isolation or independence, and complexity. Also, if you're interested in this topic, you may also want to read about how to apply CAP theorem (and PACELC) to microservices.

收录时间: 2021-08-26
分类: 架构设计
贡献者: Rector
112 热度

Why do we need Dapr?

I think its fair to say that "microservices" has established itself as the leading way to architect a modern distributed cloud-native application. I've discussed many of the advantages of this approach over "monolithic" architectures in my Pluralsight courses such as Microservices Fundamentals...

收录时间: 2021-08-11
分类: 架构设计
贡献者: Rector
83 热度

Domain-Driven Refactoring: Defactoring and Pushing Behavior Down

In the last post, we looked at our procedural handler and pulled behavior out that called to external services into its own domain service. This let our handler become more unit testable by creating a test seam, and we could now alter the behavior of the abstraction through mocks/stubs etc.

收录时间: 2021-08-09
分类: 架构设计
贡献者: Rector
123 热度

Domain-Driven Refactoring: Extracting Domain Services

In my last post, we looked at the Compose Method refactoring as a means of breaking up long methods into smaller ones, each with an equivalent level of granularity. This is the refactoring in my applications I tend to use the most, mainly because it's the simplest way of breaking up a hard-to-understand method.

收录时间: 2021-07-30
分类: 架构设计
贡献者: Rector
AD 友情赞助
145 热度

What is CQRS?

What is CQRS? Traditional Software Development data models, which appear to indicate or infer that reads and writes are in synchronization when it comes to interacting with the database, in order to maintain the ACID( Atomicity, Consistency, Isolation, Durability) properties pertaining to the data.

收录时间: 2021-07-27
分类: 架构设计
贡献者: Rector
109 热度

Domain-Driven Refactoring: Long Methods

Posts in this series:Intro;Procedural Beginnings;Long Methods. In the last post, I walked through the main, immediate code smell we saw of a long method, and I would classify this method as long...

收录时间: 2021-07-23
分类: 架构设计
贡献者: Rector
131 热度

RabbitMQ和Kafka综合对比

消息队列中间件(简称消息中间件)是指利用高效可靠的消息传递机制进行与平台无关的数据交流,并基于数据通信来进行分布式系统的集成。 通过提供消息传递和消息排队模型,它可以在分布式环境下提供应用解耦、弹性伸缩、冗余存储、流量削峰、异步通信、数据同步等等功能,其作为分布式系统架构中的一个重要组件,有着举足轻重的地位。 目前开源的消息中间件有ActiveMQ、RabbitMQ、Kafka、RocketMQ、pulsar等,在整体架构中引入消息中间件,势必要考虑很多因素,比如成本及收益问题,怎么样才能达到最优的性价比?虽然消息中间件种类繁多,但是各自都有各自的侧重点,选择合适自己、扬长避短无疑是最好的方式。

收录时间: 2021-07-20
分类: 架构设计
贡献者: Rector
178 热度

Domain-Driven Refactoring: Intro

A common theme in domain-driven design are design patterns. When you start learning about DDD, you'll be presented with many code-level concepts such as...

收录时间: 2021-06-04
分类: 架构设计
贡献者: Rector
165 热度

Testing your Domain when Event Sourcing

How do you test your domain when Event Sourcing? I find testing aggregates with Event Sourcing to be simpler than testing if you’re storing the current state. The inputs to your aggregate are events and the output of your aggregate are events.

收录时间: 2021-05-21
分类: 架构设计
贡献者: Rector
214 热度

Event Based Architecture: What do you mean by EVENT?

The term “Event” is really overloaded. There are many different utilities that leverage events. Event Sourcing, Event Carried State Transfer, and Event Notifications. None of these are for the same purpose. When talking about an Event Based architecture, realize which one you’re using and for what purpose.

收录时间: 2021-05-06
分类: 架构设计
贡献者: Rector
285 热度

理解领域驱动设计

什么是领域,我习惯描述的是制药领域、环境领域、建筑领域、金融领域等,而在领域内,各种业务规则、业务知识盛行,如何有效的把控规则的变化,应对复杂知识,有一个很关键的四字词语,分而治之。分治法在很多场景下体现了其强大的作用力。领域本身很大,那就拆分,得到更小的领域,也即子域,如同递归调用一般,将一个复杂问题拆分单独求解,而最终将解汇总得到复杂问题解。怎么拆,拆成怎么样合适,依据什么拆,这些在领域驱动设计中有了一套答案,虽然领域驱动设计不是银弹,但可以说的上是一套极好的系统方法论或称为架构设计的方法论。领域驱动设计常以战略设计与战术设计来将整个领域展现的淋漓尽致,其作用范围既面向业务也面向技术...

收录时间: 2021-01-19
分类: 架构设计
贡献者: Rector
361 热度

CQRS与Event Sourcing之浅见

DDD是近年软件设计的热门。CQRS与Event Sourcing作为实施DDD的一种选择,也逐步进入人们的视野。围绕这两个主题,软件开发的大咖[Martin Fowler]、[Greg Young]、[Udi Dahan]分别有所论述,[MSDNC QRS Journey]、[Implementing DDD]、[Patterns, Principles, and Practices of DDD]等著述也提供了范例,国内外各大论坛的文章和DDD开源框架更是数不胜数,为学习CQRS和Event Sourcing提供了大量指导。其中,Greg Young的论文最为系统。故本文通过解读其论文,简单梳理了CQRS与Event Sourcing的发展脉络,厘出其中的主要技术重点,并提出以Akka作为落地方案,以求对这两个主题有一个较为全面的总结。错谬之处,还望指正。

收录时间: 2021-01-11
分类: 架构设计
贡献者: Rector
324 热度

Modular Monolith: Domain-Centric Design

In previous posts in this series, I covered what a Modular Monolith is, what its architecture looks like and how this architecture can be enforced. Then I described architectural drivers for this architecture and styles of integration between modules. In this post I would like to go deeper – a level lower and describe how such architecture can be designed. We are not going to implement this architecture yet – we will focus on its technology-agnostic design.

收录时间: 2020-12-02
分类: 架构设计
贡献者: Rector
AD 友情赞助
362 热度

CQRS Myths: 3 Most Common Misconceptions

Although Command Query Responsibility Segregation (CQRS) seems to be a term a lot of developers are aware of, I do think the majority have the wrong definition. Like many terms in the software development industry, things over time get confused, and then those confusing ideas propagate. These are the 3 CQRS Myths I see or hear the most often.

收录时间: 2020-11-05
分类: 架构设计
贡献者: Rector
493 热度

Immediate Domain Event Salvation with MediatR

Domain events are one of my favorite patterns and one Julie Lerman and I cover in our DDD Fundamentals course, on Pluralsight. I differentiate between two kinds of domain events: pre-persistence and post-persistence. You'll find a good implementation of post-persistence domain events (using MediatR) in my Clean Architecture solution template. However, until recently, I hadn't built an immediate, pre-persistence implementation of domain events for .NET using MediatR. This is meant to follow a similar approach to Udi Dahan's classic static helper, which relied on StructureMap and static methods.

收录时间: 2020-07-10
分类: 架构设计
贡献者: Rector
595 热度

.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)

依赖倒置(Dependency Inversion Principle,缩写DIP)是面向对象六大基本原则之一。他是指一种特定的的解耦形式,使得高层次的模块不依赖低层次的模块的实现细节,依赖关系被颠倒(反转),从而使得低层次模块依赖于高层次模块的需求抽象.

收录时间: 2020-05-12
分类: 架构设计
贡献者: Rector
620 热度

带你走进神一样的Elasticsearch索引机制

相比于大多数人熟悉的MySQL数据库的索引,Elasticsearch的索引机制是完全不同于MySQL的B+Tree结构。索引会被压缩放入内存用于加速搜索过程,这一点在效率上是完爆MySQL数据库的。但是Elasticsearch会对全部text字段进行索引,必然会消耗巨大的内存,为此Elasticsearch针对索引进行了深度的优化。在保证执行效率的同时,尽量缩减内存空间的占用。这篇文章就深度解析了Elasticsearch索引原理,揭开搜索的神秘面纱。更多精彩内容请看我的个人博客前言相比于大多数人熟悉的MySQL数据库的索引,Elasticsearch的索引机制是完全不同于MySQL的B+...

收录时间: 2020-04-21
分类: 架构设计
贡献者: Rector
635 热度

ElasticSearch专栏讲解(一)

ElasticSearch是一个用Java语言开发的分布式文档检索引擎。也支持文档存储功能,且不会将信息类似SQL存储为列数据,而是存储已序列化的JSON文档的复杂数据结构。而且ElasticSearch支持集群部署,当集群中有多个ElasticSearch节点时,存储的文档会分布在整个集群中,并且可以从任何节点立即访问。ElasticSearch是基于 Lucene 的搜索服务器,并且提供了标准的 RESTful web接口,作为 Apache 许可条款下的开放源码发布。

收录时间: 2020-04-20
分类: 架构设计
贡献者: Rector
AD 友情赞助