Hi all,
I took a look at areas in the OpenLMIS code that we can improve using OOAD approach.
I found following Technical Gaps:
1. Lots of Utility classes with procedural static methods. Many of util classes can be changed to proper object giving us all OOP benefits. See example: https://github.com/OpenLMIS/openlmis-cce/commit/b5223be19be9ae72dd6a7797044de282650b59c5.
2. Domain logic outside of domain layer. To suppress this, encapsulation should be used. Setters and getters on domain classes should be avoided and used only if it’s required/reasonable. See example of how Encapsulation can be implemented and what benefits it gives: https://review.openlmis.org/cru/FEOLMIS-2178
3 Using map for request parameters or request body in search endpoints:
- causes a lot of boilerplate code in service classes (https://github.com/OpenLMIS/openlmis-referencedata/blob/master/src/main/java/org/openlmis/referencedata/service/SupervisoryNodeService.java#L82),
- forces to create literal string for keys (it’s easy to introduce a bug).
There are two possible approach on how to handle it:
- use object: example implementation: https://review.openlmis.org/cru/FEOLMIS-2150,
- use wrapper object that will make use of Map methods like isEmpty() and implement boilerplate code in one place, leaving service class clean.
4. Validators are using domain objects. Data validation should always be done before domain object is created so we are sure it’s always in valid state. We can validate when constructing an object or use Dtos in Validator classes.
5. Dtos in domain object (https://groups.google.com/forum/#!topic/openlmis-dev/590SBoZcG50). Beyond what Josh said, we sometimes use Dtos in domain logic. One way to solve this would be to store needed data in domain object as snapshot.
Places where above issues are common:
- Requisition domain logic logic in RequisitionService, RequisitionHelper and LineItemFieldsCalculator classes (last two are not object oriented at all, just a collection of procedural static methods).
- RequisitionBuilder has no reason to be. We should be able to create new requisitions using Requisition object, without RequisitionBuilder and RequisitionService which call setter methods on Requisition object.
- Requisition domain object use OrderableDto, ApprovedProductDto and ProofOfDeliveryLineItemDto. First one is used for calculations and we should snapshot needed values. Second and Third one are used as a bag for data that would be stored in requisition or line item during initiation. Instead we should pass to constructor everything that is needed directly.
For now I only took deeper look at CCE and Requisition services. I will investigate other services as well and extand list of gaps and dark places.
What do you think about presented tech debts and possible solutions? Please feel free to share your experience where and how we break OOP in OpenLMIS.
Best Regards,
Paweł
SolDevelo Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41
--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev+unsubscribe@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/b9335acb-c3b3-4945-a906-2cd53b184b67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Paweł Albecki
Software Developer
palb...@soldevelo.com
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/CAAJzpfkkMCGwhrEpuj9YNmxdXW7O1eKvjzcuM0c1pjbr8LRRJw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/CAAJzpfn0B%3DCbUNCUz_u8cyWKz_2im5bXvfbTeJCt_qGWMGc%2BfQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/CAHq-FDOaVUCaGL_KfPgwSDRnxTEpNc_ezSrnwZaTyk77pWC4kg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/CAAJzpfn-G0V47mJeTsFdeBGxxj7bCyHJuXEHgu9vgDDiXrVgtA%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/b9335acb-c3b3-4945-a906-2cd53b184b67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
SolDevelo Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41
--
Paweł Albecki
Software Developer
palb...@soldevelo.com
SolDevelo Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41
--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/CAAJzpfkkMCGwhrEpuj9YNmxdXW7O1eKvjzcuM0c1pjbr8LRRJw%40mail.gmail.com.
--Paweł Gesek
Technical Project Manager
pge...@soldevelo.com / +48 690 020 875
SolDevelo Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41
SolDevelo Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41
--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/CAAJzpfn0B%3DCbUNCUz_u8cyWKz_2im5bXvfbTeJCt_qGWMGc%2BfQ%40mail.gmail.com.
SolDevelo Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41
--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/CAHq-FDOaVUCaGL_KfPgwSDRnxTEpNc_ezSrnwZaTyk77pWC4kg%40mail.gmail.com.
SolDevelo Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41
SolDevelo Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41
--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/CAAJzpfn-G0V47mJeTsFdeBGxxj7bCyHJuXEHgu9vgDDiXrVgtA%40mail.gmail.com.
SolDevelo Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41
--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev+unsubscribe@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/02bd93ba-8825-4c51-82f4-afc5d3bc9bf9%40googlegroups.com.
Paweł Albecki
Software Developer
palb...@soldevelo.com
SolDevelo Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41
--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev+unsubscribe@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/a6305c72-13a8-4e36-afb0-596b9083fd8f%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/a6305c72-13a8-4e36-afb0-596b9083fd8f%40googlegroups.com.