0
Under review

Inline temp with Dependency Injection

Tsai Ryan 1 month ago updated by Alexander Shvets 1 month ago 1

Hi everyone, would anyone use the refactor skills "Inline Temp" when facing the DI(Dependency Injection) ?

for example:

pseudo-code as fallow,

Before Refactoring:

Object1 variable1 = userAdapter.convertFromRequestDto(requestDto);
Object2 varialbe2 = userRepository.create(variable1);
return userAdapter.convertFromModel(varialbe2 );

Refactored Code:

return userAdapter.convertFromModel(userRepository.create(userAdapter.convertFromRequestDto(requestDto)));

Which ways do your guys prefer?

Under review

Hi!

I would prefer #1.