Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5063

Extract private method in ConceptServiceImpl.saveConcept

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Could
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Core 2.2.0
    • Component/s: None
    • Labels:
    • Complexity:
      Low

      Description

      To reduce the complexity, increase readability and maintainability in

      ConceptServiceImpl.saveConcept(Concept)

      I suggest to extract related parts into smaller private methods, with longer meaningful names:

      https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/impl/ConceptServiceImpl.java#L111-L119 into

      ensureConceptMapTypeIsSet(Concept)
      

      inline temp variable

      https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/impl/ConceptServiceImpl.java#L233

      and Im sure this one

      https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/impl/ConceptServiceImpl.java#L191-L222

      can also be extracted into a meaningfully named method.

      Keep the private methods in order of their execution and right after the method saveConcept.

      And only extract the private methods without refactoring them as well in order to ease code review and reduce risk of breaking the code. If you have an idea on how to improve the private methods later on submit another PR.

        Attachments

          Activity

            People

            Assignee:
            meenakshi Meenakshi Dhanani
            Reporter:
            teleivo Ivo Ulrich
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: