|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Rapid n-Tier Windows and Web Application Development
Rapid n-Tier Windows and Web Application Development
By: Wendell Rios
Nov. 1, 2000 12:00 AM
In recent years the two-tier client/server model was reevaluated and a new concept built on scalability and maintainability was born: the n-tier application development paradigm. Leveraged by Internet popularization and the consequent growth of Web data-driven applications, the multitier model uses thin, pure, interface clients, middle-tier business objects installed on application/transaction servers, and database objects on RDBMS. The multitier model is definitely more effective: more distributed, encapsulated, and generic. However, client/server development is very mature, offering well-known tested technologies, tools, and methodologies that work closely to produce applications rapidly. The introduction of the n-tier model delays the application's production line because the programming team must learn several new technologies and methods to write high-quality applications. One of the tools heavily adopted by PowerBuilder programmers using the client/server development model is PFC, a class library provided by Sybase to help accelerate development and enforce standardization. PFC acts as a base library to be customized and extended, and many companies have used it in that way. Since PFC isn't compatible with n-tier development, it's been abandoned by many programmers, resulting in losses of investments in education, productivity, and standardization. However, with some changes, PFC can be improved to support integration with Jaguar CTS or MTS in a true n-tier model. Additionally, the framework can be extended to support rapid development of Web applications. I'll show you how to accomplish this.
Defining Business Rules
Another issue is related to maintenance. If programmers are free to write rules, each object may have a different interface. So a way to enforce standards must be provided. We could use inheritance, providing common ancestors for business objects. Although most transaction servers don't support inheritance in component interfaces, the objects' implementation in PowerBuilder can use it. To leverage existing knowledge when writing business rules, I'll provide an interface similar to the DBMS trigger concept. It's the n_cst_table object, a PB nonvisual object that provides a common ancestor for update validation: n_cst_tableThis object should be extended and implemented to provide update validation for each updatable table in the database model. To enforce standards, I suggest the naming convention n_tbl_tablename for these objects (see Figure 1).
Developing Windows Applications
To do this, we have to provide a set of windows ancestor objects inherited from PFC general-purpose windows (w_master, w_sheet, w_response, etc.) that implement the most common user interfaces using PFC services and objects. One requirement should be that UI programmers need only supply DataWindow objects in the right u_dw controls or n_ds objects to get a fully functional interface, according to preestablished standards. First, we have to decide if our applications will fit in MDI, SDI, or Explorer-like models. For each model one different set of templates will be needed. For the purpose of this article, I'll assume that an MDI model will be used. One possible list of these windows ancestor objects may include:
Will UI programmers have to call business rule objects to validate data? The answer is no. This PFC extension must provide a way to automatically trigger these objects. Why? Because in the client/server model business rules were implemented in triggers that were automatically called, without programmers' intervention. We want to be sure that rules will really be triggered independently of an individual programmer's discipline. Earlier I suggested that business rule objects should follow a naming convention. This is more than a suggestion, it's a need. It's possible to implement an object, say n_cst_triggerrules, that analyzes DataWindow buffers to discover what data columns have changed and what table will be affected by those changes. Using table name information, we can instantiate the right descendant business rule object because its name follows a convention. We can also collect the data and modification information for that row and automatically fill the instantiated object. Afterward we have to trigger the right method based on modification type (insert, update, delete) and moment (pre, post). Since object interfaces are standard, each object has a set of well-known methods that are used for validation, which allows the automatic triggering of business rules when users update application DataWindows. Clearly, since business rule objects will be installed in a transaction server, we have to perform all data updates and analysis there (see Figure 2). As a result, we have to implement and deploy other infrastructure objects for the sake of synchronizing client DataWindow changes, using GetChanges()/SetChanges() methods, and controlling transactions through SetComplete() and SetAbort(). Isolating data access in a middle-tier server also has the benefit of facilitating application support because no DBMS client, ODBC, or Data Access layers will be installed-on client machines.
Developing Web Applications
Considering that our client/server programmers know PowerBuilder, what does it take to make Web application development as easy as possible for them? To do this, we have to create another class library, which simplifies the Web development process and allows programmers to customize templates to generate HTML user interfaces. This class library should have the same requirement as the PFC extension for Windows application development: Web UI programmers should only specify DataWindow objects to get fully functional HTML interfaces. Taking advantage of Windows development programmers' knowledge, our class library can provide nvos that resemble Win32 objects but generate HTML behind the scenes. A list may include:
Although these objects can provide us with an increased level of productivity, it's not enough. We have to create a second level of objects that implement the interfaces. These objects - say, HTML templates - will combine the objects above to implement preestablished behavior. To enforce standardization and promote easy migration between Web and Windows interfaces, we should implement the corresponding templates that currently exist in our PFC extension for Windows development. The list may include:
Another important nvo that should be implemented is a kind of Web application manager that provides common services such as transaction control and a session object that implements persistence by the user. If the transaction server is EAServer, it will be easy to implement a session object using service objects. When using MTS, the session should be implemented through a database table or another persistent resource like a file. Since our n_cst_webdw uses a DataStore internally to update data, it will be easy to use our previously built object to automatically trigger business rule objects. Therefore, we end up with Web and Windows applications automatically triggering the same set of business rules when users update DataWindows.
Providing Locale, Transaction Server, DBMS, and Tool Independence
Tool independence means not being heavily dependent on PowerBuilder. It's also possible when developing business rule objects, since business rule programmers don't use PB's advanced features. If only instance variables, embedded SQL, and flow control are used, a migration to another tool will be easy, automated perhaps by a simple parser. Server independence means implementing MTS- and Jaguar-compatible objects. Since both servers implement almost the same features, regardless of which one is better, taking care when designing an object interface will provide this independence. Additionally, when transaction server-specific code is necessary, the TransactionServer object Which() method, which indicates current server type, can be used to implement it. Locale independence provides a way of developing applications with or without transaction and Web servers. Its purpose is to smooth the development process, allowing testing in an integrated debugging environment and eliminating the need for deployment to these servers during the development cycle. To accomplish this in Windows application development, we have to create a new class library service that users can turn on or off to indicate if the application should try to create objects in the transaction server (instancing through CreateInstance/ConnectToNewObject) or should expect them in the library list (instancing through CREATE). When developing Web applications, we have to provide a way to test generated HTML interfaces inside the PowerBuilder environment. To do this, we can use the currently available Microsoft Web browser OLE control (see Figure 3). By intercepting user navigation events in this object, we can instantiate appropriate inherited Web template objects for answering requests. After the testing phase, this set of objects can be deployed as a component, which will be created through an ASP or DynaScript page answering real browser requests.
Measuring Success
When the database model is ready, user interface production is very fast. Developing business rules as objects allows us to access data in several DBMS. The creation of Web interfaces and the migration from a Windows to a Web UI are as easy as specifying DataWindow objects and other control properties. All of this is in an integrated, powerful, and well-known environment: PowerBuilder. IT departments at some corporations will encounter a lot of resistance to developing n-tier and Web applications because it requires overall changes. Sometimes a completely new staff may be required. Using this framework, we could leverage the PowerBuilder programmers' expertise instead of abandoning it. Reader Feedback: Page 1 of 1
Latest Cloud Developer Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week
Breaking Cloud Computing News
|
|||||||||||||||||||||||||||||||||||||||||||||||||