galovics commented on code in PR #4099: URL: https://github.com/apache/fineract/pull/4099#discussion_r1801786171
########## fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/data/RepaymentPeriod.java: ########## @@ -0,0 +1,176 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.loanaccount.loanschedule.data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.apache.fineract.infrastructure.core.service.MathUtil; +import org.apache.fineract.organisation.monetary.domain.Money; + +@ToString +@EqualsAndHashCode(exclude = { "previous", "next" }) +public class RepaymentPeriod { + + @ToString.Exclude + private final RepaymentPeriod previous; Review Comment: I'm not necessarily in agreement with your point - at least when it comes to performance. Do you have measurements on how much "more performant" it is? Let's say we save 10ms by using this recursive approach - even though from maintenance and debugging point of view it's adding a huge complexity - compared to an imperative approach which takes 20ms. We do multiple queries to the DB which takes let's say 300ms. That means with the imperative approach, we have 320ms execution time overall and with the recursive it's 310ms. We saved 3% of the overall executing while having an error-prone and hard to debug approach. I'd go imperative, unless we have a super good reasoning - other than the recursive vs imperative performance difference. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
