Team LiB
Previous Section Next Section

OOP

To be able to create an enterprise architecture that fulfills the mentioned requirements for an enterprise application described earlier, you need to work with object-oriented programming (OOP) in mind. The enterprise pattern we are going to talk about here is based on general OOP functionality. We are not going to discuss the complete scope of OOP, but will mention the four major building blocks in OOP that make the EA more stable, robust, and easier to maintain.

Abstraction

Abstraction is "information hiding." The user of a module/component does not have to know what is going on inside, just how to use it. The Facade classes in the EA hides the complex structure of the business layer, and instead exposes Facade classes based on the use cases.

Encapsulation

Encapsulation occurs when you separate the public interface to a module from private, internal data, making it clear what users of a module are supposed to know about and what they should not mess with. In C# and VB .NET, this is done by specifying which members of a class are public and which are private. The compiler will not permit code outside the class to refer to the private members. The encapsulation does not serve as protection against fraud or malice; rather, it clarifies what a class should do. An author of a class can say, "I can guarantee the public behavior of my class, since I have kept its internals private—outsiders cannot interfere with my class meeting its public obligations."

Inheritance

A class inherits the behavior (functions and methods together with properties) of another class, and thereby make reuse programming more easy. If A is a class, and B is a class, and B inherits from A, then an object in class B has all of the data members and functions defined for class A as well as those of B.

With a good design, it is possible to reuse large quantities of code quite simply. The EA presented in this chapter uses inheritance for the data access layer so it inherits some base functionality that should be the same for all data classes.

Polymorphism

Through polymorphism, you can use objects without having to know their exact types. For instance, you can iterate a couple of objects and tell each of these objects to "print itself" by calling the "print" function, and each object takes care of the printing. How each object responds to the print request depends on what kind of object it is.


Team LiB
Previous Section Next Section