|
YOUR FEEDBACK
|
TOP MICROSOFT .NET LINKS Visual Studio .NET Extend Your Wings and Start the Migration
Moving a mature C++ CORBA application to .NET
By: Piper Keairnes
Dec. 7, 2004 12:00 AM
.NET developers appreciate the ease of use offered by Visual Studio and the rich range of services from which to build enterprise applications. However, if you already have a successful product with an installed customer base, how can you take advantage of .NET? Do you need to start from scratch, or does it make sense to migrate a mature C++ CORBA application to the .NET framework? My team at VCG realized a number of benefits from tackling just such a project. In this article, I share our experience and show you how it all turned out. The Challenge On the business side, our sales force noted that our customers were standardizing on the Microsoft Windows operating environment. Prospects were no longer interested in mixed environment deployments. Some prospects and customers were interested in having the ability to extend our product to offer custom interfaces. The Plan
Simplifying the Architecture The client and server architectures utilized a wide range of technologies including C++, VB, MFC, COM, DCOM, CORBA/IIOP, ASP, and ADO. Our goal was to reduce the variety and focus instead on a single technology platform. The deployment environment was complicated by multiple network protocols, many separate executable processes, ASP applications, COM object registrations, and large numbers of DLLs. We strove to simplify the process model and reduce the overall file counts. In contrast, our new version, StaffSuite 4.0, is built on a service-oriented architecture with clients connecting to the .NET server application via SOAP. StaffSuite can also support browser-based clients through HTTP. Within the StaffSuite server, business logic is written in Managed C++ and C#, and data access classes are automatically generated by Progress Software's EdgeXtend for C#, an O-R mapping and caching product. Figure 2 shows the streamlined StaffSuite architecture. Microsoft .NET provides a single technology platform that allows us to simplify our product architecture and deployment environment by doing the following:
Because this pattern uses reflection to delegate the service requests to service classes, the top layer of legacy C++ code had to be converted to Managed Extensions for C++. All new service classes are being written in C#, and these new classes collaborate with the legacy C++ classes through the ServiceFactory and service interfaces. For server-to-server calls, the ServiceFactory optimizes performance by returning a reference to a concrete service class (e.g., EmployeeService) rather than the DynamicProxy that is used for client-to-server calls. This pattern uses a fair amount of reflection, which might cause some people to question performance. However, the actual cost of reflection is negligible compared to the object serialization and network-database I/O involved in these coarse-grained client/server calls. Our application did not make heavy use of COM components, so we took some time to eliminate that technology from our architecture. We were able to replace several COM libraries by switching to comparable classes in the .NET Framework or by using open-source .NET projects such as SharpZipLib. Finally, we upgraded some third-party libraries to their newer .NET versions. Last, because of the fact that .NET supports multiple programming languages, we were able to integrate our server-side C#, C++, and VB code into a single ASP.NET application domain. The server was previously deployed as two ASP applications, four server processes, and a Java-based Orbix runtime. Now all of these components run in a single application directory within IIS. This architectural change dramatically simplified the way we deploy and administer the server. Leveraging the Code The standard .NET interface for data access is ADO, which proved to be the best fit for one of the StaffSuite modules for client-side functionality. However, this module was based on a simple data model that translated easily to ADO. Previous versions of StaffSuite had used Progress Software's EdgeXtend in place of C++ to generate the data access logic. With the complex object model on the server side, our team did not want to face the daunting task of converting all data access to ADO. When we learned that Progress was developing a C# version of EdgeXtend, the development team was enthusiastic about joining the beta program. We felt that retaining this object-oriented data access paradigm in the business logic layer would offer greater ease of use and higher productivity. Using EdgeXtend to generate code also relieved us from concerns over simple syntax errors or misspellings. We were able to use C++ and C# compilers to detect code that was impacted by a schema change, which is a more reliable approach than manually reviewing SQL statements. Just as important, the team wanted EdgeXtend's ability to cache unpredictably changing data to tune application performance and scalability. Neither ADO nor .NET have provisions for automatically caching dynamic data. EdgeXtend's generated data classes fully implement all database access and object model constraints. Just to give you an idea of the difference between the amount of effort required to provide data persistence using ADO and the EdgeXtend approach, consider a simple relationship in which two database tables (WIDGET and PRODUCT_LINE) have a one-to-many relationship. The foreign key (ProdID) is on the WIDGET table (see Table 1). Listing 1 shows how the same operation would look invoking EdgeXtend's generated O-R mapping code. Notice how the EdgeXtend solution uses no SQL or database-specific code. The relational data is treated the same as any ordinary .NET object. Obtaining information in related tables becomes as simple as accessing an object attribute (prod.widgets). In ADO.NET we use strings to describe the data we want from DbCommands, DataRows, and DataReaders. This results in a class of issues that can only be discovered at runtime with thorough unit testing of your data access logic. In contrast, EdgeXtend provides a less error-prone data access environment because data is accessed in the form of type-safe objects, properties, and relationships. If you misspell the property "widget.ProductLine.Name," the C# compiler will let you know. But with ADO.NET SQL strings, you won't know until runtime that you had fat-fingered the syntax for your inner join. Besides the obvious productivity improvement of not having to hand-craft SQL statements, you also improve quality and developer productivity by catching some errors at compile time. EdgeXtend automatically caches dynamic data. After the first pass through the code in Listing 2, the ProductLine and Widget objects remain in memory until they are garbage collected by the .NET runtime. During a second pass through Listing 2, if these objects have not yet been collected, EdgeXtend will return the same objects without needing to hit the database again. That's a wonderfully transparent performance improvement. But what happens when you scale your application by adding another server? The answer is simple: just change your configuration file to tell EdgeXtend to automatically synchronize these distributed caches. Development Benefits from Using EdgeXtend
The move to .NET resulted in productivity, quality, and cost benefits, allowing us to:
Ultimately, we must gauge the success of this project in the market. Customers and prospects have reacted positively to our new focus on .NET because it generally mirrors their own technology direction. Salespeople have found it an advantage to offer a .NET solution over a CORBA or Java solution. In addition to the new business functionality in the 4.0 release, StaffSuite customers will benefit from all the technology upgrades in some important ways:
StaffSuite 4.0 went through a very successful round of beta testing in August and September, and the product was released in early October. Even with all the architectural changes, component upgrades, deployment changes, and functionality improvements, Version 4.0 is turning out to be the highest quality release yet. During beta testing, we enhanced application performance by focusing on EdgeXtend data caching. Cache clustering and failover features will be important to VCG clients who need scalability and high availability. As StaffSuite evolves, the database independence of the EdgeXtend tool will also allow us to meet customer demands for SQL Server support without requiring significant code changes. We've found the .NET framework to be an excellent platform for development and deployment. The simplified architecture and reduced code base delivered significant productivity and quality improvements. If you weigh the benefits against the risks, you may decide it is worth the effort to migrate a mature application to .NET. YOUR FEEDBACK
MICROSOFT .NET LATEST 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 NEWS FROM THE WIRES
|
||||||||||||||||||||||||||||||||||||