📄 ch01.htm
字号:
in two ways: First, and perhaps most importantly, it makes the application less fragileby further insulating the client from changes in the rest of the application. Also,because the executable components are more fine-grained, it allows more flexibilityin the deployment of an application.</P><P>Multitier client/server reduces application fragility by providing more insulationand separation between layers. The user interface layer communicates only with thebusiness rules layer, never directly with the database access layer. The businessrules layer, in turn, communicates with the user interface layer on one side andthe database access layer on the other. Thus, changes in the database access layerwill not affect the user interface layer because they are insulated from each other.This architecture enables changes to be made in the application with less likelihoodof affecting the client component (which, remember, has to be redistributed whenthere are any changes to it).</P><P>Because the multitier client/server architecture partitions the application intomore components than traditional two-tier client/server, it also allows more flexibilityin deployment of the application. For example, Figure 1.3 depicts a system in whichthe business rules layer and database access layer, although they are separate logicalentities, are on the same server machine. It is also possible to put each servercomponent on a separate machine. Indeed, multiple business logic components (andmultiple database access components, if multiple databases are being used) can becreated for a single application, distributing the processing load and thus resultingin a more robust, scalable application.<BLOCKQUOTE> <P><HR><B>Note: </B>It is interesting to note that the multitier client/server architecture might actually have had its roots in mainframe applications. COBOL applications on IBM mainframes could define the user interface by using a tool called Message Format Service (MFS). MFS abstracted the terminal type (terminals could, for instance, have varying numbers of rows and columns) from the rest of the application. Similarly, applications could specify the database interfaces as well. Although the application would still run in one monolithic chunk, the available tools enabled the design of applications using a logical three-tier architecture. <HR></BLOCKQUOTE><H3><A NAME="Heading6"></A><FONT COLOR="#000077">The Next Generation: DistributedSystems</FONT></H3><P>The next logical step in the evolution of application architectures is the distributedsystem model. This architecture takes the concept of multitier client/server to itsnatural conclusion. Rather than differentiate between business logic and data access,the distributed system model simply exposes all functionality of the applicationas objects, each of which can use any of the services provided by other objects inthe system, or even objects in other systems. The architecture can also blur thedistinction between "client" and "server" because the clientcomponents can also create objects that behave in server-like roles. The distributedsystem architecture provides the ultimate in flexibility.</P><P>The distributed system architecture achieves its flexibility by encouraging (orenforcing) the definition of specific component interfaces. The interface of a componentspecifies to other components what services are offered by that component and howthey are used. As long as the interface of a component remains constant, that component'simplementation can change dramatically without affecting other components. For example,a component that provides customer information for a company can store that informationin a relational database. Later, the application designers might decide that an object-orienteddatabase would be more appropriate. The designers can make any number of changesto the component's implementation--even sweeping changes such as using a differenttype of database--provided that they leave the component's interface intact. Again,as long as the interface of that component remains the same, the underlying implementationis free to change.</P><P><B>New Term: </B>An <I>interface</I> defines the protocol of communication betweentwo separate components of a system. (These components can be separate processes,separate objects, a user and an application--any separate entities that need to communicatewith each other.) The interface describes what services are provided by a componentand the protocol for using those services. In the case of an object, the interfacecan be thought of as the set of methods defined by that object, including the inputand output parameters. An interface can be thought of as a contract; in a sense,the component providing an interface promises to honor requests for services as outlinedin the interface.</P><P>Distributed systems are really multitier client/server systems in which the numberof distinct clients and servers is potentially large. One important difference isthat distributed systems generally provide additional services, such as directoryservices, which allow various components of the application to be located by others.Other services might include a transaction monitor service, which allows componentsto engage in transactions with each other.</P><P><B>New Term: </B><I>Directory services</I> refers to a set of services that enableobjects--which can be servers, businesses, or even people--to be located by otherobjects. Not only can the objects being looked up differ in type, but the directoryinformation itself can vary as well. For example, a telephone book would be usedto locate telephone numbers and postal addresses; an email directory would be usedto locate email addresses. Directory services encompass all such information, usuallygrouping together related information (for example, there are separate volumes ofthe yellow pages for different cities; contents of each volume are further dividedinto types of businesses).</P><P><B>New Term: </B>A <I>transaction monitor</I> service oversees transactions onbehalf of other objects. A transaction, in turn, is an operation or set of operationsthat must be performed <I>atomically</I>; that is, either all objects involved inthe transaction must <I>commit</I> the transaction (update their own records) orall objects involved must <I>abort</I> the transaction (return to their originalstate before the transaction was initiated). The result is that whether a transactioncommits or aborts, all involved objects will be in a consistent state. It is thejob of a transaction monitor to provide transaction-related services to other objects.</P><P>To sum up, business applications have evolved over a period of time from a relativelyrigid monolithic architecture to an extremely flexible, distributed one. Along theway, application architectures have offered increasing robustness because of thedefinitions of interfaces between components and the scalability of applications(furnished in part by the capability to replicate server components on differentmachines). Additionally, services have been introduced that enable the end user ofan application to wade through the myriad of available services. Those who have beendesigning and developing business applications since the days of mainframes havecertainly had an interesting ride.<H2><A NAME="Heading7"></A><FONT COLOR="#000077">Why CORBA?</FONT></H2><P>So far, in this evolution of business applications from the monolithic mainframearchitecture to the highly decentralized distributed architecture, no mention hasbeen made of CORBA. Therefore, you might be asking yourself at this point where CORBAfits in to all this. The answer, as you will see, is emphasized throughout the restof this book. Recall that distributed systems rely on the definition of interfacesbetween components and on the existence of various services (such as directory registrationand lookup) available to an application. CORBA provides a standard mechanism fordefining the interfaces between components as well as some tools to facilitate theimplementation of those interfaces using the developer's choice of languages. Inaddition, the Object Management Group (the organization responsible for standardizingand promoting CORBA) specifies a wealth of standard services, such as directory andnaming services, persistent object services, and transaction services. Each of theseservices is defined in a CORBA-compliant manner, so they are available to all CORBAapplications. Finally, CORBA provides all the "plumbing" that allows variouscomponents of an application--or of separate applications--to communicate with eachother.</P><P><B>New Term: </B>The capabilities of CORBA don't stop there. Two features thatCORBA provides--features that are a rarity in the computer software realm--are <I>platformindependence</I> and <I>language independence.</I> Platform independence means thatCORBA objects can be used on any platform for which there is a CORBA ORB implementation(this includes virtually all modern operating systems as well as some not-so-modernones). Language independence means that CORBA objects and clients can be implementedin just about any programming language. Furthermore, CORBA objects need not knowwhich language was used to implement other CORBA objects that they talk to. Soonyou will see the components of the CORBA architecture that make platform independenceand language independence possible.<H3><A NAME="Heading8"></A><FONT COLOR="#000077">Exploring CORBA Alternatives</FONT></H3><P>When designing and implementing distributed applications, CORBA certainly isn'ta developer's only choice. Other mechanisms exist by which such applications canbe built. Depending on the nature of the application--ranging from its complexityto the platform(s) it runs on to the language(s) used to implement it--there area number of alternatives for a developer to consider. In this section you'll brieflyexplore some of the alternatives and see how they compare to CORBA.<H4><FONT COLOR="#000077">Socket Programming</FONT></H4><P><B>New Term: </B>In most modern systems, communication between machines, and sometimesbetween processes in the same machine, is done through the use of <I>sockets.</I>Simply put, a socket is a channel through which applications can connect with eachother and communicate. The most straightforward way to communicate between applicationcomponents, then, is to use sockets directly (this is known as <I>socket programming</I>),meaning that the developer writes data to and/or reads data from a socket.</P><P>The Application Programming Interface (API) for socket programming is rather low-level.As a result, the overhead associated with an application that communicates in thisfashion is very low. However, because the API is low-level, socket programming isnot well-suited to handling complex data types, especially when application componentsreside on different types of machines or are implemented in different programminglanguages. Whereas direct socket programming can result in very efficient applications,the approach is usually unsuitable for developing complex applications.<H4><FONT COLOR="#000077">Remote Procedure Call (RPC)</FONT></H4><P><B>New Term: </B>One rung on the ladder above socket programming is <I>RemoteProcedure Call (RPC).</I> RPC provides a function-oriented interface to socket-levelcommunications. Using RPC, rather than directly manipulating the data that flowsto and from a socket, the developer defines a function--much like those in a functionallanguage such as C--and generates code that makes that function look like a normalfunction to the caller. Under the hood, the function actually uses sockets to communicatewith a remote server, which executes the function and returns the result, again usingsockets.</P><P>Because RPC provides a function-oriented interface, it is often much easier touse than raw socket programming. RPC is also powerful enough to be the basis formany client/server applications. Although there are varying incompatible implementationsof RPC protocol, a standard RPC protocol exists that is readily available for mostplatforms.<H4><FONT COLOR="#000077">OSF Distributed Computing Environment (DCE)</FONT></H4><P>The Distributed Computing Environment (DCE), a set of standards pioneered by theOpen Software Foundation (OSF), includes a standard for RPC. Although the DCE standardhas been around for some time, and was probably a good idea, it has never gainedwide acceptance and exists today as little more than an historical curiosity.<H4><FONT COLOR="#000077">Microsoft Distributed Component Object Model (DCOM)</FONT></H4><P>The Distributed Component Object Model (DCOM), Microsoft's entry into the distributedcomputing foray, offers capabilities similar to CORBA. DCOM is a relatively robustobject model that enjoys particularly good support on Microsoft operating systemsbecause it is integrated with Windows 95 and Windows NT. However, being a Microsofttechnology, the availability of DCOM is sparse outside the realm of Windows operatingsystems. Microsoft is working to correct this disparity, however, in partnering withSoftware AG to provide DCOM on platforms other than Windows. At the time this waswritten, DCOM was available for the Sun Solaris operating system, with support promisedfor Digital UNIX, IBM MVS, and other operating systems by the end of the year. Bythe time you read this, some or all of these ports will be available. (More informationon the ports of DCOM to other platforms is available at <TT>http://www.softwareag.com/corporat/dcom/default.htm</TT>.)</P><P>Microsoft has, on numerous occasions, made it clear that DCOM is best supportedon Windows operating systems, so developers with cross-platform interests in mindwould be well-advised to evaluate the capabilities of DCOM on their platform(s) ofinterest before committing to the use of this technology. However, for the developmentof Windows-only applications, it is difficult to imagine a distributed computingframework that better integrates with the Windows operating systems.</P><P>One interesting development concerning CORBA and DCOM is the availability of CORBA-DCOMbridges, which enable CORBA objects to communicate with DCOM objects and vice versa.Because of the "impedance mismatch" between CORBA and DCOM objects (meaningthat there are inherent incompatibilities between the two that are difficult to reconcile),the CORBA-DCOM bridge is not a perfect solution, but it can prove useful in situationswhere both DCOM and CORBA objects might be used.<H4><FONT COLOR="#000077">Java Remote Method Invocation (RMI)</FONT></H4><P>The tour of exploring CORBA alternatives stops with Java Remote Method Invocation(RMI), a very CORBA-like architecture with a few twists. One advantage of RMI isthat it supports the passing of objects by value, a feature not (currently) supportedby CORBA. A disadvantage, however, is that RMI is a Java-only solution; that is,RMI clients and servers must be written in Java. For all-Java applications--particularlythose that benefit from the capability to pass objects by value--RMI might be a goodchoice, but if there is a chance that the application will later need to interoperatewith applications written in other languages, CORBA is a better choice. Fortunately,full CORBA implementations already exist for Java, ensuring that Java applicationsinteroperate with the rest of the CORBA world.<H2><A NAME="Heading9"></A><FONT COLOR="#000077">CORBA History</FONT></H2><P>Now that you know a little bit of CORBA's background and its reason for existence,it seems appropriate to briefly explore some of the history of CORBA to understandhow it came into being.<H3><A NAME="Heading10"></A><FONT COLOR="#000077">Introducing the Object ManagementGroup (OMG)</FONT></H3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -