The next refactoring technique we'll look at is extracting behavior into functions. Say we have the following example:
SubwayTrain#processStop has a lot of behavior. The intention could be made clearer by separating each behavior into its own method. The behavior we extract will also become available to other classes that may need it, outside of the context of getting passengers at a subway station.
After extracting the behavior,
#processStop looks like this: