home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161b.iso / full / delphi / DELPHI16 / TECHINFO / DELPHI / TIS / TI2779.FX < prev    next >
Encoding:
Text File  |  1995-08-24  |  43.8 KB  |  1,281 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  8.   VERSION  :  All
  9.        OS  :  Windows
  10.      DATE  :  July 14, 1995                            PAGE  :  1/21
  11.  
  12.     TITLE  :  Delphi Client/Server and Power Builder Compared
  13.  
  14.  
  15.  
  16.  
  17. An Evaluation of
  18. Client/Server Development Tools: 
  19. A Comparison Between 
  20. Delphi Client/Server and PowerBuilder Enterprise
  21.  
  22. Prepared by Michael Lant, Sphere Data Systems
  23.  
  24.  
  25. Table of Contents
  26.  
  27. Introduction: An Overview of Client/Server Tools  
  28.      PCs and the Evolving Client/Server Model
  29.      The Next Generation
  30.  
  31. What is Delphi?     
  32.      Redefining Client/Server Development
  33.      The Delphi Component Model
  34.  
  35. Performance    
  36.      Compiled vs Interpreted Code
  37.      Data Access - A New Approach
  38.  
  39. Rapid Application Development (RAD)     
  40.      Minimum Coding, Maximum Flexibility
  41.      DataWindows vs Reusable Forms
  42.  
  43. Component Reuse     
  44.      The Delphi Inheritance Model
  45.      A DataWindows Alternative
  46.      Exception Handling
  47.  
  48. Database Scalability     
  49.      Borland Database Engine
  50.      Local InterBase Server
  51.  
  52. Conclusion     
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  69.   VERSION  :  All
  70.        OS  :  Windows
  71.      DATE  :  July 14, 1995                            PAGE  :  2/21
  72.  
  73.     TITLE  :  Delphi Client/Server and Power Builder Compared
  74.  
  75.  
  76.  
  77.  
  78. Introduction: An Overview of Client/Server Tools
  79.  
  80.  
  81. Client/server development tools remain one of the fastest-growing
  82. sectors of the software industry. Forrester Research predicts
  83. that the number of client/server developers will climb from
  84. 128,400 in 1994 to 698,000 in 1996, while META Group research
  85. suggests that over 90% of all new applications will be based on
  86. the client/server model. This is an overwhelming endorsement of
  87. the popularity of client/server computing. 
  88.  
  89. Client/server computing, however, is not the panacea that many
  90. have been predicting. Complex environments, with mixed data
  91. sources and immature development tools, have made client/server
  92. development a complex undertaking. Researchers such as the
  93. Gartner Group have found that the most pressing issues facing
  94. current developers of client/server applications include
  95. performance of deployed applications, rapid application
  96. development (RAD), component reuse and database scalability.
  97. Although these concerns are not unique to client/server
  98. application development, they are perhaps even more important in
  99. this sector, because of the well-documented limitations of
  100. first-generation client/server tools. 
  101.  
  102. PCs and the Evolving Client/Server Model
  103.  
  104. PCs facilitated the downsizing era, by providing inexpensive
  105. platforms for the production of  reasonably capable solutions
  106. that addressed genuine business needs. These applications brought
  107. with them the promise of freedom from host-based technologies and
  108. shortened development cycles. But as these PC- and network-based
  109. applications grew, user counts expanded and more functionality
  110. was necessary. PC database applications frequently "hit the
  111. wall."   
  112.  
  113. In addition, all database applications have at their very heart
  114. business rules. These rules control processes such as creating
  115. new customers and data validation. Historically, PC application
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  130.   VERSION  :  All
  131.        OS  :  Windows
  132.      DATE  :  July 14, 1995                            PAGE  :  3/21
  133.  
  134.     TITLE  :  Delphi Client/Server and Power Builder Compared
  135.  
  136.  
  137.  
  138.  
  139. development has placed the enforcement of business rules into the
  140. user interface, so programmers would create a screen and write
  141. code to respond to user input. This code would perform a specific
  142. action based on the presence, or value of, certain information.
  143. Such actions might include allowing or preventing the posting of
  144. changes to customer data. But the user interface is certainly not
  145. the best place to store business rules. 
  146.  
  147. The advent of client/server brought with it a new model that
  148. allows for business rules to be stored with the data itself. This
  149. is accomplished through the use of triggers and stored procedures
  150. created in the actual database. These procedures would enact
  151. routines to perform much the same processing that might be
  152. performed in a PC application, except that the host handles this
  153. task for all of its clients. This approach ensured that there was
  154. only one source for the business rules, since they were stored
  155. with the data. In many ways, this approach is enticing, but in
  156. reality it is plagued with problems. 
  157.  
  158. When business rules are created to be enforced at the server
  159. level, they tend to be difficult to write and debug. According to
  160. David Sarna and George Febish in the September 1994 issue of
  161. Datamation: "These are not the tools for creating and maintaining
  162. good code. Doing it this way is SQL-abuse; SQL as a query
  163. language was never designed to do this kind of procedural
  164. computation." 
  165.  
  166. With this model, as an application grows, so do the number of
  167. rules that must be created and controlled by the database. Rather
  168. than focusing on the efficient storage and retrieval of data,
  169. server resources become tied down enforcing business rules - such
  170. as ensuring that a last name is supplied for each new customer.
  171. Again, Sarna and Febish point out that "many of your business and
  172. validation rules are needed so often that they must sit on the
  173. client, or performance will go straight to hell." 
  174.  
  175. The Next Generation
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  191.   VERSION  :  All
  192.        OS  :  Windows
  193.      DATE  :  July 14, 1995                            PAGE  :  4/21
  194.  
  195.     TITLE  :  Delphi Client/Server and Power Builder Compared
  196.  
  197.  
  198.  
  199.  
  200. Borland's Delphi is truly a next generation client/server
  201. development tool. Although it fully supports the placement of
  202. business rules in the user interface or on the server (or even a
  203. combination of both), it also presents the possibility of another
  204. model that separates the business rules from both the user
  205. interface and the server. This approach has the potential to
  206. provide greater performance, better scalability, better code
  207. reuse and an ideal platform for RAD. Delphi makes this possible
  208. because it employs an open architecture, whereby developers can
  209. use or create a wide variety of specialized components when
  210. creating applications. 
  211.  
  212. Comparative reports of software tools typically focus on feature
  213. matrices or checklists to relate the features of one product
  214. versus those of its competitors - and in this context Delphi
  215. would certainly emerge as a winner. Checklists, however, do not
  216. necessarily help developers understand how one product could be
  217. far more effective than another. Thus, the content of this white
  218. paper is focused on the needs of client/server application
  219. developers, and how Delphi addresses those needs. 
  220.  
  221.  
  222. What is Delphi?
  223.  
  224. Delphi represents the next generation of client /server and
  225. general Windows application development tools. It is a product of
  226. Borland's long-standing leadership in programming languages,
  227. database development tools, and object-oriented programming (OOP)
  228. technology. Delphi is unique in providing a completely visual
  229. integrated development environment (IDE) that is built around a
  230. powerful object-oriented compiled language (Object Pascal). The
  231. IDE shields programmers from the complexity of Windows
  232. development, by encapsulating the Windows application programming
  233. interface (API) inside robust, reusable components. 
  234.  
  235. The implementation of a component-based architecture enhances
  236. power and flexibility. Components range from simple items (such
  237. as buttons, text edit regions or sliders) through to powerful
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  252.   VERSION  :  All
  253.        OS  :  Windows
  254.      DATE  :  July 14, 1995                            PAGE  :  5/21
  255.  
  256.     TITLE  :  Delphi Client/Server and Power Builder Compared
  257.  
  258.  
  259.  
  260.  
  261. specialized tools (such as high-performance database components
  262. used for table access, queries and batch updates). While most
  263. client/server development tools include a limited selection of
  264. these basic components, Delphi ships with more than 75 reusable
  265. components. 
  266.  
  267. Developers may modify Delphi components, create their own, or
  268. purchase third-party components (which include text processors,
  269. graphics, communications and statistical utilities, among
  270. others). Once installed on Delphi's component palette, these
  271. additional components become part of the IDE, so that Delphi can
  272. be tailored to whatever the developer (or team of developers)
  273. specifically requires. 
  274.  
  275. Because of the unique way in which components are implemented in
  276. Delphi, it offers similar open architecture benefits to those of
  277. the ISA bus, for example. A component is a self-contained block
  278. of code that includes all functionality to work within a Delphi
  279. application. Just like inserting a new PC expansion card, any new
  280. component added to the library becomes part of Delphi and is
  281. indistinguishable from those that ship with the product. This
  282. open, component-based structure means that Delphi developers are
  283. not tied to any particular development methodology, and may use
  284. whatever tools or components are necessary to accomplish a task. 
  285. Redefining Client/Server Development
  286.  
  287. First generation visual client/server development tools (such as
  288. PowerBuilder) feature environments where all components are
  289. tightly integrated and dependent upon one another. Such an
  290. approach does not encourage modification or customization of
  291. existing components, because when a component is significantly
  292. altered, it has the potential of changing the way in which it
  293. interacts with others. This not only impedes the evolution of the
  294. base product, but it also has the potential to introduce
  295. unpredictable behavior. 
  296.  
  297. Delphi, on the other hand, has as its foundation a true
  298. object-oriented language, with the result that its components are
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  313.   VERSION  :  All
  314.        OS  :  Windows
  315.      DATE  :  July 14, 1995                            PAGE  :  6/21
  316.  
  317.     TITLE  :  Delphi Client/Server and Power Builder Compared
  318.  
  319.  
  320.  
  321.  
  322. essentially autonomous objects. Component changes are therefore
  323. unlikely to affect overall product stability. Also, problems with
  324. any specific component behavior can often be corrected by the
  325. developer via subclassing, and thereby overriding the errant
  326. behavior. This also holds true for components created by a
  327. developer or purchased from third-party suppliers. 
  328.  
  329. Delphi Component Types
  330.  
  331. Delphi's Visual Component Library (VCL) includes more than 75
  332. pre-built components, which can be used in applications and
  333. deployed freely. These include the following: 
  334.  
  335. Standard - Menus, Edit, Label, Buttons, Scroll Bar;
  336.  
  337. Additional - Bitmap Button, SpeedButton, Notebook, Outline,
  338. DrawGrid, Image, Multimedia; Data Access - Database, Table,
  339. Query, Batch Move, Report;
  340.  
  341. Data Controls - DataGrid, DBNavigator, DBLabel, DBEdit, DBImage,
  342. ComboBoxes; 
  343.  
  344. Dialogs - Open, Save, Font, Color, Print, Print Setup,
  345. Search/Replace, Tabbed Notebook;
  346.  
  347. System - Timer, FileListBox, Drive and Directory Combo OLE, DDE;
  348.  
  349. VBX - Chart, Picture, Gauge;
  350.  
  351. Samples - Gauge, ColorGrid, SpinButton, SpinEdit, Outline,
  352. Calendar. 
  353.  
  354. Delphi developers can also create their own components, by
  355. modifying existing Delphi components or building them from
  356. scratch. The source code for Delphi's VCL is available to help
  357. developers in this task. Newly-developed components (or those
  358. purchased from third-party developers) can be added to Delphi's
  359. component palette. 
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  374.   VERSION  :  All
  375.        OS  :  Windows
  376.      DATE  :  July 14, 1995                            PAGE  :  7/21
  377.  
  378.     TITLE  :  Delphi Client/Server and Power Builder Compared
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385. Performance
  386.  
  387. In a client/server environment, overall performance depends upon
  388. a combination of factors, including efficiency of  the database
  389. server, network bandwidth, "middleware" or driver performance,
  390. data access techniques, and speed of the user interface. A
  391. well-designed architecture should leverage all of these
  392. characteristics. In almost all respects, Delphi outperforms
  393. PowerBuilder by a significant margin, due to its optimizing
  394. compiler, efficient VCL components and high-performance native
  395. SQL drivers. Some sample benchmark results are listed below: 
  396.  
  397. Operation (All times in seconds)   Delphi         PowerBuilder 
  398. String parse to measure            2.7            22.8 
  399. non-database performance;reading 
  400. file and splitting record into 
  401. substrings
  402.  
  403. Use a query to load a form from    4.6            70.9
  404. a 20,000 record table.  Form 
  405. supports searching and filtering.
  406.  
  407. Post a record (single order)       1.4            1.3 
  408.  
  409. Apply a filter on 20,000 record    3.0            6.2 
  410. table               
  411.  
  412. Update record                      1.5            1.1 
  413.  
  414. Search for a value, 20,000 records 1.1            1.5 
  415.  
  416. User Interface Performance and Compiled vs Interpreted Code 
  417. The user interface (UI) is the most visible portion of any
  418. application. UI performance covers obvious functionality such as
  419. screen updates, along with the underlying processing of data
  420. (including numerical calculations and string manipulations). It
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  435.   VERSION  :  All
  436.        OS  :  Windows
  437.      DATE  :  July 14, 1995                            PAGE  :  8/21
  438.  
  439.     TITLE  :  Delphi Client/Server and Power Builder Compared
  440.  
  441.  
  442.  
  443.  
  444. is the portion that users interact with every day, and it is also
  445. the first place where performance differs noticeably between
  446. PowerBuilder and Delphi. 
  447.  
  448. Delphi uses an optimizing native code compiler to generate
  449. standalone executable files (.EXEs) containing machine code
  450. instructions. These executable files are self-contained and,
  451. other than the database engine and the data itself, require no
  452. external files to run. Although PowerBuilder creates an
  453. executable file, it is not truly compiled. When a PowerBuilder
  454. application is run, source code instructions are converted to
  455. machine code before the instructions may be executed. This extra
  456. level of translation introduces significant run-time overhead and
  457. seriously degrades performance. 
  458.  
  459. To support its runtime interpretation, PowerBuilder requires
  460. external support files in the form of  runtime interpreter
  461. Dynamic Link Libraries (DLLs). In addition to the application
  462. code, these DLLs must be loaded into memory at runtime, creating
  463. a larger memory "footprint" and leaving less memory for
  464. processing and buffering data. As a result, Delphi applications
  465. execute between 10 and 20 times faster than applications created
  466. using p-code ("pseudo-code") interpreters such as PowerBuilder,
  467. even on target systems with minimal memory. 
  468.  
  469. In moving from PowerBuilder 3.0a to 4.0, PowerSoft tuned its
  470. runtime interpreter to achieve slightly better performance on
  471. systems fitted with 16M of memory. This performance boost often
  472. comes at a cost, however, as final applications can increase from
  473. 20 to 70 percent in size. Despite minor enhancements, there is no
  474. way for an interpreted p-code language to even approach the
  475. execution speed of a compiled language like that of Delphi. 
  476.  
  477. Data Access - A New Approach
  478.  
  479. The two primary methods of implementing client/server solutions
  480. with PowerBuilder involve placing business rules on either the
  481. client or the server. Unfortunately, neither one adequately
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  496.   VERSION  :  All
  497.        OS  :  Windows
  498.      DATE  :  July 14, 1995                            PAGE  :  9/21
  499.  
  500.     TITLE  :  Delphi Client/Server and Power Builder Compared
  501.  
  502.  
  503.  
  504.  
  505. addresses the issue of overall performance. If developers choose
  506. to place the burden of enforcing business rules on the server,
  507. they risk performance bottlenecks due to server and network
  508. overload. Yet shifting this task to the comparatively slow
  509. PowerBuilder UI is not an ideal solution. As it turns out,
  510. PowerBuilder's design makes it difficult not to attach at least
  511. some of the business rules directly to the UI. 
  512.  
  513. Delphi, on the other hand, fully supports either of these
  514. techniques, as well as allowing for a more flexible model. Delphi
  515. developers can create a "virtual third-tier" layer containing
  516. business rules independent of  the UI and the server. Instead,
  517. these rules can be encapsulated in non-visual components (NVCs)
  518. in a layer between the UI and database engine. Physically and
  519. conceptually, this separates the data and related rules from its
  520. representation to the user. 
  521.  
  522. This approach brings the distributed computing vision of
  523. client/server another step closer to reality, and also provides a
  524. practical means of enhancing performance. All data moving to and
  525. from the application passes through this central conduit. The
  526. "third-tier" NVCs may be single Delphi components such as a
  527. TTable or TQuery or sophisticated combinations of components. By
  528. having a single access point to lookup tables (such as State,
  529. Province or Product Codes that may be used by several forms), the
  530. application need only fetch this data once - when it is started.
  531. This can greatly reduce the number of server requests,
  532. alleviating network traffic and server load. 
  533.  
  534. More importantly, developers can place connections to the main
  535. database tables here as well. As users move between forms,
  536. cursors to their data would remain in place. Thus, if basic
  537. customer information were displayed in one form, moving to
  538. another form displaying credit history would invoke it already
  539. pointing to the appropriate customer. PowerBuilder has limited
  540. functionality in this area through the dwShareData function,
  541. which allows sharing of data between DataWindows. This process
  542. results in duplication of large, complex components, and unless
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  557.   VERSION  :  All
  558.        OS  :  Windows
  559.      DATE  :  July 14, 1995                            PAGE  :  10/21
  560.  
  561.     TITLE  :  Delphi Client/Server and Power Builder Compared
  562.  
  563.  
  564.  
  565.  
  566. sufficient RAM is available, this can further degrade client
  567. performance. In the same situation, Delphi reduces the number of
  568. components used, since data access and display are accomplished
  569. with separate components. 
  570.  
  571.  
  572. Rapid Application Development (RAD)
  573.  
  574. Rapid Application Development (RAD) is an attempt to address the
  575. issues of building applications tailored to customer requirements
  576. and completing projects with minimal re-working. Historically,
  577. serious application development involved tremendous effort from a
  578. team of analysts who quizzed potential users to determine every
  579. possible requirement of the application. From this collection of
  580. information, volumes of carefully documented specifications were
  581. produced, then the users would sign off and programming
  582. commenced. Some time later, the development team would finally
  583. emerge with an application, and users were then expected to adopt
  584. the product. 
  585.  
  586. This model had several shortcomings. Often, the people who built
  587. the application were not the same as those who did the analysis,
  588. resulting in reinterpretation of the specifications. Furthermore,
  589. users are often not well equipped to diagnose and describe their
  590. technology needs. During the development process, little
  591. communication existed between the developers and eventual users
  592. of the application. In days gone by, when terminals and batch
  593. operations were the only UI, this may have been an adequate
  594. model. However, with the advent of PCs, user expectations are
  595. significantly higher in regard to the UI characteristics of
  596. modern client/server applications. These applications must now
  597. provide access to data, and present it in ways that are most
  598. meaningful to users, with tools to assist in the analysis and
  599. interpretation of the data. As a result, most large organizations
  600. are confronted with a backlog of applications, which must be
  601. tackled with limited staff, budgets and time. 
  602.  
  603. RAD is a development methodology based around an iterative
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  618.   VERSION  :  All
  619.        OS  :  Windows
  620.      DATE  :  July 14, 1995                            PAGE  :  11/21
  621.  
  622.     TITLE  :  Delphi Client/Server and Power Builder Compared
  623.  
  624.  
  625.  
  626.  
  627. process of specifying, creating and enhancing an application
  628. until the final product is completed. RAD is based on the notion
  629. that it is difficult to fully predefine a problem domain as
  630. complex as today's typical business applications. As the
  631. developers step through each iteration from prototype to finished
  632. product, the requirements become more clearly defined. Although
  633. not ideal for batch-style applications, RAD is very effective for
  634. the development of applications where the UI design is a key
  635. consideration. 
  636.  
  637. Minimum Coding, Maximum Flexibility
  638.  
  639. RAD development tools should allow developers to quickly build
  640. prototypes with as little code as possible, and Delphi is very
  641. powerful in this respect. Building a database application with a
  642. classic Customer -> Orders -> Details form (including database
  643. connections) can be done with no lines of code in Delphi. By
  644. comparison, PowerBuilder developers must write a dozen lines of
  645. code to simply link to a database, then they must also write code
  646. to open the form, query the tables and synchronize the tables
  647. appropriately. 
  648.  
  649. Delphi's comprehensive array of data-aware components minimizes
  650. the level of customization that must be done to deliver a
  651. necessary feature or function. Where appropriate functionality
  652. does not exist in a VCL component, developers have the option of
  653. modifying the component or using a third-party component (such as
  654. a VBX control or Delphi native component). Any component may be
  655. subclassed (exploiting inheritance) and reused in other areas. 
  656.  
  657. DataWindows vs Reusable Forms
  658.  
  659. RAD methodology assumes that application design evolves through
  660. several phases, so a true RAD tool should allow developers to
  661. easily adapt to changes (which can be significant). Because
  662. PowerBuilder combines data access and display in a single
  663. component, some design changes can prove extremely difficult.
  664. When a customer requirement suddenly dictates a new approach to
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  679.   VERSION  :  All
  680.        OS  :  Windows
  681.      DATE  :  July 14, 1995                            PAGE  :  12/21
  682.  
  683.     TITLE  :  Delphi Client/Server and Power Builder Compared
  684.  
  685.  
  686.  
  687.  
  688. either data access or display, this often requires a rewrite of
  689. the DataWindow and/or the entire form. Since Delphi separates
  690. these two concepts, the adaptation process is much simpler. 
  691.  
  692. As with most first-generation visual development tools,
  693. PowerBuilder embeds application code inside objects - with the
  694. exception of the DataWindow, which represents both the conduit
  695. and the display format of the data. A DataWindow is created in a
  696. separate section (or "painter"), and cannot have event-handling
  697. code written until it is pasted into a form, whereupon the
  698. relevant application code is then permanently attached to that
  699. DataWindow. Since code is hidden inside objects scattered about
  700. the form, it becomes difficult for developers to locate, and it
  701. also may be affected by modifications to objects on the form.
  702. Furthermore, by "hard-wiring" the DataWindow to the code, it
  703. becomes difficult to reuse that DataWindow in other forms. 
  704. Delphi developers address this issue by writing event handlers,
  705. which are pointers to specific procedures, or references within
  706. components that indicate what procedure will be called when a
  707. particular event occurs (mouse click, timer interrupt, etc). Form
  708. procedures are stored in a "unit" file, with all the code visible
  709. to the developer, so there is no need to search through various
  710. objects track down specific code fragments. Once procedures are
  711. created, they may be called by any event of any component. Event
  712. handlers can also call procedures written for any other event
  713. handler, or even directly access components or procedures
  714. residing in other forms. Deleting an object (such as a button)
  715. does not delete procedures created for that object, so that code
  716. changes are easier, faster and safer. 
  717.  
  718. Since Delphi uses the same property/event model for all
  719. components, whether they are visual or non-visual, it is more
  720. consistent and easier to learn than products such as
  721. PowerBuilder. The end result is that Delphi clearly provides an
  722. ideal environment for RAD. 
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  740.   VERSION  :  All
  741.        OS  :  Windows
  742.      DATE  :  July 14, 1995                            PAGE  :  13/21
  743.  
  744.     TITLE  :  Delphi Client/Server and Power Builder Compared
  745.  
  746.  
  747.  
  748.  
  749. Component Reuse
  750.  
  751. Inheritance is the ability to create new objects (descendants)
  752. from a base object (ancestor). A descendant inherits all
  753. characteristics of the ancestor, although these can be
  754. overridden. Inheritance is an object-oriented programming (OOP)
  755. fundamental that provides a means by which programmers can reuse
  756. code, and it encourages development of base objects with
  757. characteristics that are likely to be used again. Since
  758. descendants inherit any changes made to the parent object,
  759. changes that are made will propagate throughout any objects that
  760. descend from  a base object. The resulting collection of objects
  761. is often called a class hierarchy or class library.  
  762.  
  763. PowerBuilder allows developers to use inheritance to create a
  764. class library based on forms or groups of controls. The problem
  765. with the PowerBuilder approach is that it emphasizes inheritance
  766. of the user interface. Because DataWindows perform the task of
  767. both data access and data display, and because of the close
  768. binding between a DataWindow and various objects (and code) on a
  769. form, UI inheritance is the only type of inheritance that makes
  770. sense in PowerBuilder. However, what developers mostly need to
  771. preserve and reuse is not the visual representation of the data,
  772. but instead the complex logic that drives the business rules. In
  773. fact, the visual representation usually changes the most. Hence,
  774. reuse through inheritance in PowerBuilder often requires the
  775. developer to spend significant time overriding the UI in order to
  776. preserve the underlying code. As a result, PowerBuilder forms
  777. often carry around much unwanted baggage. 
  778.  
  779. Delphi takes an entirely different approach. In its first
  780. release, Delphi, supports inheritance of forms in code only,
  781. compared to PowerBuilder's support of UI inheritance. With the
  782. ability to separate business rules from the UI, a Delphi
  783. developer need only write these once. Different forms can access
  784. the same data components and inherit their business rules, but
  785. are not bound to them. Hence the developer is free to create any
  786. number of forms displaying data in whatever format is
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  801.   VERSION  :  All
  802.        OS  :  Windows
  803.      DATE  :  July 14, 1995                            PAGE  :  14/21
  804.  
  805.     TITLE  :  Delphi Client/Server and Power Builder Compared
  806.  
  807.  
  808.  
  809.  
  810. appropriate, knowing that the non-visual components supplying
  811. data to the user interface have fully encapsulated these business
  812. rules. 
  813.  
  814. Such an approach would be difficult with a product such as
  815. PowerBuilder, because the underlying interpreter-based
  816. architecture is not truly object-oriented. According to Steve
  817. Benfield, quoted in the June/July 1994 issue of PowerBuilder
  818. Developers Journal: "PowerBuilder's DataWindows is not truly
  819. object-oriented. I could try to not use DataWindows and code
  820. PowerBuilder in a purely object-oriented way. However, the system
  821. would be so slow that it would be useless." 
  822.  
  823. The Delphi Inheritance Model
  824.  
  825. Inheritance is fundamental to Delphi, and all VCL components
  826. ultimately descend from an object known as TObject  (the "T"
  827. prefix is an accepted standard to denote an object  type).
  828. TObject has a great deal of capability built into it, and knows
  829. how to handle certain types of errors, along with how to display
  830. itself in the form designer. Many other components descend from
  831. TObject, each acquiring more capability and becoming more
  832. specialized along the way.  
  833.  
  834. The familiar case of copying to the Windows clipboard is an
  835. example of where Delphi's inheritance can be most powerful. This
  836. turns out to be a complex procedure requiring more than 100 lines
  837. of code in PowerBuilder, whereas the following code sample shows
  838. how the same CopyToClipBoard is handled in Delphi: 
  839.  
  840.   if (( ActiveControl ) is TCustomEdit ) then
  841. TCustomEdit(ActiveControl).CutToClipBoard
  842.  
  843.  
  844. This examples surfaces three important issues. The first is that
  845. it highlights how some very basic functionality is missing from
  846. PowerBuilder. The second is that Delphi developers deal with
  847. functions such as this on a much higher level than with
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  862.   VERSION  :  All
  863.        OS  :  Windows
  864.      DATE  :  July 14, 1995                            PAGE  :  15/21
  865.  
  866.     TITLE  :  Delphi Client/Server and Power Builder Compared
  867.  
  868.  
  869.  
  870.  
  871. traditional programming languages. Thirdly, the inheritance
  872. benefits are obvious. TCustomEdit is an ancestor of most of the
  873. editable components in Delphi (such as TEdit, TDBEdit and so on)
  874. In this example, the is operator checks to see if the active
  875. component  is a descendant of TCustomEdit, and if so, the next
  876. line casts the active control as its ancestor - TCustomEdit.
  877. Because CutToClipBoard is a method of TCustomEdit, all controls
  878. inherited from it will also inherit this method.  
  879.  
  880. A DataWindows Alternative
  881.  
  882. DataWindows are an important feature of PowerBuilder. By
  883. attempting to incorporate all database capability into a single
  884. structure, the result is a component that is extremely powerful,
  885. but highly complex. The PowerBuilder 3.0a reference manual
  886. allocates almost 150 pages to explaining the properties and
  887. syntax of the dwDescribe and dwModify functions, which are just
  888. two of the more than 130 functions used within DataWindows.
  889. According to Breck Carter, quoted in the June/July issue of
  890. PowerBuilder Developers Journal: "dwModify( ) and dwDescribe is a
  891. topic that I know has been a sticking point for many developers.
  892. These functions can be daunting with their screwy syntax and
  893. difficult-to-debug commands . . . If DataWindows' bazillion
  894. functions and events don't get you, you probably won't avoid
  895. being shocked and overwhelmed by dwModify." 
  896.  
  897. PowerBuilder developers place all of their code and forms in a
  898. single .PBL application file, while Delphi applications reside in
  899. three main file types. The application itself comprises .DPR and
  900. .PAS files, while .DFM files contains the binary representation
  901. of forms (buttons, grids etc). Delphi's project manager provides
  902. a high-level view of all these files, and units from other
  903. directories or projects can be easily included. By storing units
  904. in separate files, team development is simplified and the
  905. allocation of  tasks is made easier. Developers need not even  be
  906. in the same physical location. 
  907.  
  908. During compilation, Delphi keeps track of which files have
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  923.   VERSION  :  All
  924.        OS  :  Windows
  925.      DATE  :  July 14, 1995                            PAGE  :  16/21
  926.  
  927.     TITLE  :  Delphi Client/Server and Power Builder Compared
  928.  
  929.  
  930.  
  931.  
  932. changed since the last compile and only generates those changes.
  933. Delphi's compilation speed is the fastest in the industry, at
  934. more than 350,000 lines of code per minute on a 66MHz Pentium
  935. fitted with 8M of RAM. A reasonably complex client/server
  936. application containing over a dozen forms will compile all files
  937. in less than a minute. 
  938.  
  939.  
  940.  
  941. PowerBuilder's interpreter-based design makes direct comparisons
  942. with Delphi's compiled performance unrealistic. PowerBuilder
  943. developers cannot exit the code painter until their code is
  944. syntactically correct, so that moving between different code
  945. areas is greatly restricted. PowerBuilder then generates p-code
  946. from its scripting language, along with a runtime executable
  947. file. This p-code generation stage takes about the same amount of
  948. time as the complete syntax checking and compilation to machine
  949. code of a Delphi application. The PowerBuilder application,
  950. however, still requires translation and decoding overhead each
  951. time it is executed. 
  952.  
  953. As the complexity of applications and size of development teams
  954. grows, so does the need to maintain control of the process.
  955. Keeping track of the latest versions of source files is an
  956. important part of this process, and Delphi accomplishes this by
  957. providing a direct interface to PVCS, a leading version control
  958. utility. Delphi will directly link to the PVCS DLL and integrate
  959. it into the development environment. 
  960.  
  961. PowerBuilder developers frustrated with limitations of its
  962. programming language are forced to leave the environment and must
  963. turn to languages such as C++ or Pascal. Once they leave
  964. PowerBuilder, they must abandon any of their custom class
  965. libraries, which are not supported by other products. Delphi does
  966. not present such obstacles, as it is built around a comprehensive
  967. structured, object-oriented language featuring pass-through SQL
  968. commands and inline assembler. Since Delphi can encapsulate
  969. applications into DLL format, any Windows program (including
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  984.   VERSION  :  All
  985.        OS  :  Windows
  986.      DATE  :  July 14, 1995                            PAGE  :  17/21
  987.  
  988.     TITLE  :  Delphi Client/Server and Power Builder Compared
  989.  
  990.  
  991.  
  992.  
  993. PowerBuilder) can call a Delphi-generated DLL. In the same
  994. manner, Delphi applications can also access DLLs created using
  995. other development tools. 
  996.  
  997. Exception Handling
  998.  
  999. When developing serious client/server applications, it becomes
  1000. essential to write code that is able to deal with the possibility
  1001. of any process failing. Again, according to Breck Carter in the
  1002. 1994 Special Issue of  PowerBuilder Developers Journal: "The
  1003. PowerScript language is less than ideal when it comes to error
  1004. handling, Most functions can diagnose errors, but with very few
  1005. exceptions the default action is to ignore the error and proceed.
  1006. There are no debugging switches or compiler directives to change
  1007. this behavior to trap all errors and halt. With the exception of
  1008. the global SystemError event, there is little language support
  1009. for automatic error detection or handling." 
  1010.  
  1011. This lack of support from the PowerScript language makes it
  1012. difficult, if not impossible to create robust error-handling
  1013. routines without writing enormous amounts of code. In contrast,
  1014. Delphi introduces a new and more powerful error-handling
  1015. methodology. To understand how important this new approach is, we
  1016. must first look at how it is done. 
  1017.  
  1018. Fundamental to Delphi is the concept of objects. Every control in
  1019. Delphi descends ultimately from a base object control called
  1020. TObject. As shown in the diagram above, TObject and hence, all of
  1021. its descendants already knows about errors. This knowledge is
  1022. passed to the programmer by means of objects. When an error
  1023. occurs, Delphi instantiates an Exception object of that exception
  1024. type. For example, if a divide by zero error occurs, an
  1025. EDivideByZero object is created. All forms have built into them,
  1026. the means of dealing with most errors. Rather than having to
  1027. write code to test for every possible failure, the following
  1028. construct is used: 
  1029.   
  1030. try
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  1045.   VERSION  :  All
  1046.        OS  :  Windows
  1047.      DATE  :  July 14, 1995                            PAGE  :  18/21
  1048.  
  1049.     TITLE  :  Delphi Client/Server and Power Builder Compared
  1050.  
  1051.  
  1052.  
  1053.  
  1054.      { statements }
  1055.   except
  1056.      on ESomething do { specific exception handling code } ;  
  1057.           else {default exception-handling code } ;
  1058.   end;
  1059.  
  1060.  
  1061. Delphi also allows developers to create their own exception types
  1062. as follows: 
  1063.  
  1064. type
  1065. EpasswordInvalid = class(Exception) ;
  1066.  
  1067.  
  1068. This new user type exception is used simply as follows:
  1069.  
  1070.  
  1071.   if Password <> CorrectPassword then
  1072. raise EpasswordInvalid.Create(  Incorrect password entered' ) ; 
  1073.  
  1074. These examples are trivial and meant only to display concepts.
  1075. Delphi exception handling actually has capabilities far beyond
  1076. this. For instance, Windows General Protection Failure (GPF)
  1077. errors that are impossible to deal with in PowerBuilder
  1078. applications may be handled via Delphi's EGPFault exception type.
  1079. This simple construct provides enormous power and flexibility,
  1080. and minimizes the amount of code that needs to be written,
  1081. further shrinking the development cycle. 
  1082.  
  1083. Scalability
  1084.  
  1085. As more attention is focused on client/server development, the
  1086. scope of such applications is expanding. Where once it was
  1087. sufficient to provide basic data entry and inquiry capabilities,
  1088. users now demand that their applications have functionality far
  1089. beyond what can be provided from mainframe solutions. Delphi is
  1090. the ideal tool for this type of transition, being built around
  1091. Object Pascal, an enhancement of a language that is already known
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  1106.   VERSION  :  All
  1107.        OS  :  Windows
  1108.      DATE  :  July 14, 1995                            PAGE  :  19/21
  1109.  
  1110.     TITLE  :  Delphi Client/Server and Power Builder Compared
  1111.  
  1112.  
  1113.  
  1114.  
  1115. by more than two million developers.  
  1116.  
  1117. Delphi does not hide code within UI objects, and is thus more
  1118. familiar to mainframe developers and easier to work with than
  1119. PowerBuilder. It maximizes code reuse, minimizes development
  1120. turnaround time and has the performance and stability necessary
  1121. for large applications. It is also infinitely extensible, due to
  1122. its OOP architecture, comprehensive array of components and
  1123. full-featured programming language. 
  1124.  
  1125. Many applications are also being scaled up from PC databases
  1126. written in dBASE, Clipper, FoxPro and Paradox. As these
  1127. applications make the transition from PC environments into the
  1128. full client/server model, they must be able to address both PC
  1129. and server data. PowerBuilder has extremely poor performance when
  1130. accessing PC databases, and does not provide support for Paradox
  1131. tables beyond the Paradox 3.5 format, nor does it fully support
  1132. the Paradox file locking mechanism. 
  1133.  
  1134. Some organizations decide that a portion of their data should
  1135. reside on a server platform such as Oracle, while other portions
  1136. should remain in a PC format such as dBASE. Because of Delphi's
  1137. broad database support and extremely good performance against
  1138. both PC and server data, it is the ideal tool for when mixed data
  1139. access is required. Developers need only one development tool
  1140. regardless of whether the data source is PC-based, server-based
  1141. or both. Delphi is the only development tool that can adequately
  1142. address all of these models. On the other hand, PowerBuilder has
  1143. opted to largely ignore the PC database side. 
  1144.  
  1145. Borland Database Engine
  1146.  
  1147. Although not component-based itself, the component-like
  1148. architecture of the Borland Database Engine (BDE) fits neatly
  1149. into the architecture of Delphi. As the core technology for most
  1150. of Borland's database tools including dBASE and Paradox, and used
  1151. by millions of database users, the BDE has evolved into an
  1152. extremely stable, high-performance technology that can deal with
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  1167.   VERSION  :  All
  1168.        OS  :  Windows
  1169.      DATE  :  July 14, 1995                            PAGE  :  20/21
  1170.  
  1171.     TITLE  :  Delphi Client/Server and Power Builder Compared
  1172.  
  1173.  
  1174.  
  1175.  
  1176. almost any database format  It may be easily configured to access
  1177. popular server formats (including Oracle, Sybase, Informix and
  1178. InterBase) using high-performance SQL Links. PC database formats
  1179. such as dBASE and Paradox are accessed directly via drivers built
  1180. into BDE, which also includes support for the wealth of ODBC
  1181. drivers. 
  1182.  
  1183. The BDE is also sold as a separate product, as all of its
  1184. functionality is accessible to developers via an API. However,
  1185. Delphi developers are most likely to use the native data-aware
  1186. components to interact with the BDE, although it is possible to
  1187. write directly to the API or even bypass it altogether if
  1188. required. This open architecture provides a level of power and
  1189. flexibility not possible within PowerBuilder. 
  1190.  
  1191. Local InterBase Server
  1192.  
  1193. The Local InterBase Server is a locally-installed Windows version
  1194. of Borland's powerful InterBase workgroup server. Unlike the
  1195. Watcom SQL engine that ships with PowerBuilder, this product is a
  1196. full-featured SQL database, including:  
  1197.  
  1198. Stored Procedures and triggers
  1199. Automatic two-phase commit
  1200. Explicit transaction management
  1201. Declarative referential integrity
  1202. Event alerters
  1203. Simultaneous access to multiple databases and transactions
  1204. Multi-generational architecture
  1205. Updatable views
  1206. Outer joins
  1207. User defined functions (UDFs)
  1208.  
  1209. Because the Local InterBase Server supports most of the
  1210. functionality of the high-end InterBase server, developers can
  1211. create SQL-based applications using locally-stored data. Thorough
  1212. testing of these applications can be performed locally, without
  1213. concern for either the server load or the possibility of damaging
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.   PRODUCT  :  Delphi                                 NUMBER  :  2779
  1228.   VERSION  :  All
  1229.        OS  :  Windows
  1230.      DATE  :  July 14, 1995                            PAGE  :  21/21
  1231.  
  1232.     TITLE  :  Delphi Client/Server and Power Builder Compared
  1233.  
  1234.  
  1235.  
  1236.  
  1237. live data. Once an application has been tested and debugged
  1238. locally, it may then be scaled to work with an external database
  1239. server. If the developer has elected to use specific features of
  1240. InterBase, these will perform identically when the application is
  1241. deployed against an external InterBase server. 
  1242.  
  1243. With PowerBuilder, because the Windows version of WATCH SQL lacks
  1244. many of  the features on the server versions of Watcom SQL,
  1245. developers cannot experience the benefits of direct scaling that
  1246. Delphi provides. When PowerBuilder accesses the Windows version
  1247. of Watcom SQL, it must open a separate application window. Since
  1248. this is a standard window, users can task-switch to the window or
  1249. close it - either from the window itself or externally. This
  1250. makes the Windows version of Watcom SQL unsuitable in a
  1251. production environment. 
  1252.  
  1253. The Local InterBase Server, however, loads as a DLL in Delphi and
  1254. cannot be accessed by users. This, combined with its
  1255. comprehensive feature set, make the Local InterBase Server ideal
  1256. for applications running on notebook PCs. When a user returns to
  1257. the office, the application can be linked to the server version
  1258. of  the database. Applications may therefore scale from notebooks
  1259. up to Windows NT or Novell NetWare NLM servers, and all the way
  1260. up to the largest Unix-based systems, without developers needing
  1261. to change a single line of code. By offering this capability,
  1262. Delphi represents the ultimate in database scalability.  
  1263.  
  1264. Conclusion
  1265.  
  1266. This paper has examined just a few of the many differences
  1267. between Delphi and PowerBuilder. Both are clearly high end
  1268. client/server development tools with excellent features. When
  1269. examined from the perspectives of  performance, scalability,
  1270. reuse and RAD, Delphi clearly leads the way into the next
  1271. generation of client/server development. 
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277. DISCLAIMER: You have the right to use this technical information
  1278. subject to the terms of the No-Nonsense License Statement that
  1279. you received with the Borland product to which this information
  1280. pertains.
  1281.