Hi Ádám,

Thank you for the detailed feedback—this clarifies the exact architectural
direction and prevents duplicated effort on the module migration.

I will align the proposal directly with these conventions:
1. Reference Patterns: Study `SavingsAccountInterestCalculator`,
`FINERACT-2968`, and `FINERACT-3174` so calculators are invoked from the
service layer with results passed into entities for state updates—without
instantiating calculators inside entities or keeping unnecessary shim
methods when callers can be updated directly.
2. Package Structure: Keep new calculators directly under
`org.apache.fineract.portfolio.savings.domain`.
3. Scope (350h):
   - Unify the dual daily-balance / interest-posting calculation paths
across `SavingsAccount` and `SavingsAccountInterestPostingServiceImpl`
(`SavingsAccountData`), backed by strong regression tests on the interest
posting job.
   - Extract maturity and pre-closure calculations from
`FixedDepositAccount` and `RecurringDepositAccount`.
   - Migrate deposit account write requests to the typed command
infrastructure (`FSIP-5` / `fineract-command/REFACTORING.md`), removing
`JsonCommand` coupling from `prematureClosure`.

Thank you as well for offering to review the PRs and answer questions along
the way. For any other PMC members or committers following this thread: if
anyone is interested in mentoring this refined 350h scope for GSoC 2027, I
would love to connect.

Best regards,
Eyad Sharkawy


On Sun, 22 Nov 2026, 11:54 am Ádám Sághy, <[email protected]> wrote:

> Hi Eyad,
>
> Thanks for the write-up, and for the steady stream of merged work.
>
> On your questions:
>
>    1. *Pattern:* Yes in principle. Keep the entity responsible for
>    changing its own state. A calculator reads inputs and returns a result
>    without side effects, the way FINERACT-3174 did. Pin the current behaviour
>    with tests before each move, and do one calculation per PR. Don't keep old
>    entity methods only as shims if the callers can simply be updated.
>    2. *Package:* Stay in portfolio.savings.domain next to the existing
>    calculators. A subpackage isn't worth it for a handful of classes.
>    3. *Dependencies:* Pure calculations as plain classes are fine. Please
>    don't instantiate collaborators inside the entity, though. The direction
>    (FINERACT-2968) is to call calculators from services and pass the results
>    in. SavingsAccountInterestCalculator is the better reference here than
>    the lock-period one.
>    4. *Scope:* As above, the module move is covered elsewhere. If you
>    want a 350h scope, I'd suggest:
>       - Merge the two daily-balance / interest-posting paths,
>       SavingsAccount and SavingsAccountInterestPostingServiceImpl, which
>       works on SavingsAccountData. This is the duplication you mentioned.
>       It is the hardest part and the most valuable, and it needs strong
>       regression tests around the posting job.
>       - Extract the maturity and pre-closure calculations from the FD/RD
>       entities.
>       - Optionally, move the deposit account write requests to the typed
>       command infrastructure (FSIP-5, see fineract-command/REFACTORING.md).
>       That would also take the JsonCommand out of prematureClosure.
>    5. *Mentorship:* I am not involved in GSoC, but I am happy to review
>    your PRs and try to answer any of your questions.
>
> Regards,
>
> Adam S
>
> On Nov 21, 2026, at 10:40 PM, Eyad Sharkawy <[email protected]>
> wrote:
>
> Hi everyone,
>
> My name is Eyad Sharkawy, and I am preparing a 350-hour (Large) GSoC 2027
> proposal focused on modernizing the codebase and reducing technical debt in
> Apache Fineract.
>
> Over the past few months, I have contributed across both the backend and
> frontend, including:
> - FINERACT-3200 <https://issues.apache.org/jira/browse/FINERACT-3200> (PR
> #6849 <https://github.com/apache/fineract/pull/6849>): Decoupling lock-in
> period calculation out of SavingsAccount into
> SavingsAccountLockPeriodCalculator.
> - FINERACT-848 <https://issues.apache.org/jira/browse/FINERACT-848> (PR
> #6405 <https://github.com/apache/fineract/pull/6405>) & Mifos WEB-1358
> <https://mifosforge.jira.com/browse/WEB-1358> (PR #4169
> <https://github.com/openMF/web-app/pull/4169>): Custom interest rate
> chart overrides for deposit accounts.
> - FINERACT-1283 <https://issues.apache.org/jira/browse/FINERACT-1283> (PR
> #6714 <https://github.com/apache/fineract/pull/6714>) & FINERACT-817
> <https://issues.apache.org/jira/browse/FINERACT-817> (PR #6365
> <https://github.com/apache/fineract/pull/6365>).
>
> BACKGROUND & PROPOSAL SCOPE
>
> As part of the ongoing effort in Apache Fineract to keep JPA entities
> focused on persistence and state management by moving complex calculations
> and business rules into dedicated domain services/calculators (and
> following the pattern validated in  FINERACT-3200
> <https://issues.apache.org/jira/browse/FINERACT-3200>), I am looking to
> tackle the calculation logic currently concentrated in the savings and
> deposit entities.
>
> Currently, SavingsAccount.java (~3,700 lines) mixes persistence state with
> daily balance aggregations, compound-interest formulas, overdraft
> calculations, and tax withholding. In addition, FixedDepositAccount and
> RecurringDepositAccount still hold maturity and pre-closure penalty
> calculations inside fineract-provider rather than fineract-savings.
>
> Building on the precedent merged in  FINERACT-3200
> <https://issues.apache.org/jira/browse/FINERACT-3200>, my proposed 350h
> GSoC project aims to:
> 1. Decouple Daily Balance, Interest Calculation/Posting, and Overdraft
> calculations from SavingsAccount into stateless, isolated domain
> calculators with fast JUnit 5 unit tests (and eliminate duplicated
> calculation loops between SavingsAccount and
> SavingsAccountInterestPostingServiceImpl).
> 2. Extract maturity and pre-closure penalty calculations from
> FixedDepositAccount and RecurringDepositAccount into stateless calculators.
> 3. Map and decouple provider-level dependencies on FixedDepositAccount /
> RecurringDepositAccount to prepare or execute their move from
> fineract-provider into fineract-savings.
>
> QUESTIONS FOR THE COMMUNITY
>
> 1. Pattern: Do you agree with continuing the  FINERACT-3200
> <https://issues.apache.org/jira/browse/FINERACT-3200>   delegation
> pattern (keeping existing entity methods backward-compatible while
> delegating math/date logic to stateless calculator classes)?
> 2. Package Structure: Should new calculators live directly under
> `org.apache.fineract.portfolio.savings.domain` alongside
> `SavingsAccountLockPeriodCalculator`, or in a dedicated subpackage such as
> `.domain.calculation`?
> 3. Dependencies: Since JPA entities are not Spring-managed beans, keeping
> calculators as stateless POJOs (instantiated or passed cleanly without
> Spring context dependencies) keeps unit tests fast and isolated. Are there
> any objections or specific conventions you prefer here?
> 4. Modularization Scope: For a 350h timeline, does decoupling
> Fixed/Recurring Deposit calculations and preparing their migration from
> fineract-provider into fineract-savings align with current module
> boundaries?
> 5. Mentorship: Would anyone on the PMC/committer team be interested in
> mentoring or co-mentoring this scope for GSoC 2027?
>
> I would greatly appreciate any architectural feedback or recommendations!
>
> Best regards,
> Eyad Sharkawy
> GitHub: https://github.com/Eyad-Sharkawy
>
>
>

Reply via email to