Questions tagged [domain-object]
Domain Objects are objects made for dealing with the domain logic at the Model layer. These objects generally simulate real (or virtual) items from real-life: Person, Post, Document, etc.
98
questions
85
votes
4
answers
73k
views
Differentiating between domain, model, and entity with respect to MVC
Can someone explain these 3 concepts and the differences between them with respect to an MVC framework along with an example. To me these appear almost equivalent, and it seems they are used ...
64
votes
4
answers
41k
views
Difference between Transfer objects and Domain objects
Could you please explain the difference between Transfer objects and Domain objects in simple terms ? And if u could give a Java example, that would be great..
41
votes
4
answers
31k
views
Domain objects/services and the Business Logic Layer
What are domain objects and domain services in software architecture? I am not familiar with them or how they differ from the business logic layer?
33
votes
4
answers
9k
views
How do one use ACL to filter a list of domain-objects according to a certain user's permissions (e.g. EDIT)?
When using the ACL implementation in Symfony2 in a web application, we have come across a use case where the suggested way of using the ACLs (checking a users permissions on a single domain object) ...
15
votes
3
answers
1k
views
Implementing a S.O.L.I.D Domain Object Model in the following project
I have the following example in which I tend to use a couple of classes, to create a simple web app.
The file hierarchy seems like this.
> cupid
- libs
- request
- router
...
15
votes
7
answers
2k
views
What is the best way to refactor presentation code out of my domain objects in an ASP.NET MVC solution?
I have just taken over an ASP.NET MVC project and some refactoring is required, but I wanted to get some thoughts / advice for best practices.
The site has an SQL Server backend and here is a ...
15
votes
1
answer
1k
views
Symfony2: How to find the users that have permissions for a certain domain object?
In our application based on Symfony2 we would like to create a list of which of the users in the system that has permissions for a given domain object. We are using ACL and our immediate instinct was ...
8
votes
3
answers
6k
views
Domain Objects and Value Objects - are they equal?
By looking to the example of a Domain Object into Zend Quickstart tutorial, and other examples considering a DAO/VO patterns, they both seem to be very similar.
Can we deduce that to say "Value ...
8
votes
4
answers
5k
views
Are domain objects the same as JPA entities?
Are domain objects the same as JPA entities? If I have a value object (e.g. a dollar bill), how can I (or even should I) store that in the datastore as a reference object?
What are the subtleties of ...
8
votes
3
answers
2k
views
DDD, PHP. Domain Object and Business Logic
I've been very busy with trying to understand the concepts of ddd and Model layer lately. Read tons of articles, examples, Q and A's, spent many hours on it. And still I'm not sure if I got some ...
7
votes
1
answer
2k
views
Modify and validate a grails domain object without saving it
How do I use the GORM .get to retrieve an object o, modify some fields, and call o.validate() to find errors without Hibernate saving the object to the DB. discard by itself does not prevent the save....
7
votes
2
answers
4k
views
Grails Domain Classes in Sets
Is it a bad practice to use domain objects in Sets or as keys in Maps?
In the past I've done things like this a lot
Set<Book> someBooks = [] as Set
someBooks.addAll (Book.findAllByAuthorLike('%...
7
votes
2
answers
573
views
Where to put domain logic which needs to fetch data from database
I know that domain logic should be placed into domain objects. But what if my domain logic needs data from the database ? (e.g. checking unique value, computed values.. etc ) I think injecting ...
6
votes
2
answers
4k
views
DDD, PHP - where to perform the validation?
I started playing with DDD recently. Today I'm having a problem with placing validation logic in my application. I'm not sure what layer should I pick up. I searched over the internet and can't find ...
5
votes
3
answers
3k
views
where should I do the conversion: Domain object<->DTO?
In Domain Layer or Data access layer?
5
votes
1
answer
7k
views
How do I initialise a Date field in a Grails domain object to act as a timestamp?
I have a domain class which has two dates in it and I want one of them populated with the current time when a record is created for the object, like a create timestamp...
class Contact {
Date ...
4
votes
4
answers
3k
views
Constructing a Domain Object from multiple DTOs
Suppose you have the canonical Customer domain object. You have three different screens on which Customer is displayed: External Admin, Internal Admin, and Update Account.
Suppose further that each ...
4
votes
1
answer
5k
views
Is this a valid use of Grails transients?
I have a domain object on which I want to store a few things which only exist at runtime. I looked at the documentation and found the transients keyword, which, on the face of it was what I was ...
4
votes
2
answers
2k
views
Service Layer validation vs. Domain Object validation; potential "abuse" of Domain Objects?
I've seen lots of book and article examples saying to put validation code in your Service Layer. Keep the Domain Objects "dumb" (aka, pure POCO's) and handle all validation that a Domain Object might ...
4
votes
2
answers
1k
views
Grails named queries not working with "in" statement
I have a Grails application (2.2.4). Where in domain class I have looks like this
class Author implements Serializable {
....
static hasMany = [
book : Book
]
static namedQueries = {
...
4
votes
2
answers
3k
views
Service contracts vs. domain objects
Say I have two interfaces to my application:
A web front-end
A back-end which provides data
Both of them talk to a web-service, and that web-service in turn, handles business logic and talks to a ...
3
votes
5
answers
2k
views
How do you use Interfaces with the Factory Pattern in Domain-Driven Design?
Does it make sense to use interfaces for your domain object factories by default, or should interfaces be reserved for the factory classes only when you need them?
public IUserFactory
{
User ...
3
votes
2
answers
881
views
Domain Model or Domain Object ? - Definitions
Please correct me if I'm wrong.
We may say Domain Model to represent:
a) The M part of a MVC structure, having on the M part, a Domain Driven Design pattern applied.
b) A scheme of entities, their ...
3
votes
2
answers
497
views
Should I use my ORM generated objects as my domain object?
My ORM is generating objects reflecting the database table structure. This objects are extensible, so I'm able to add new properties and methods. This objects do not contains any persistence logic,so ...
3
votes
1
answer
1k
views
Using grails configuration values in domain object constraints
Grails 2.2.0
How do I access the custom configuration variables in a Grails domain object constraints.
I would like to have something like this:
class User {
def grailsApplication
...
3
votes
2
answers
4k
views
AutoMapper Map single list on source object into two lists on destination object
I'm attempting to use AutoMapper to map from a Domain-object that contains a list of objects, where I have a boolean property, that I want to use a the property that AutoMapper uses to split that list ...
3
votes
2
answers
144
views
Usage patterns/use cases for DI or when to start using it
I'm not sure for which use cases one should to use DI in the application. I know that injecting services like PlaceService or CalculationService etc fits very well but should I also create my domain ...
3
votes
1
answer
2k
views
How should the domain object and data mapper interact within a service class for an auth system using MVC
I’m creating an authentication / login system using Slim 3 PHP on the back-end and Angular on the front-end and I’m trying to understand the ‘domain object’ and ‘data mapper’ part of a model layer ...
3
votes
1
answer
162
views
Serialize Domain instance with service injected?
I have a Domain object that tracks the user that created, deleted and modified it using the injected Spring Security service, def springSecurityService. Instances of these objects are saved in the ...
3
votes
1
answer
2k
views
How should a data mapper return a domain object?
In my model layer I have data mappers, domain objects, and "services" (to liase outside the model layer). I chose to implement a DomainObjectFactory and a DataMapperFactory, which has left me stuck on ...
3
votes
2
answers
308
views
Is a "domain object" any class that represents business rules?
I came across the term "domain object" and found a couple of definitions on Google but I just want to verify that my understanding is correct.
Is this simply any class that represents business rules ...
3
votes
1
answer
1k
views
How can I Make a Successful Domain Object Factory in PHP
I'm fiddling with an MVC framework, and I stumbled upon a problem I'm not sure how to solve.
I want to make a DomainObjectFactory for the Model layer of my application, however, each Domain object ...
3
votes
1
answer
351
views
How do I convert Money based on FX rates in a domain object without Service Location
This link describes a function on a Money object for adding funds together of different currencies.
First I do not want to use the Service Locator pattern. I currently use a pattern of not having ...
3
votes
2
answers
259
views
Should child entity classes have their own repositories?
I have several classes inheriting from an Admin class: Manager, Translator, etc.
Admin is an aggregate, so should have its own Repository. However, some methods to find Managers or Translators might ...
3
votes
2
answers
638
views
Grails domain Named query for a list of string
I have a simple Grails application. I have domains as below
class Author implements Serializable {
....
static hasMany = [
book : Book
]
}
class Book implements Serializable{
...
3
votes
1
answer
173
views
Grails Domains - Multiple many to many relationships
I'm running with grails 3.1.4 and having trouble creating a schema that allows me to tie multiple domain objects to several other domain objects. As an example of what I'm trying to do:
I have three ...
3
votes
1
answer
1k
views
Unit of Work pattern, getters, setters and contracts (PHP)
I'm not sure if the title is the best way to describe this question.
This book - http://apress.com/book/view/9781590599099 - illustrates an implementation of the Unit of Work pattern. It goes a ...
2
votes
2
answers
3k
views
Domain object to persisting entity converting
I need to store domain object (DO) into DB.
The simplest approach is to add into DO definition some JPA annotations like @Entity, @SequenceGenerator, @Table etc. but I don't want to mix DO with ...
2
votes
2
answers
756
views
Javafx : Domain objects to TreeView
I have three domain objects in my app as follows :
public class Workflow {
private String name;
private List<Sheet> sheets;
}
public class Sheet {
private String name;
private List<...
2
votes
1
answer
4k
views
Submitting multiple grails domain objects at once
I have a form, where user can enter many records of the same domain class. Each of these records should be validated after the submission. In case of successful validation the collection of records ...
2
votes
3
answers
685
views
Domain Driven Design - Value Object or Entity
I got a question about identifying a value object in the case below and how I must implement this.
The case:
In a online community users can make there own private/public page(s) (something like ...
2
votes
1
answer
86
views
Application with interchangeable persistance layer
In 95% of examples I see, people are adding @Entity or @Document annotations to their domain objects.
I would like to create an app in which I can easily change persistence layer.
It should be ...
2
votes
0
answers
114
views
Should I use a limited-fields query or an all-fields object?
I've been trying to incorporate the repository pattern into my PHP app, loosely following this example.
I'm trying to decide between:
limiting which fields I retrieve from a database
retrieving all ...
2
votes
2
answers
413
views
Java - Spring - Search Domain Objects
I have a controller that uses Spring to automatically map HTTP request params to business domain objects. I persist the field data in the domain objects to a database.
I have another controller that ...
1
vote
3
answers
10k
views
How to receive customized JSON Object in Spring boot Api post Method
I am trying to receive a JSON object in @RequestBody which is not known to me i.e. the JSON Object could be of any length and data.
Let's say, JSON could be as shown below
{'seqNo': 10 }
{'country':...
1
vote
1
answer
2k
views
Which design pattern is the opposite of the Assembler pattern?
As I understand it, an Assembler is a design pattern used to convert a domain object to a DTO.
What would you call the design pattern that is used to convert a DTO to a domain object ?
1
vote
3
answers
1k
views
How to use mysql time functions inside grails executeupdate
I am trying to delete 1 month old records from my table using domain.executeUpdate as follows
Bugrerun.executeUpdate("delete Bugrerun b where b.complete = 1 and b.date
< date_sub(curdate(), ...
1
vote
1
answer
939
views
Is it a good idea to extend a grails domain object?
I need similar object as grails domain object which does not need persisting. In order that I do not have to make changes in 2 places for any field changes, is it a good idea to extend the domain ...
1
vote
1
answer
577
views
Spring Roo: fill a new entity instance with initial data?
I want to fill a new entity with auto generated data. For instance, I want to fill an entity field with a unique token. I'm thinking that this could be done in the constructor on the domain object.
...
1
vote
1
answer
2k
views
DDD naming: Domain Object
Consider certain kinds of objects involved Domain-Driven Design (DDD): Entities, Value Objects, Domain Events, and Domain Services.
Which of these are considered to be Domain Objects? And are there ...