Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A few comments.</p> <p>I would avoid having a <code>MyCompany.Common.dll</code> assembly. These typically end up getting filled with all sorts of unrelated things which then get changed often requiring a rebuild of all of your assemblies.</p> <p>I would name your assemblies with the application name as well as the company name. <code>MyCompany.MyApplication.Business.dll</code> is preferable to <code>MyCompany.Business.dll</code>. It is then easier to split applications into sub parts and to reuse code from multiple applications.</p> <p>It's best to have separate contract assemblies for each type of implementation assembly you're going to have. In your case I would suggest the following:</p> <pre><code>MyCompany.MyApplication.Windows-Contract.dll MyCompany.MyApplication.Windows.dll MyCompany.MyApplication.Web-Contract.dll MyCompany.MyApplication.Web.dll MyCompany.MyApplication.Business-Contract.dll MyCompany.MyApplication.Business.dll MyCompany.MyApplication.Data-Contract.dll MyCompany.MyApplication.Data.AccountingSys1.dll MyCompany.MyApplication.Data.AccountingSys2.dll </code></pre> <p>From your description it appears that the <code>AccountingSys1</code> and <code>AccountingSys2</code> assemblies share a common contract hence only one contract assembly for the two implementation assemblies.</p> <p>Contract assemblies should represent your design, not your implementation, and only change because of design changes. You should avoid having any "significant" code (to avoid bugs) and you should constrain the code to interfaces, enums, exceptions, attributes, event args, and structs - all with no "significant" code.</p> <p>When setting up assembly references you should ensure that assemblies only ever reference contract assemblies, like so:</p> <pre><code>Data.AccountingSys1 Data-Contract Data.AccountingSys2 Data-Contract Business Business-Contract Data-Contract Windows Windows-Contract Business-Contract Data-Contract (maybe) Web Web-Contract Business-Contract Data-Contract (maybe) </code></pre> <p>As a result implementation assemblies never have a dependency on other implementation assemblies. When an implementation changes you only have one assembly to rebuild.</p> <p>The exception to this rule is when creating inheritance hierarchies. For example, you may create a <code>*.Data.AccountingSys.dll</code> to define base classes for the two specific accounting system assemblies.</p> <p>If you can follow all of the above then you will need to implement some sort of dependency injection approach to be able to create instances of objects from the interfaces in the contract assemblies. You could use an existing DI framework or create a third set of <code>*-Factory.dll</code> assemblies that contain your factory methods.</p> <p>A further benefit of this kind of structure is that unit testing is much simpler and can be based on the contracts rather than the implementation, helping you to write clean, testable code.</p> <p>This may seem like a lot of assemblies, but the benefits you get from keeping your code from creating nasty dependencies will significantly reduce the chance that your project will become too complex and will help drive good quality as you go. A little pain now will eliminate so much pain later.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload