This initial version of Eliza is a stub (i.e. a skeleton) of the full-blown version of Eliza
that will eventually be written. In its initial form, Eliza will behave like a parrot;
it'll simply echo what the user says until the conversation ends. Eliza assumes the user
wants to end the conversation if they type "BYE".
Although this version of Eliza is simplistic, it demonstrates several important
software enginering concepts:
Modularization and separation of concernsThe two modules in our initial version of Eliza are:
Generalization of behavior (by expressing the behavior of a class in an interface)An interface (in C# and Java) is a "contract" - i.e. a promise to offer specific behavior. This allows for different versions of Eliza (i.e. "different implementations of the interface") to be used by the driver program, so long as each implementation fully honors the contract described by the interface. Real-world example Lamps use light bulbs. A light bulb's interface is defined by the following contract (i.e. agreement):
Information hidingIt's a good idea to publicize as little of a class to code that consumes the class. This allows you to modify the internals (the private parts) of the class at will, as long as you don't break the public view of the class. Real-world example A bulb's filament (a private part of a bulb) can be improved upon (and changed) by the manufacturer over time, without affecting consumers who buy bulbs. In C#, we hide information (variables and methods) by preceding them with an access modifier keyword such as "public", "private", "protected" and "internal". If you omit an access modifier, the compiler assumes you mean "internal".
Suggestion:
ALWAYS explicitly specify the access modifier of a variable or method, as this will force you to stop and think about the item's visibility level. |