#terminology help
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
Refactoring is the exercise of restructuring code, usually minimising changes in behaviour.
'Extracting' is the practice of pulling some state out of one class into another new class - usually with several different approaches depending on how the two should be related afterwards,
Reasons for extraction can be reuse, encapsulation, decoupling...
Typically the result is that HotelReservation uses the new class using a pattern of reuse called Composition (the other dominant pattern being Inheritance).
thanks for the quick explanation. i usually use the term extracting for refactoring, but the result of the extraction can be for reuse or better encapsulation so i was a unsure. does encapsulation help with high cohesion? in my example, i think having the dates together makes sense and i can also validate that check in is also after check out
encapsulation is encapsulating data into a single thing.
Like java class Person { int age String firstName String lastName }
Detected code, here are some useful tools: