#terminology help

1 messages · Page 1 of 1 (latest)

late yacht
#
class HotelReservation {
   private Instant checkIn;
   private Instant checkOut;
}

if i want to factor out checkIn and checkOut into a different class what's the term called? is that still encapsulation?

stable wyvernBOT
#

<@&987246399047479336> please have a look, thanks.

stone ingot
#

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).

late yacht
snow nebula
#

encapsulation is encapsulating data into a single thing.
Like java class Person { int age String firstName String lastName }

stable wyvernBOT