I try to clean up / refactor some old code. I have code optimization questions.
Please provide your insight on using UpdateDataAsyncInternal
. Will it enhance the code security because some claim having the code in private is more secure? But I don’t think that is the case. Should we remove UpdateDataAsyncInternal
and consolidate all the logic in UpdateDataAsync
instead? This approach could lead to cleaner code and simplify the creation of test cases.
public class GetStuffFromDBService(IConfiguration config) : IGetStuffFromDBService
{
private readonly IConfiguration _config = config;
public async Task<DetailsOutputDTO> UpdateDataAsync(DetailsOutputDTO detailsInputDTO)
=> await UpdateDataAsyncInternal(detailsInputDTO);
private static async Task<DetailsOutputDTO> UpdateDataAsyncInternal(DetailsOutputDTO detailsInputDTO)
{
//.... Get stuff from DB and return DetailsOutputDTO
}
}