"controllers in the domain model"? MVC is the most elastic 'pattern', which defeats the purpose of named patterns. Are there controllers in Naked Objects? Not really, but the wicket viewer does require a choice to be made of which object's view to show after an action.
It is an interesting question, I think you are kind of forced to decide 'what is a user most likely to want to see next'?. If there is no answer to that then taking them back to the home page is maybe best. I don't know how to do that. I have been putting this 'remove' issue off myself, to make my client decide if they really want to have the option to remove records. I wanted them to focus on how to prevent adding duplicate or dodgy data from the start, in the interests of data quality. This approach has sort of worked as remove/delete is now going to be an admin user only function, in which case the "no record found" after remove default is not a problem IMO. Also, I'll now add an admin object, in preference to a big admin menu list, that can be a kind of admin home page/object. Removing elements from child collections is not a problem, you can have Add and Remove action buttons in the heading of each collection. So its really only a question for removal of parent records I think. So then a question is why do you need to remove such a record (entity)? Is the data no longer useful, but I say all data is useful even if its historic data. Is the data a duplicate, in which case how was it allowed to be created in the first place (and are there other 'unknown' duplicates now)? An interesting subject. Cheers On Sat, Dec 19, 2015 at 11:32 PM, Martin Grigorov <[email protected]> wrote: > Hi, > > I'll let the DDD experts suggest proper solution but to me Person#delete() > (i.e. a person domain object deletes itself) looks strange. > Usually the repository deals with these matters. > I'd expect to go back to the listing with the other domain objects from > this type after the deletion. > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Sat, Dec 19, 2015 at 12:43 PM, Y.R Tan <[email protected]> wrote: > > > Hi everyone, > > > > When using a void action, let’s say a remove action, the user is > > redirected to a page "no results". When clicking the back button in the > > browser the user sees "Object not found" (since you’ve just deleted this > > object). > > > > Example: > > > > public class Person { > > .... > > public void remove() { > > ... > > } > > } > > > > You can return a list for example to prevent the user from being redirect > > to a "No results" page, but I think it’s not the responsibility of the > > controllers in the domain model. A solution could be that wicket viewer > > goes back one page when encountering a deleted object. And refresh the > > current page when receiving a null response or invoking a void action. > > > > What do you guys think that is the best solution? Or do you have another > > view on this situation? > > > > Looking forward hearing from you. > > > > Regards, > > > > Yu Ri Tan >
