Skip to content

Commit

Permalink
Update keeping-tabs-on-software-design-patterns-and-refactoring.md
Browse files Browse the repository at this point in the history
  • Loading branch information
KatherineMichel authored Jul 17, 2024
1 parent 4cf3152 commit 4efbf86
Showing 1 changed file with 214 additions and 109 deletions.
323 changes: 214 additions & 109 deletions keeping-tabs-on-software-design-patterns-and-refactoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,115 +285,6 @@ Item 90: Consider Static Analysis via typing to Obviate Bugs

## Martin Fowler

<!--
https://martinfowler.com/articles/patterns-of-distributed-systems/ | Patterns of Distributed Systems
Gossip Dissemination
Use a random selection of nodes to pass on information to ensure it reaches all the nodes in the cluster without flooding the network
HeartBeat
Show a server is available by periodically sending a message to all the other servers.
Lease
Use time-bound leases for cluster nodes to coordinate their activities.
## Clock
Clock-Bound Wait
Wait to cover the uncertainty in time across cluster nodes before reading and writing values so that values can be correctly ordered across cluster nodes.
Generation Clock
A monotonically increasing number indicating the generation of the server.
Hybrid Clock
Use a combination of system timestamp and logical timestamp to have versions as date and time, which can be ordered
Lamport Clock
Use logical timestamps as a version for a value to allow ordering of values across servers
## Consistency, Election, Quorum, Consensus Algorithm
Consistent Core
Maintain a smaller cluster providing stronger consistency to allow the large data cluster to coordinate server activities without implementing quorum-based algorithms.
Emergent Leader
Order cluster nodes based on their age within the cluster to allow nodes to select a leader without running an explicit election.
Leader and Followers
Have a single server to coordinate replication across a set of servers.
Majority Quorum
Avoid two groups of servers making independent decisions by requiring majority for taking every decision.
Paxos
Use two consensus building phases to reach safe consensus even when nodes disconnect
## Read Requests
Follower Reads
Serve read requests from followers to achieve better throughput and lower latency
## Requests
Idempotent Receiver
Identify requests from clients uniquely so you can ignore duplicate requests when client retries
Request Batch
Combine multiple requests to optimally utilise the network
Request Pipeline
Improve latency by sending multiple requests on the connection without waiting for the response of the previous requests.
Request Waiting List
Track client requests which require responses after the criteria to respond is met based on responses from other cluster nodes.
Single-Socket Channel
Maintain the order of the requests sent to a server by using a single TCP connection
Singular Update Queue
Use a single thread to process requests asynchronously to maintain order without blocking the caller.
## Updates
State Watch
Notify clients when specific values change on the server
Two-Phase Commit
Update resources on multiple nodes in one atomic operation
Version Vector
Maintain a list of counters, one per cluster node, to detect concurrent updates
Versioned Value
Store every update to a value with a new version, to allow reading historical values.
## Partitions
Fixed Partitions
Keep the number of partitions fixed to keep the mapping of data to partition unchanged when the size of a cluster changes.
Key-Range Partitions
Partition data in sorted key ranges to efficiently handle range queries.
## Logs
Segmented Log
Split log into multiple smaller files instead of a single large file for easier operations.
Write-Ahead Log
Provide durability guarantee without the storage data structures to be flushed to disk, by persisting every state change as a command to the append only log.
Replicated Log
Keep the state of multiple nodes synchronized by using a write-ahead log that is replicated to all the cluster nodes.
High-Water Mark
An index in the write-ahead log showing the last successful replication.
Low-Water Mark
An index in the write-ahead log showing which portion of the log can be discarded.
-->

### Refactoring

Martin Fowler, Refactoring, Patterns, ThoughtWorks
Expand Down Expand Up @@ -668,6 +559,220 @@ Base Patterns:
* Record Set (508)
-->

### Enterprise Integration Patterns

<!--
https://www.enterpriseintegrationpatterns.com/patterns/messaging/
https://www.enterpriseintegrationpatterns.com/ramblings/eip1_examples_updated.html
https://enterpriseintegrationpatterns.com/patterns/messaging/toc.html
-->

<!--
Integration Styles
Introduction to Integration Styles
File Transfer How can I integrate multiple applications so that they work together and can exchange information?
Shared Database How can I integrate multiple applications so that they work together and can exchange information?
Remote Procedure Invocation How can I integrate multiple applications so that they work together and can exchange information?
How can I integrate multiple applications so that they work together and can exchange information?
Messaging Systems
Introduction to Messaging Systems
Message Channel How does one application communicate with another using messaging?
Message How can two applications connected by a message channel exchange a piece of information?
Pipes and Filters How can we perform complex processing on a message while maintaining independence and flexibility?
Message Router How can you decouple individual processing steps so that messages can be passed to different filters depending on a set of conditions?
Message Translator How can systems using different data formats communicate with each other using messaging?
Message Endpoint How does an application connect to a messaging channel to send and receive messages?
Messaging Channels
Introduction to Messaging Channels
Point-to-Point Channel How can the caller be sure that exactly one receiver will receive the document or perform the call?
Publish-Subscribe Channel How can the sender broadcast an event to all interested receivers?
Datatype Channel How can the application send a data item such that the receiver will know how to process it?
Invalid Message Channel How can a messaging receiver gracefully handle receiving a message that makes no sense?
Dead Letter Channel What will the messaging system do with a message it cannot deliver?
Guaranteed Delivery How can the sender make sure that a message will be delivered, even if the messaging system fails?
Channel Adapter How can you connect an application to the messaging system so that it can send and receive messages?
Messaging Bridge How can multiple messaging systems be connected so that messages available on one are also available on the others?
Message Bus What is an architecture that enables separate applications to work together, but in a decoupled fashion such that applications can be easily added or removed without affecting the others?
Message Construction
Introduction to Message Construction
Command Message How can messaging be used to invoke a procedure in another application?
Document Message How can messaging be used to transfer data between applications?
Event Message How can messaging be used to transmit events from one application to another?
Request-Reply When an application sends a message, how can it get a response from the receiver?
Return Address How does a replier know where to send the reply?
Correlation Identifier How does a requestor that has received a reply know which request this is the reply for?
Message Sequence How can messaging transmit an arbitrarily large amount of data?
Message Expiration How can a sender indicate when a message should be considered stale and thus shouldn’t be processed?
Format Indicator How can a message’s data format be designed to allow for possible future changes?
Interlude: Simple Messaging
Message Routing
Introduction to Message Routing
Content-Based Router How do we handle a situation where the implementation of a single logical function (e.g., inventory check) is spread across multiple physical systems?
Message Filter How can a component avoid receiving uninteresting messages?
Dynamic Router How can you avoid the dependency of the router on all possible destinations while maintaining its efficiency?
Recipient List How do we route a message to a list of dynamically specified recipients?
Splitter How can we process a message if it contains multiple elements, each of which may have to be processed in a different way?
Aggregator How do we combine the results of individual, but related messages so that they can be processed as a whole?
Resequencer How can we get a stream of related but out-of-sequence messages back into the correct order?
Composed Message Processor How can you maintain the overall message flow when processing a message consisting of multiple elements, each of which may require different processing?
Scatter-Gather How do you maintain the overall message flow when a message needs to be sent to multiple recipients, each of which may send a reply?
Routing Slip How do we route a message consecutively through a series of processing steps when the sequence of steps is not known at design-time and may vary for each message?
Process Manager How do we route a message through multiple processing steps when the required steps may not be known at design-time and may not be sequential?
Message Broker How can you decouple the destination of a message from the sender and maintain central control over the flow of messages?
Message Transformation
Introduction to Message Transformation
Envelope Wrapper How can existing systems participate in a messaging exchange that places specific requirements on the message format, such as message header fields or encryption?
Content Enricher How do we communicate with another system if the message originator does not have all the required data items available?
Content Filter How do you simplify dealing with a large message, when you are interested only in a few data items?
Claim Check How can we reduce the data volume of message sent across the system without sacrificing information content?
Normalizer How do you process messages that are semantically equivalent, but arrive in a different format?
Canonical Data Model How can you minimize dependencies when integrating applications that use different data formats?
Interlude: Composed Messaging
Messaging Endpoints
Introduction to Messaging Endpoints
Messaging Gateway How do you encapsulate access to the messaging system from the rest of the application?
Messaging Mapper How do you move data between domain objects and the messaging infrastructure while keeping the two independent of each other?
Transactional Client How can a client control its transactions with the messaging system?
Polling Consumer How can an application consume a message when the application is ready?
Event-Driven Consumer How can an application automatically consume messages as they become available?
Competing Consumers How can a messaging client process multiple messages concurrently?
Message Dispatcher How can multiple consumers on a single channel coordinate their message processing?
Selective Consumer How can a message consumer select which messages it wishes to receive?
Durable Subscriber How can a subscriber avoid missing messages while it’s not listening for them?
Idempotent Receiver How can a message receiver deal with duplicate messages?
Service Activator How can an application design a service to be invoked both via various messaging technologies and via non-messaging techniques?
System Management
Introduction to System Management
Control Bus How can we effectively administer a messaging system that is distributed across multiple platforms and a wide geographic area?
Detour How can you route a message through intermediate steps to perform validation, testing or debugging functions?
Wire Tap How do you inspect messages that travel on a point-to-point channel?
Message History How can we effectively analyze and debug the flow of messages in a loosely coupled system?
Message Store How can we report against message information without disturbing the loosely coupled and transient nature of a messaging system?
Smart Proxy How can you track messages on a service that publishes reply messages to the Return Address specified by the requestor?
Test Message What happens, though, if a component is actively processing messages, but garbles outgoing messages due to an internal fault?
Channel Purger How can you keep 'left-over' messages on a channel from disturbing tests or running systems?
-->

### Patterns of Distributed Systems

<!--
https://martinfowler.com/articles/patterns-of-distributed-systems/ | Patterns of Distributed Systems
Gossip Dissemination
Use a random selection of nodes to pass on information to ensure it reaches all the nodes in the cluster without flooding the network
HeartBeat
Show a server is available by periodically sending a message to all the other servers.
Lease
Use time-bound leases for cluster nodes to coordinate their activities.
## Clock
Clock-Bound Wait
Wait to cover the uncertainty in time across cluster nodes before reading and writing values so that values can be correctly ordered across cluster nodes.
Generation Clock
A monotonically increasing number indicating the generation of the server.
Hybrid Clock
Use a combination of system timestamp and logical timestamp to have versions as date and time, which can be ordered
Lamport Clock
Use logical timestamps as a version for a value to allow ordering of values across servers
## Consistency, Election, Quorum, Consensus Algorithm
Consistent Core
Maintain a smaller cluster providing stronger consistency to allow the large data cluster to coordinate server activities without implementing quorum-based algorithms.
Emergent Leader
Order cluster nodes based on their age within the cluster to allow nodes to select a leader without running an explicit election.
Leader and Followers
Have a single server to coordinate replication across a set of servers.
Majority Quorum
Avoid two groups of servers making independent decisions by requiring majority for taking every decision.
Paxos
Use two consensus building phases to reach safe consensus even when nodes disconnect
## Read Requests
Follower Reads
Serve read requests from followers to achieve better throughput and lower latency
## Requests
Idempotent Receiver
Identify requests from clients uniquely so you can ignore duplicate requests when client retries
Request Batch
Combine multiple requests to optimally utilise the network
Request Pipeline
Improve latency by sending multiple requests on the connection without waiting for the response of the previous requests.
Request Waiting List
Track client requests which require responses after the criteria to respond is met based on responses from other cluster nodes.
Single-Socket Channel
Maintain the order of the requests sent to a server by using a single TCP connection
Singular Update Queue
Use a single thread to process requests asynchronously to maintain order without blocking the caller.
## Updates
State Watch
Notify clients when specific values change on the server
Two-Phase Commit
Update resources on multiple nodes in one atomic operation
Version Vector
Maintain a list of counters, one per cluster node, to detect concurrent updates
Versioned Value
Store every update to a value with a new version, to allow reading historical values.
## Partitions
Fixed Partitions
Keep the number of partitions fixed to keep the mapping of data to partition unchanged when the size of a cluster changes.
Key-Range Partitions
Partition data in sorted key ranges to efficiently handle range queries.
## Logs
Segmented Log
Split log into multiple smaller files instead of a single large file for easier operations.
Write-Ahead Log
Provide durability guarantee without the storage data structures to be flushed to disk, by persisting every state change as a command to the append only log.
Replicated Log
Keep the state of multiple nodes synchronized by using a write-ahead log that is replicated to all the cluster nodes.
High-Water Mark
An index in the write-ahead log showing the last successful replication.
Low-Water Mark
An index in the write-ahead log showing which portion of the log can be discarded.
-->

## Software Design Patterns

Design Patterns for Humans
Expand Down

0 comments on commit 4efbf86

Please sign in to comment.