Bill Champion is a Senior Professor at DeVry Institute of Technology in Irving. He teaches in Computer Information Systems day full-time. His Internet address is: chesslopez@aol.com
This seminar is the first week of Client/Server (CIS-460) which he teaches every semester to 30 - 50 9th semester CIS students. The first twelve weeks cover PowerBuilder, a Rapid Application Development (RAD) program. Other RAD programs are Visual Basic (Microsoft) and Delphi (Borland). The demonstration uses PowerBuilder Version 5 running under Windows 95.
You create windows and insert controls (objects) onto it. Sample controls are: static text, command, radio button, data control, pull-down list box, OLE-2, et cetera. Command and radio buttons can be activated by clicking them, whereupon a script is performed. Actual coding, including function calling, is in PowerSoft and is "hidden" from the operator's view. Powersoft is a regular programming language, similar to BASIC.
The course emphasis is visual. The philosophy is Murach's "Theory-Practice Sandwich". Teach the student enough to do a program and have him do a lab assignment. Then cover enough new material to justify another lab, and so on.
The textbook is Hatfield's "Developing PowerBuilder 5 Applications", SAMS, 1996. The book is not covered chapter-by-chapter. Parts of several chapters are covered to prepare the student to do his first lab. Then new material from several chapters are developed with the aim of doing a more complicated lab. If the student can not do a complete lab, then he hasn't effectively learned the material.
The demonstration is based on three labs:
PowerBuilder doesn't have a database in it. The desktop version (available to teachers and students for about $100) has an add-on database *Sybase Anywhere"). You can connect PB to other databases, although PowerBuilder Enterprise (about $3000) has more connections available.
He proposed a design method of drawing freehand what goes in a window, drawing lines outside the window to show the actual scripts for the buttons (controls). You do the same analysis for PowerBuilder that you do for other systems. When it is time to code PB often lets you selected items, expediting things, especially graphics. You could do the same thing in C++, but it would be more difficult and tedious coding, especially the graphics. PB is designed for applications at operator speed, and is interpreted not compiled. If high speed is required, use Borland's Delphi instead (which is compiled to machine language code) or use C or C++.
Handouts were given (also to my students). The students are given this material so they can be effective as quickly as possible. He tells them that they haven't really learned the material until they can do the labs without the step-by-step instructions.
Create a application and window with several controls (buttons) in it:
- Click on Applications icon - Click on File & New - Select a PowerBuilder library (*.pbl) & click ENTER key or type in a new library name - Type in application name & select OK - Let PB create an application template - Double-click on Window Painter & select New - Resize window - Select Controls & Static Text box (st_1) - Click in window & resize static text box - Click right-most mouse button & Properties - Choose border box & border color of blue & OK - Double-click on static text box - Change Text to: WATCH ME! & select OK - Click on Controls & radio button (rb_1) - Click in window & resize button - Click on rightmost mouse button - Select border box of 3D & OK - Double-click on radio button - Change Text to: TOUCH ME! & select OK - Click on Edit & Script & key in: st_1.text = "GO TO HADES!" - Close & save - Click on "empty area" of window - Select Edit & Script (of the empty area) & key in: connect ; - Close & save script - Close & save window as: w_sample & OK - Click on Entry & Script (of the application) - Scroll down to last line & change it to: open(w_sample) - Close & save - Run by clicking the "Running Man" icon at top of screen (& saving as prompted)
A database is created and loaded using database Sybase Anywhere (a SQL
database):
- Click on Database icon (two separated barrels)
- Select New
- Key in 1st field name & select data type, using TAB key to move to next
field and/or record: partno integer
- Continuing key in field attributes:
partname char 15 (width)
price numeric 9 (width) 2 (decimals):
- Close & save with table name of: champdb
- Select OK
- Click on key icon, key in index name of ichampdb, use defaults of unique & ascending
- Click on partno as key field
- Select OK
- To add data, click on Object, Edit data, Rows, Insert
- Key in data record-by-record, using TAB key to move to next field/record
- Select File & Save Changes to Database
- Click on close twice
Use the database to create a data window and a data control in the actual
window, that you are in application champ3 & the database is loaded with data
- Double-click on Data Window Painter
- Select New, Quick Select, Tabular & OK
- Click on your database table name (champdb)
- Either click on all fields or just on the wanted fields
- Select OK
- To check the data, select Design & Preview
- Close & save changes, naming the new data window d_champdb
- Double-click on Window Painter & New
- Resize the window
- Select Controls, Data Window, Browse, your data window name (d_champdb)
- Click on data window control (dw_1) & resize icon
- Select OK; if field headings appear it worked (data only shows during
execution)
- Click on "empty area" in window
- Select Edit & Script & Key in: connect ;
dw_1.SetTransObject(SQLCA)
dw_1.Retrieve()
- Close & save
- Close window & save as: w_champ1
- Select Entry & Script (in Applicatiions Painter), changing last line to:
open(w_champ1)
- Close & save
- Run by clicking on the "Running Man" icon (saving as prompted)'
- Type in name of window (w_champ1) when prompted
NOTES: You could add icons to window w_champ1 to:
- Move to previous record
- " " next "
- Insert a record
- Delete a record
- Commit (save changes to database)
- Close (command or radio-button to be clicked to run
script: close(parent)
Database data can only pass into PowerBuilder through PB's data window painter. You choose whether or not to allow in all the data fields. Than a data window control in a window can connect to the data window (that connects to the database). Don't break the chain!
One teacher asked what kind of tests I give:
- Generally lab tests
- Written tests (open book) on Powersoft coding