Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Refactoring the sendMenteeApplicationEmails method for better readability and maintainability #389

Closed

Conversation

giovanavi
Copy link
Contributor

Purpose

The purpose of this PR is to fix #388

The purpose of this pull request is to address the ExcessiveMethodLength and DuplicateCode problems in the sendMenteeApplicationEmails method to improve readability and make the code easier to maintain.

Goals

  • Reduce the complexity of the sendMenteeApplicationEmails method.
  • Eliminate code duplication within the method.
  • Improve the testability of the code by separating the logic into smaller methods.

Approach

Application of the "Extract Method" refactoring technique:

  • Creation of buildApprovedMenteeEmailMessage and buildRejectedMenteeEmailMessage methods to build email messages.
  • Extraction of the email sending and saving logic for the sendAndSaveMenteeApplicationEmail method.

Replacement of duplicate operations in the sendMenteeApplicationEmails method with calls to the new methods.

Checklist

  • This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
  • I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

@giovanavi giovanavi closed this Nov 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactoring to reduce the complexity of the sendMenteeApplicationEmails() method
1 participant