Introducing Borland Delphi 8 for the Microsoft.NET Framework A product overview A Borland White Paper January 2004
Contents Introduction... 3 Windows development today... 4 The Microsoft.NET Framework... 4 The challenges behind the move to the Microsoft.NET Framework... 5 Delphi 8: smooth sailing to the Microsoft.NET Framework... 5 Using Windows Forms and Web Forms... 7 Extending ADO.NET: the Borland Data Provider... 8 The advanced new Delphi 8 IDE... 9 Integration with other Borland solutions...19 Creating model-driven applications with Delphi 8 Architect..23 Summary...24 2
Introduction Since the release of the Microsoft.NET Framework, it has been clear that this new approach is the future of Windows application development. Yet users of Microsoft Visual Studio find that they have a great deal to learn and a great deal to change in their applications. With the release of Delphi 8, Borland not only supports the new technology in.net, but also preserves investments in previous application development efforts. New development for Windows is well under way. According to Gartner, by mid-2004, most mainstream AD [Application Development] organizations should begin serious efforts to migrate any Win32/COM (Component Object Model) applications that are expected to be in use beyond 2007 to the.net Framework. 1 With the release of Borland C#Builder for the Microsoft.NET Framework in 2003, Borland delivered the first commercial alternative to Visual Studio for.net development. Now, that same power is available for the Delphi language with Borland Delphi 8 for the.net Framework. But Delphi 8 is more than a.net version of Delphi. It includes many innovative features, including Borland Enterprise Core Objects (ECO ), a model-driven application development framework that promises to slash development and maintenance time. Other new technologies include Borland Data Provider for.net, comprehensive development capabilities for Windows Forms, ASP.NET Web Forms, and Web Services. In addition to core technologies for.net development, Delphi 8 also introduces strong integration with solutions for other phases of the application lifecycle. This strong integration makes it easier to manage and maintain complex enterprise applications from the first stages of requirements gathering right through to deployment and implementation. 1 Gartner, CIO Update: How Java and.net Compare and Will Evolve, Mark Driver, June 2003 3
Windows development today Despite the popularity of Windows, the rapid development of applications that are easy to use, reliable, and secure can be difficult. Until recently, Microsoft encouraged developers to use either Visual Basic or Visual C++. This has led to challenges for development managers. Even less-technically qualified team members find Visual Basic lacking the tools and productivity they need, and Visual C++ can take years to learn and use effectively. With these issues in mind, Microsoft introduced the.net Framework intending to simplify Windows programming and make it easier to create sophisticated, reliable applications. The Microsoft.NET Framework In the past, each Windows programming language had its own framework, which performed low-level work, such as painting controls on forms and responding to mouse clicks, to allow the developer to concentrate on application logic. Each framework was designed for one programming language only. Now,.NET introduces a single framework that is used by all.net programming languages. At a stroke, this removes many issues in Windows development. With.NET, there is only one framework to learn, one object hierarchy to understand, and one programming model to use. To make code more secure, the Microsoft.NET Framework is a virtual machine, compiling programs on the fly and performing security checks as it does so. Code that contains errors or contravenes security rules will not run. The virtual machine handles memory allocation, preventing buffer overflows, which are the leading cause of system instability. The combination of a virtual machine that can run programs written in different languages, allied to a single framework, means development teams can now choose from a range of 4
programming languages. These include implementations of C++, Visual Basic, COBOL, FORTRAN, and most other commercial programming languages. The ability to mix languages in a single application means that different team members can use different languages for their parts of the application as appropriate. For instance, a systems engineer might use Managed C++ for low-level parts of a system, while a beginning programmer uses Visual Basic.NET for another part of the same application. Developers can also now easily leverage each other s work for example, parts of the system built by one team can be easily used by others, even if they are written in other languages. The challenges behind the move to the Microsoft.NET Framework Microsoft has made it clear that the.net Framework will be the principal approach for future Windows development. Yet only after several years is it becoming a popular approach for new systems development. One reason for this slow adoption is that both Visual C++ and Visual Basic developers must redevelop their code to run with the new.net Framework. For developers who use Delphi, the news is much better. With Delphi 8, almost all existing Delphi programs can work as.net applications. Delphi 8: smooth sailing to the Microsoft.NET Framework Microsoft is on record as saying that Delphi developers have a 2-year head start on development using.net. With new Borland Delphi 8, it is easy and straightforward to move to the new framework. Practically all existing program code can be moved to.net without changes. 5
Once loaded into Delphi 8, applications can take advantage of all the features of the.net Framework, including the improved security model and easy application deployment. This is possible because Borland has created a new compiler for the Delphi language. Since its first release, Delphi has been a leading development solution for Windows. As the Windows platform has evolved, so, too, has Delphi and its support. The first version of Delphi was released in 1995 and created 16-bit applications for Windows 3.1. Later versions support 32-bit programming and development for each version of Windows, right up to today s Windows XP. The new Delphi compiler in Delphi 8 translates a program to the Common Intermediate Language used by.net. This means that programs can use Delphi language units alongside units written using Managed C++, Visual Basic.NET, C#, or any other.net-compatible language. Language extensions mean that everything possible with other.net languages is also possible with Delphi. Borland has also taken the opportunity to move almost all of the Visual Component Library (VCL) to.net, including the reintroduction of the Borland Database Engine for the Microsoft.NET Framework (BDE.NET) to ensure that millions of older programs will work without problems. This means that practically every Delphi program written for 32-bit Windows can be moved to.net without changes. Even dbexpress and the Borland Database Engine (BDE) are available. In brief, practically every Delphi application can be migrated, without changes, to Delphi 8 for the Microsoft.NET Framework. One simple recompilation is all that is necessary to have existing programs running as managed code, with all the stability and reliability that.net offers. Further technical details on the few changes required to some older Delphi programs are outlined in the white paper Migrating Win32 applications to the Microsoft.NET Framework with Delphi 8 at www.borland.com. 6
Using Windows Forms and Web Forms A key strength of the.net Framework is that it includes a single set of system libraries that are used to work with all Windows services. In addition to the core.net framework,these libraries include Windows Forms for desktop user interfaces, ASP.NET for creating Web server interfaces, and ADO.NET for data access. The libraries are the same software that is used with Visual Studio.NET. This makes it possible to integrate Delphi code alongside other parts of a system written using C#, Visual Basic, or Managed C++. Such a composite program can be compiled into a single application. Each of the.net libraries is available directly from Delphi 8. As new versions of the libraries are made available and as new technologies are released it will immediately be possible to use Delphi to work with these libraries without any further software. Delphi developers will find themselves at home with the Windows.NET libraries. Microsoft acknowledges the influence that Delphi has had on the design of the class hierarchy, so many aspects will be familiar. The result is that Delphi developers do not take long to become productive with the.net Framework libraries. Delphi 8 includes full designer support in the IDE for Windows Forms and ASP.NET Web Forms. Because Delphi 8 includes comprehensive HTML editing capabilities, Web Forms applications can be edited visually or through an HTML code-behind file that is run on the Web Server. Delphi code can be included in events generated by the Web server. Full debugging support is included, allowing breakpoints and expression evaluation on remote Web applications as well as local Windows Forms applications. Web Forms applications can even be profiled through the Borland Optimizeit Profiler for the Microsoft.NET Framework, included with Delphi 8 Architect. For ASP.NET development, Delphi 8 supports the Microsoft IIS Web server as well as the Cassini Project Web Server, a lightweight.net-hosted server that is easy to install and maintain. 7
Extending ADO.NET: the Borland Data Provider Not only does Delphi 8 support ADO.NET as supplied in the.net Framework, it also includes additional technology to streamline development. This includes the Borland Data Provider (BDP) for ADO.NET together with extra tools in the IDE. ADO.NET is the standard library used by the.net Framework to work with relational databases. It provides a standard set of components that retrieve, cache, and update data to back-end databases. The connection to the database itself is handled through standard.net interfaces that are implemented by the server vendor. In practice, this means that if an application needs to switch from using one database server to another, the application must be reworked to refer to the different vendors ADO.NET provider components. So, for example, a shift from SQL Server to IBM DB2 would mean replacing SqlConnection components with DB2Connection components. The Borland Data Provider is a single set of components that works with a range of servers. Because the connection to the back-end server is defined through a single string, the database used by an application can be changed easily after deployment. The Borland Data Provider offers other advantages. Usually, the data types used by each of the different server providers must be mapped to the native.net data types each time the data is accessed. This does not need to be done with Borland Data Provider, significantly simplifying code. Finally, the BDP is an open, published specification, so it is quite straightforward for third parties to create additional drivers. These already include MySQL, PostgreSQL, and others. The open architecture makes it possible to add new database-specific design-time features and specialized capabilities recognized at runtime. Additional tools such as performance profilers and trace utilities also can be easily integrated. 8
The advanced new Delphi 8 IDE As well as providing a new compiler, a new version of the Delphi VCL, and additional capabilities for.net, Borland has created a new integrated development environment for Delphi 8. Figure 1: Delphi 8 includes comprehensive designers for Windows Forms applications This environment is designed to take advantage of the.net Framework, including direct access to the entire.net Framework component library. It also integrates with other Borland solutions for code profiling, requirements management, and configuration management. The new default display layout has each of the tools docked in a single window. However, a desktop SpeedSetting can change the layout to more closely reflect the familiar undocked Delphi designer from previous versions: 9
Figure 2: The IDE windows can be 'undocked to resemble the classic Delphi layout Some features have been adapted from previous versions of Delphi. For instance, the Project Manager tool window at top right gives the same ability to organize projects into groups. 10
Figure 3: The Model View shows a logical representation of the project Other features are new. For instance, under the Project Manager tab is a new Model View tab, which gives a logical model visualization of the current project based on the object hierarchy: 11
Figure 4: The Data Explorer gives direct access to ADO.NET data Under the Model View is the Data Explorer tab, with direct access to each connection set up for the Borland Data Provider. The BDP is a new technology that simplifies access to ADO.NET databases, and the Data Explorer provides a tree view to browse, query, and view data in the databases. Delphi 8 includes two distinct forms design technologies the VCL-derived Delphi forms designer and the new Windows Form designer. They share a design interface that is practically identical, allowing developers to choose the technology that is most suitable for their application. 12
Figure 5: Delphi 8 shows live data from ADO.NET at design time The component palette, at bottom right, has been streamlined. Developers who use.net typically have several dozen components available, and the new tool palette makes it easy to quickly search and select the desired component. Unlike Visual Studio, Delphi includes the ability to preview data from Borland Data Provider connections while the application is under development. This makes it much easier to create data-driven applications, because the layout of the form can be properly previewed without running the application. 13
Figure 6: The Tool Palette can be reorganized to suit the developer The tool palette can be reorganized in different ways to suit the developer either with text descriptions or with only the icon. Optionally, component icons can be grouped into headings chosen by the developer. Figure 7: Incremental typing eases selection of components 14
If the name of the desired component is known, it can be selected using an incremental search. Typing the first few letters of the name in the Search box filters the view of the components. Figure 8: The Object Inspector now groups properties by function The Object Inspector at left also has been revamped. Grouping the properties for each component into categories makes finding the desired property easier. Component editors are now available through the Object Inspector, so they are easier to find and use. The description pane makes it easier to understand the function of each property. When using Windows Forms, nonvisual components such as database connections now reside in their own Component Tray at the bottom of the form designer as shown in Figure 9 below. This simplifies their organization and makes them easier to find. 15
Figure 9: Delphi 8 can create ASP.NET applications with live data Besides the ability to create both Windows Forms and VCL forms, Delphi 8 includes a full designer to create Web Forms applications using ASP.NET. These can be laid out graphically in the forms designer. Here, Borland Data Provider and Borland DB Web Controls for ASP.NET components also provide live data during design time, as seen in Figure 9. 16
Figure 10: The Code Editor supports code folding hiding blocks of code Figure 11: The same code as Figure 10, unfolded The famous Borland code editor has also been revamped. It now supports code folding, so procedures and functions or larger blocks of code can be hidden, making it easier to focus on the business logic in the code. In this example, code folding has been used to hide the extra logic automatically created by the forms designer when a Windows Forms application is created. 17
When editing code, the Tool Palette changes to show a list of code snippets. These allow simple reuse of commonly used blocks of code. Figure 12: Code Snippets make it easy to reuse blocks of code Each of the tool windows is resizable and can be docked, stacked, or hidden in the margins. Layouts can be saved, so a form design layout might provide more space for the component palette than a code editing view. All this is customizable to the developer s preference. 18
Figure 13: Delphi 8 allows tool windows to be undocked to the margins of the IDE to maximize screen space Integration with other Borland solutions Today s software developers need agile solutions that make it easier to switch quickly among requirements gathering, systems design, application development, software testing, and deployment. For maximum productivity, and to deliver the best software, teams need to return to any one of these stages once an application has been started. For agile development to be effective, solutions for each of these steps must be integrated closely. This is the Borland approach to Application Lifecycle Management (ALM): the solutions for each stage are each leaders in their fields, yet they work closely together to give teams great productivity and superb flexibility. 19
Borland Delphi 8 can be used as the development piece of such an integrated application solution. A key advantage of the new Delphi IDE is that it is modular and extensible. This has made it possible to provide direct integration with other phases of development. For example, it is essential that project requirements be properly defined and managed. Borland CaliberRM is a complete solution that helps identify and track the requirements of users and managers. 20
Figure 14: CaliberRM is integrated directly into Delphi 8 21
Delphi 8 integrates closely with Borland CaliberRM. When both products are installed, an extra tool window gives a direct view of the project requirements, so the developer does not need to switch to an external application to view and update the status of the project. This example of streamlining development through close integration applies to other parts of Delphi. The modular Borland architecture allows developers to focus on completing their applications instead of worrying about file format translation and other housekeeping chores. The configuration management solution, Borland StarTeam, closely integrates with the menus of Delphi 8. StarTeam helps developers keep up-to-date with the latest version of the project and provides many utilities that project managers can use to synchronize development across widely distributed teams. Delphi 8 Enterprise and Architect include StarTeam Standard and a one-user license. Figure 15: With Borland StarTeam integration, developers can check files into and out of the source control repository Performance and resource optimization are critical if enterprise applications are to be as fast as users demand. Borland Optimizeit Profiler for the Microsoft.NET Framework is integrated into Delphi 8 Architect, so.net applications can be profiled by selecting a single menu 22
option. This means that the application can be profiled during development, an important step in ensuring that the approach when writing code is appropriate. Delphi 8 Architect integrates technology from Borland Together and Borland Enterprise Core Objects (ECO) to make it possible to create model-driven applications. Creating model-driven applications with Delphi 8 Architect A model-driven application automatically creates business objects and their underlying logic directly from a graphical model of the application. This approach can save time when first creating a system. The real benefits are seen when the application later needs to be changed, because a change to the model is typically reflected directly in the completed application. Delphi 8 Architect includes a model-driven application development solution known as Borland Enterprise Core Objects, or ECO. This takes a UML package diagram and associated class diagrams and creates a set of business objects based on the classes defined in the model. It automatically enforces business rules defined in the Object Constraint Language. A rich and powerful runtime, ECO rewards the time taken in creating an application model by making implementation fast and straightforward. It helps logically separate the business objects in an application from the presentation logic, so the impact of changes is minimized. Because the model is a part of the application, it is easier to understand how the system works, which is especially useful for larger enterprise projects that might be maintained by different people over time. The ECO runtime includes a UML class diagram designer that is accessed through the Delphi 8 Model View. This automatically generates a unit of source code that includes all the logic necessary to create.net objects based on these classes. 23
ECO also includes a specialized designer, the EcoSpace. This makes the classes defined through the model available as DataSources throughout the application. As a result, creating and using new objects based on these classes is as easy as working with a database. Once they have been created, the objects can be stored to a database using the automatic persistence mapping features of ECO. This translates the objects into regular relational database tables. One of the powerful features of ECO is the ability to easily accommodate changes to applications. If extra elements are added to the model, the underlying data can be migrated easily to a new structure, which is not always easy with relational databases. By automatically creating and persisting business objects based on classes in the UML diagram, ECO can dramatically reduce the amount of code needed in an application. This makes a system more reliable there is less code to go wrong. It also makes it more likely that the completed application will match the initial specifications of users. Summary With the release of the Microsoft.NET Framework, developing Windows applications has been transformed, easing deployment and increasing reliability. No longer are project managers fixed to one language for a whole system: it is now possible to choose an appropriate language for different parts of a system. With Delphi 8, Borland provides the richest set of development capabilities for the.net Framework. The new IDE streamlines development of Windows Forms, ASP.NET Web Forms, and Web Services applications, while innovations such as the Borland Data Provider make it easy to deploy applications that work with today s mix of enterprise databases. The ECO framework reduces the time taken to create applications and greatly eases maintenance. By using a UML model to create the business logic, developers can concentrate on proper analysis of users requirements rather than internal housekeeping in the application. 24
For existing Delphi users, Delphi 8 is a straightforward move from previous versions. Practically all existing applications can be recompiled for.net, where they take advantage of the new.net reliability and security features. Even applications that use dbexpress, and the older Borland Database Engine, can be brought over to the new environment. Borland is committed to giving developers the best possible technology for the entire application lifecycle. Delphi 8 integrates smoothly with solutions for other development tasks, including Borland StarTeam for application management, Borland CaliberRM for requirements management, and Borland Optimizeit Profiler for application profiling. Taken together, this integrated set of solutions gives by far the richest development solution for the Microsoft.NET Framework, without sacrificing previous investments in software development. For more information on Borland Delphi 8, and for more detailed information such as selfrunning product demonstrations, ECO tutorials, trial software, and more, please visit the online Delphi product site at http://www.borland.com/delphi_net/ Made in Borland Copyright 2004 Borland Software Corporation. All rights reserved. All Borland brand and product names are trademarks or registered trademarks of Borland Software Corporation in the United States and other countries. Microsoft, Windows, and other Microsoft product names are trademarks or registered trademarks of Microsoft Corporation in the U.S. and other countries. All other marks are the property of their respective owners. Corporate Headquarters: 100 Enterprise Way, Scotts Valley, CA 95066-3249 831-431-1000 www.borland.com Offices in: Australia, Brazil, Canada, China, Czech Republic, France, Finland, Germany, Hong Kong, Hungary, India, Ireland, Italy, Japan, Korea, Mexico, the Netherlands, New Zealand, Russia, Singapore, Spain, Sweden, Taiwan, the United Kingdom, and the United States. 21424 25