Architectural question: in which assembly should I put the class for a clean solution?

Preamble:

This is by far the longest post I have left here ... but I think it is necessary in this case.

I have had questions about these things for a long time: how to name assemblies and how to separate classes inside them.

I would like to give an example application here, with only a minimal number of classes, to demonstrate what I'm trying to understand.

Imagine an application that

  • receives client messages, saves them in db, and then deletes them to the MTA server.
  • This is a web application that has an ASP.NET interface for writing messages + attach attachments.
  • There is also a Silverlight client, so webapp provides ClientServices WCF ServiceContract with one operational loop (SaveMessage).
  • Also, the Windows client ... does the same as the Silerlight contract.

OK this should be enough of a fake script to demonstrate my ignorance.

The above will require the following classes:

  • Message
  • Messageaddress
  • MessageAddressType (listing from From, To)
  • MessageAddressCollection

  • MessageAttachment

  • MessageAttachmentType
  • MessageAttachmentCollection

  • MessageException

  • MessageAddressFormatException

  • MessageExtensions (static extension for the message)

  • MessageAddressExtensions (static extension for MessageAddress)
  • MessageAttachmentExtensions (static extension for MessageAttachment)

Project.Contract.dll

, Message, MessageAddress, MessageAttachment, , (MessageAddressType, MessageAttachmentType) , (MessageAddressCollection, MessageAttachmentCollection), [DataContract], WCF . , , "".

Project.Client.dll

- [ServiceContract], Contract.dll.

, , Project.Contract.dll, , WCF, db.

, , (, )...

() , , , , .

, , Message IMessageReadOnly... ?

Project.Interfaces.dll

Project.Interfaces.dll, , Contracts.dll... ... ...

, ( MessageAttachment ..)... ( Contracts.dll), ServerMessage/ServerMessageAddress/ServerMessageAddressCollection , IMessageReadOnly, , , . , BL .. , , , , ... ... , , , , , , Contract/Comm)...

-

... ... , ... ASP.NET? ServerMessage ( )... ( ). , ClientMessage Servermessage, ? UI?

, Silverlight... Full Framework..., Silverlight ( /)... , Silverlight , . ?

DataContract?

... , , ... , DataContract?

, MessageAddress DataContract. . , , ... ... messageAddress MessageAddressFormatException... DataContract?

, , ?

, BOTH ServerMessageAddress ClientMessageAddress, ... Common? ( ?)

/?

? ... ClientMessageAddressException, ServerMessageAddressException, ServerMessageVirusException ( )... - - MessageException... , enheritence/reusse ?

.

, ... , , , , ... SOOOO , , , , , , , ..

- - , , , , , , .

+2
2
+6

, , , , . , , . , . :

: ?

, , . , - .. , , , . . , , , , .

: , Silverlight, ASP.NET, ?

, . , , . , , .

: ?

, - .

: ?

, , . , .

Edit:

. , YAGNI . , , , .

+4

Source: https://habr.com/ru/post/1713019/


All Articles