Note that there are some explanatory texts on larger screens.

plurals
  1. PODDD: how the layers should be organized?
    primarykey
    data
    text
    <p>I’m very much new in software development. Personally I think layered architecture is a great way to reduce the complexities that arise in the process of software development in object oriented approach and, not to mention, to keep your code organized. Now, I’ve run into some problems to be introduced with DDD (Domain Driven Design). Ofcourse, beginner level ones.<br> Here it is –<br> Let's say, I want to build an application to save “person” related data in database and display person details in a wpf datagrid (DDD is definitely not for the apps of such scale, but just to keep things simple for an amateur like me). So, I designed a domain class "Person", something like – </p> <pre><code>public class Person { public Person(dataType paramA, dataType paramB) { _fieldA = paramA; _fieldB = paramB; } private dataType _fieldA; public dataType PropertyA { //encapsulates _fieldA } private dataType _fieldB; public dataType PropertyB { //encapsulates _fieldB } public dataType PropertyX { //some code based on private fields } public dataType PropertyY { //some code based on private fields } private dataType MethodPQR(dataType param) { //some code } public dataType MethodUVW(dataType paramOne, dataType paramTwo) { //some code } } </code></pre> <p>Now, my understanding of DDD says the architecture (the simplest version of it) should be as follows (please, correct me if i'm wrong) –<br> <img src="https://i.stack.imgur.com/jYvXp.png" alt="enter image description here"><br> Note:</p> <ol> <li><p>I want the datagrid to be bound to some ObservableCollection, just to reflect any kind of changes instantly. </p></li> <li><p>It’s a wpf application but not necessarily to be in MVVM pattern and I deliberately want to use the code behind (I have no idea if the code behind itself represent the Application Layer)</p></li> </ol> <p>So my questions are – </p> <ol> <li><p>What kind of codes should belong to Application Layer? </p></li> <li><p>My guess is, I should definitely not bind an ObservableColletion of my domain object (Person) as the itmsSource of the datagrid. What type of object then I should extract from the domain object, and how? </p></li> <li><p>To keep a decoupling betwen Presentation Layer objects and Domain Layer object may be there’s a convention like <code>“never instantiate domain objects directly in presentation layer”</code>. What are the non-“direct” approaches then? </p></li> <li><p>If the Code-Behind talks to the Application Layer then should the Application Layer talk to the Repository? But what if some kind of domain access is needed which is <em>not</em> data access related (may be not in this app, but it may occur, right?) Who’s that X guy in Domain Layer that the Application Layer should talk to?</p></li> </ol> <p>I know all my questions and problems are of very much amateur level. But they are questions and problems indeed. So, if anybody has time, any response will be appreciated.</p> <p><strong>EDIT :</strong> I'm not sure if Data Repository should have a reference of Domain Model.</p>
    singulars
    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.
 

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