tag:blogger.com,1999:blog-22587889.post3133487324467498659..comments2024-11-05T17:53:31.985+05:30Comments on Ruminations of a Programmer: Functional Patterns in Domain Modeling - Anemic Models and Compositional Domain BehaviorsAnonymoushttp://www.blogger.com/profile/01613713587074301135[email protected]Blogger3125tag:blogger.com,1999:blog-22587889.post-26948368735409566682014-05-25T05:45:44.776+05:302014-05-25T05:45:44.776+05:30Thank you for writing this article and pointing to...Thank you for writing this article and pointing to the presentation that triggered your train of thoughts.<br /><br />I was wondering if the version you created would actually make the code more 'readable and succinct' (as you say). So I thought I'd make a non-anemic version.<br /><br />When I forked your source code and started read I was quite shocked. The code was very hard to understand! This is probably caused by the fact that I have little experience with functional programming and little to no experience with ScalaZ.<br /><br />I do understand the concepts of Monoid, Monad, Monad Tranformers, Type Classes, Lenses and sequence (A[B[_]] => B[A[_]]). I do not know a lot about their implementation in ScalaZ, but I do know the disjunction type.<br /><br />So my first step was to refactor the code so that I would be able to understand it more easily. You can find the result of that refactoring here: https://github.com/eecolor/scala-snippets/blob/master/src/main/scala/aggregate.scala<br /><br />I have placed comments in the code and I wonder if you agree with changes I made. If not I am eager to hear your opinion.<br /><br />The second step was a non-anemic version of the example, that one can be found here: https://github.com/EECOLOR/scala-snippets/blob/master/src/main/scala/aggregateNonAnemic.scala<br /><br />I wonder what you think about the non-anemic version and I hope you can shoot holes in it. My goal is to learn more and I am probably missing some cases where the non-anemic version would fail.<br /><br />English is not my native language, so I might come across the wrong way. I understand that the code you wrote is a simplified example and that some choices might look too complicated as a result of that. I am not trying to bash your code or opinions, just trying to find the value in your approach.EECOLORhttps://www.blogger.com/profile/01955207843270120573[email protected]tag:blogger.com,1999:blog-22587889.post-64576655463894398962014-05-15T03:02:20.671+05:302014-05-15T03:02:20.671+05:30Value the insight that even though OO has an affin...Value the insight that even though OO has an affinity to DDD. Coupling, state & the drawbacks of encapsulation have to be mitigated with FP Tom Flahertyhttps://www.blogger.com/profile/08256705201252115551[email protected]tag:blogger.com,1999:blog-22587889.post-90358477916119825672014-05-12T14:53:32.332+05:302014-05-12T14:53:32.332+05:30I could not have said it better myself... and I di...I could not have said it better myself... and I didn't ;)Dean Wamplerhttps://www.blogger.com/profile/02505288380679936730[email protected]