How to split Aggregate Root that have equal identity?

In DDD, creating smaller aggregates is encouraged where possible, but in a system we are designing we are running into an issue regarding the identity of aggregates.

The system evolves around phyisical events, like music festivals or sports events, and within these events there are separated bounded contexts representing some business use case. For example, there can be Accreditation and Badges.

Solution One

In a first design of the system we had modeled an Event aggregate (see Figure 1), where all business logic around Accreditation, Badges, and future business use cases would live.

enter image description here

Figure 1: Event aggregate

Solution Two

However, this would result in a huge aggregate, so we decided it would be best to split these up into smaller aggregates (see Figure 2). Events itself was no longer a concept because we had split these up into separate Accreditation and Badges. However, because they all refer to the same physical event, they only identifier we could come up with was the same eventId.

Implementing this with event sourcing would also raise the issue that there are multiple event streams with the same identifier.

enter image description here

Figure 2: Split aggregates with shared identity.

Solution Three

Another solution would be the “natural” DDD approach where we would tread the different modules as Entities with their own identity (see Figure 3). This however, feels very unnatural and does not represent the actual domain logic. In the implementation we would therefor also need a lookup table of some sort to map the eventId to the required moduleId (see Figure 4).

enter image description here

Figure 3: Split aggregates with own identity.

enter image description here

Figure 4: Lookup table that maps the event to their modules.


The question in this case is which of the following solution seems the most efficient and DDD-like approach?

Ability to split word document(s) into based on section breaks or quickparts

I have a template word document that is filled up by users. This word document contains text and tables that I wish to extract to sharepoint.

Is it possible to extract just the table in it and compare this extracted table with another extracted table from a different file (Also using the same template but with different fields).

Just want to know the feasibility of this concept

Split order based on source or location in M2.3

Background informations:

I’m working on a Magento 2.3 solution with a Click&Collect system, where the c&c locations have their own inventory, and a product can be bought online (shipping) or c&c (no shipping).

I know that M2.3 offer a Click&Collect feature but, on what I understand from the documentation, the feature permits to select a location where the customer will pickup all the products.

The system I’m working needs a different setup, customers can buy a product online (the product will be shipped) or a click&collect product (the product is already in the physical store), or both, and this need to create different orders. This is an example idea of the workflow, if is a mixed order with an online product and a click&collect product:

Checkout content:     -> customer pay ->      Order WEB001:                                               - Product 1 - Product 1 (online)                          - Product 2 - Product 2 (online)                          - Shipping cost - Product 3 (c&c)                                               Order CC001:                                               - Product 3 

I’m thinking to set it up using the multi source inventory of M2.3 (MSI), that it makes also easy to set the inventory stock for the locations, but I have some questions:

First question: Is it possible to setup/code M2.3 to create an order with a specific prefix code based on the source of a product?

Second question: In case of a mixed order, is it possible to setup/code M2.3 to split the order (create multiple orders) based on the source of the products?

Third question: In case of a mixed order, the customer pays the total he sees in the checkout with the selected payment method (e.g. PayPal). Considering the order will be split, how the payment works? Will be performed multiple transactions? Or just one transaction and Magento just split the amount paid based on the orders total?

I don’t have any code to show cause I’m working on the feasibility of the project but I lack informations from the official documentation. So I’m asking here if anybody have worked or have an idea on how the system should be to achieve this type of workflow.


How to split 2 teams for a FPS deatch match game in Unity?

I’m making a playable one level only FPS death match game in Unity. I’m in the part where the AIs now can find and shoot their own target and keep looping to find targets until nothing left. Every AIs and including player were tagged with tag “Target” for the AIs to randomly find their target. (I already excluded self finding).

Now I want to split them in 2 teams. And here is the thing that I keep wondering. Should I use 2 tags for 2 teams (like team red, team blue for ex) then make and attach 2 scripts separately for each AI in the team (the logic in the script will be like “team red” will find game object with tag “team blue” and vice versa). Is that how it works? Is there more efficient way or should I say, “smarter” way to work around this problem?

Here is the script if you need to know more about what I am trying to say

pythonic way to split bytes

I have incoming data from an absolute rotary encoder. It is 24 bits wide. 12 bits are the number of turns and 12 bits are the angle.

I’m reading the data with an Arduino and sending it to the computer over a serial port. The most natural thing to do would be to combine all of the bits and send it as 3 bytes.

Splitting up the 3 bytes into 12 bits/12 bits at the computer in Python 3 feels unpythonic to me. Here is what I have so far:

import struct  # fake message, H is header last 3 bytes are data msg = b'H\x90\xfc\xf9'   header, bytes3 = struct.unpack('>c3s', msg) print('bytes3 ', bytes3) val = int.from_bytes(bytes3, 'big') print('val ', val) print('bin(val) ', bin(val))  upper12 = val >> 12 print('bin(upper12)', bin(upper12)) lower12 = val & 0b000000000000111111111111 print('bin(lower12)', bin(lower12)) 

This code seems to work fine, but bitshifting (val >> 12) and bitwise anding (val & 0b000...) are a little wonky. Also it feels funny to specify Big Endian twice: first in the struct.unpack format string and second in int.from_bytes.

Is there a more elegant way to achieve this?

How does Hunter’s Mark interact with Black Pudding Split? [duplicate]

This question already has an answer here:

  • How do I handle active effects on a creature that then splits? 3 answers

After reading this answer about how Hunter’s Mark interacts with a Roper, a question occurred to me.

In the answer, Rykara uses the Black Pudding as an example of a single monster that could become multiple distinct creatures, thanks to its Split Reaction:

When a pudding that is Medium or larger is subjected to lightning or slashing damage, it splits into two new puddings if it has at least 10 hit points. Each new pudding has hit points equal to half the original pudding’s, rounded down. New puddings are one size smaller than the original pudding.

In the Hunter’s Mark description, it says that:

If the target drops to 0 hit points before this spell ends, you can use a bonus action on a subsequent turn of yours to mark a new creature.

Given that, what would happen when a Large Black Pudding with 85hp, targeted by Hunter’s Mark, takes 15 slashing damage?

Of course, it will divide into two Medium Black Puddings, each with 35hp.

But what about the Hunter’s Mark?

Here’s the possibilities I thought about :

  1. The Hunter’s Mark just vanishes, as the original target didn’t reach 0hp.
  2. The Hunter’s Mark is transferred to one of the new Puddings, as it was a part of the original targeted Pudding.
  3. The Hunter’s Mark is transferred to both new Puddings, for the same reason as above, but as it requires Concentration, one Hunter’s Mark disappears (the remaining situation is the same as possibility 2)
  4. The ranger that used Hunter’s Mark on the original Pudding can use a bonus action to mark a new creature, as the original Pudding may be considered to have reached 0hp at the time it split.

Split cells not importing first 0

I am using split formula:

=IFERROR(SPLIT(REGEXREPLACE(" , "&U4,  "(\d)",  "$  1 ,"),  ",  ")) 

It works great except if I have 0250, it imports it across as 250, even with the cell it’s importing from is set to #000 and it sits in the 1st 3 cells instead of the 2nd 3rd and 4th cells

When the number is 1250 it works fine, but if it’s 0250 then it comes through as 250 not 0250

python split file with certain conditions for each end line

I have a .txt file like this:

2019-03-29 12:03:07 line1                      line2                     line3                     .... 2019-03-30 07:05:09 line1                     line2                     .... 2019-03-31 10:03:20 line1                     line2                     .... 

I split the file into several files, like this:

inputData = 'dirname\..' numThrd  = 3 def chunkFiles():     nline = sum(1 for line in open(inputData,'r', encoding='utf-8', errors='ignore'))     chunk_size = math.floor(nline/int(numThrd))     n_thread = int(numThrd)     j = 0     with open(inputData,'r', encoding='utf-8', errors='ignore') as fileout:         for i, line in enumerate(fileout):             if (i + 1 == j * chunk_size and j != n_thread) or i == nline:                 out.close()             if i + 1 == 1 or (j != n_thread and i + 1 == j * chunk_size):                 chunkFile = 'rawData' + str(j+1) + '.txt'                 if os.path.isfile(chunkFile ):                     break                 out = open(chunkFile , 'w+', encoding='utf-8', errors='ignore')                 j = j + 1                 fLine = line[:-1]                 if not matchLine:             if out.closed != True:                 out.write(line)             if i % 1000 == 0 and i != 0: 

However, I want the split file to meet the condition that the last line in the chunk file must be right before the line that has the date.

recent output that I got:

rawData1.txt 2019-03-29 12:03:07 line1                     line2                     .... ------------------------- rawData2.txt                     line50                     line51 2019-03-30 07:05:09 line1                     line2                     ..... 

Desired output:

rawData1.txt 2019-03-29 12:03:07 line1                      line2                     line3                     .... ------------------------- rawData2.txt 2019-03-30 07:05:09 line1                     line2                     .... 

what should I add to the script above to meet that conditions?

Thank you very much