it-e-47 Object Orienta tion

OO can model a complex reality in a very natural way.
An example is "the cup of coffee". This shows interaction between customer, waiter and
Customer and kitchen don't know each other. The waiter is the intermediary. (Encapsulation).
Waiter and kitchen act differently to the request "a black coffee" (Polymorphism)
Both waiter and kitchen supply coffee (Inheritance).
The benefits of OO are higher for complex business processes. The more complex the better.
Different responsibilities, lots of exceptions, and processes that "look alike". Those are the ideal
ingredients for an OO approach.

Encapsulation means as much as shielding. Each
OO object has a shield around it. Objects can't "see" each
other. They can exchange things though, as if they are
interconnected through a hatch.
Customer, waiter and kitchen are three shielded objects
in the "cup of coffee" example. Customer and kitchen do not
know each other. The waiter is the intermediary between
those two. Objects can't see each other in an Object-oriented
world. The 'hatch' enables them to communicate and exchange coffee and money.
Encapsulation keeps computer systems flexible. The business process can change easily.
The customer does not care about the coffee brew process. Even the waiter does not care. This
allows the kitchen to be reconstructed, is only the "hatch" remains the same. It is even possible to
change the entire business process. Suppose the waiter will brew coffee himself. The customer
won't notice any difference.
Encapsulation enables OO experts to build flexible systems. Systems that can extend as your
business extends. Every module of the system can change independently, no impact to the other
Objects can respond differently to the same message. Both waiter as kitchen respond to"a
black coffee".
The actions are different though.
The waiter passes the message to the
kitchen, waits for response, delivers
coffee and settles the account.
The kitchen brews fresh coffee and
passes it to the waiter.
The same message with different
implementations, that is polymorphism.
Polymorphism makes Object-oriented systems extremely suitable for various exceptions and
exceptions to exceptions.
Similar, but just a little bit different. The world is full of exceptions and similarities. Object
Orientation places everything perfectly in a class tree.
Both waiter and cook are employees. So they both
have an employee number. This generic
employee number gets a generic place in
Both return a cup of coffee to the question "A
cup of coffee please". That similar behavior

also gets a generic place in Employee.
There are some exceptions. Waiter and
Cook have different methods to get a
cup of
coffee. Those specific methods get a
specific place, reusing the more generic
part in Employee.
No matter how complex your business
situation is, Object Orientation can cope with


1, intermediary  [,intə'mi:diəri]
adj. 中间的;媒介的;中途的
n. 中间人;仲裁者;调解者;媒介物

2, hatch  [hætʃ]
n. 孵化;舱口
vt. 孵;策划
vi. 孵化

3, cope  [kəup]
v. (with)竞争,对抗,对付,妥善处理
vi. 对付,妥善处理

Total views.

© 2013 - 2018. All rights reserved.

Powered by Hydejack v6.6.1