DevChatter / ChatterBot

Highly modular Twitch chat bot.
MIT License
10 stars 5 forks source link

For consideration - introduction DomainModel assembly to help prevent leaking abstractions between assemblies #31

Closed SimonGeering closed 4 years ago

SimonGeering commented 4 years ago

Happy to do a PR for this if you want to assign it to me @benrick, if needs be we can discuss this as a draft PR first.

SimonGeering commented 4 years ago

Design Decision

@benrick , as mentioned in the PR #37 it is apparent that the better solution to this, which would keep assembly names in line with namespaces and the root namespace of assemblies reflecting of their usage would be as follows:

Option A - Repurpose the ChatterBot name:

  1. Rename ChatterBot to ChatterBot.WPF or similar
  2. Create a library assembly ChatterBot
  3. Extract all POCOs and Interfaces from all other assemblies except the main exe into appropriate sub-folders of the ChatterBot assembly matching the namespaces of the source assembly.
  4. Core would become the main domain implementation with all other dlls providing appropriate implementations as needed and DI tieing it together so everything only needs to reference the main ChatterBot assembly with the interfaces and POCOs in.

Option B - Add a new ChatterBot.API assembly to hold POCOs and Interfaces

  1. Add a new library assembly ChatterBot.API
  2. Set its root namespace to ChatterBot
  3. Extract all POCOs and Interfaces from all other assemblies except the main exe into appropriate sub-folders of the ChatterBot.API assembly matching the namespaces of the source assembly.
  4. Core would become the main domain implementation with all other dlls providing appropriate implementations as needed and DI tieing it together so everything only needs to reference the main ChatterBot assembly with the interfaces and POCOs in.

An example of this design can be see here https://github.com/SimonGeering/AdminAssistant/tree/dev/src/AdminAssistant

benrick commented 4 years ago

Agreed. Haven't switched project names yet, but you may notice the folder is UI for the wpf project now.

On Sun, Aug 9, 2020, 12:28 PM Simon Geering notifications@github.com wrote:

@benrick https://github.com/benrick , as mentioned in the PR #37 https://github.com/DevChatter/ChatterBot/pull/37 it is apparent that the better solution to this, which would keep assembly names in line with namespaces and the root namespace of assemblies reflecting of their usage would be as follows: Option A - Repurpose the ChatterBot name:

  1. Rename ChatterBot to ChatterBot.WPF or similar
  2. Create a library assembly ChatterBot
  3. Extract all POCOs and Interfaces from all other assemblies except the main exe into appropriate sub-folders of the ChatterBot assembly matching the namespaces of the source assembly.
  4. Core would become the main domain implementation with all other dlls providing appropriate implementations as needed and DI tieing it together so everything only needs to reference the main ChatterBot assembly with the interfaces and POCOs in.

Option B - Add a new ChatterBot.API assembly to hold POCOs and Interfaces

  1. Add a new library assembly ChatterBot.API
  2. Set its root namespace to ChatterBot
  3. Extract all POCOs and Interfaces from all other assemblies except the main exe into appropriate sub-folders of the ChatterBot.API assembly matching the namespaces of the source assembly.
  4. Core would become the main domain implementation with all other dlls providing appropriate implementations as needed and DI tieing it together so everything only needs to reference the main ChatterBot assembly with the interfaces and POCOs in.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DevChatter/ChatterBot/issues/31#issuecomment-671072396, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARDXKXQ676A3LYS7FQ6ZQDR73FBHANCNFSM4PYZFPEA .

SimonGeering commented 4 years ago

So rename exe to ChatterBot.UI, thereby freeing up the ChatterBot name for use as a container of interfaces and POCOs per the first option

benrick commented 4 years ago

Yep, I'll do another quick clean-up PR and put this in there.