July 2018
Intermediate
186 pages
3h 24m
English
Now that you know the theoretical basics, let's look at these facilities and how they are
used in our program. Let's open
Lesson 2/3-project in our IDE and extend our chatbot, which was developed in the previous chapter.
To do this, we
must decouple the environment and logic, and integrate only one in the
main method.
Let's open the
EffectsProvider class:
For full code, refer to
Code Snippets/Lesson 2.scala file.
trait EffectsProvider extends TimeProvider { def input: UserInput def output: UserOutput } object DefaultEffects extends EffectsProvider { override def input: UserInput = ConsoleInput override def output: UserOutput = ConsoleOutput override def currentTime(): LocalTime = LocalTime.now() ...Read now
Unlock full access