Download View/Open - ESIRC - Emporia State University
Transcript
THE ANALYSIS OT FOURTH AND DESIGN ~ GENERATION LANGUAGE A Thesis Presented to the Division of Mathematics and Physical Sciences EMPORIA STATE UNIVERSITY In Partial Fulfillment of the Requirements for the Degree Master of Science by Karen I. Craft May 1988 AN ABSTRACT OF THE THESIS OF Karen I. Craft for the Master of Science Degree in Mathematics presented on March 1988 The Analysis and Design of a Fourth Generation Language The enclosed thesis contains a study of the first three phases of the software engineering process as applied to the project (4GL). of Initially, creating a fourth the defined. 4GL users are also defined the 4GL, is generation Three language levels the software engineer who creates the application developer who uses the language to develop a specific application program, and the final end user who operates the application program created with 4GL. Incl uded flow of of are schematic the language. diagrams to show the the logic Sample screens are also included to show the results of using the language for an application. The fourth generation process wi th modul es screen handling, handling, printer data control, language automates to handl e menu the code writing systems, data entry, keyboard handling, validity testing, error access and fi le and searches, index report management, generation, and internal data management of buffers, pointers, and system functions. 463000 DP OCT 21 'e~ o.Jdd", --=== I - CONTENTS Introduction II - Analysis III - Design IV v ===- 1 18 18 Screen Design 29 Developer Interface 41 VI - Code Design 48 VII - The Library 57 VIII - Testing 66 IX - Summary 68 Bibliography 78 --=== TABLE OT FIGURE 1 - Main Menu Screen FIGURE 2 - FIGURES ===- • • . . • . • . . . . . • . 30 I/O Screen Format • . . • • • . . • • • • • • 32 FIGURE 3 - Sample Entry Screen • • • . • • • • . • • . • 33 FIGURE 4 - Sample Coding Menu Screen • • • . . . • • . . 34 FIGURE 5 - Sample Code Screen • • . • • . • • . . . . • 35 FIGURE 6 - Application Specific Help Screen • • • • • • 36 FIGURE 7 - 4GL General Use Help Screen • . . • . • • . . 36 FIGURE 8 - Data Search Menu Screen • . . • • . • . • • • 37 FIGURE 9 - Sample Data Search Screen • • . • • • . . . • 38 FIGURE 10- Sample Report Menu Screen • • • • • • • • • • 39 FIGURE 11- Sample Report Format • • • • . • • • • . • . 40 FIGURE 12- Sample Report Format • • • • • • • • • • . • 46 FIGURE 13- System Structure Diagram • • • • . . . • . . 51 FIGURE 14- System Structure Diagram (continued) • • • • 52 FIGURE 15- System Structure Diagram (continued) • • . . 53 I ---=== Overview first three process fourth as --- This critical it ===- INTRODUCTION is document phases app 1 i ed generation of to language. contains the the a study software proj ec t Ini tiall y, the engineering of it of crea t i ng a is necessary to provide some background information which defines the terms engineer i ng, so-f tl4lt3re Engineering), and Understanding these ( Comp u t er CASE 4~ (Fourth terms will Aided Generation Sof tware Language). aid in better understanding the goals of the project. Background the Information --- Within the past few years, ever-changi ng presen ted many value-added new mi cro-compu ter probl ems computer to retailers sof tware market sol ve. In the wor 1 d (VARS) , specific has of Rtarget markets R have become the emphasis, such as medical, dental, retai 1 er inventory, accounts receivabl e, applications, to name a few. general for sof tware these becomes market develop these more a needs, necessity. eff i c i en t 1 edger Off-the-shelf software is too spec ia 1 i zed the or general fields, Wi th software methods to the therefore recent custom flood of engineer is forced to produce the vol ume of I applications (Automated designer the Software competitive - We to writing to and appl ication Custom H their way keeps Inc.) ASCI I and the for had to in find a to do custom software. that and versatility. another ·We automated programmers applications retain to - at the changes required ASCII. package productivi ty increase st i l l 1 a 1eader International, at and affordable develop team describes approach process. standardize Adams, Concepts GhostWri ter, programming decided Tom needed. of 2 Q..9. Introduction coding find the code necessary it efficiency, to maintenance efficiency Continuity from the maintenance and one training effort to a minimum. Software Engineering -- Software engineering is not just a matter of wr i t i ng code! ••• The sof tware engi neer i ng li-Fe cycle involves a more or less standard sequence of phases. At the outset of a software project, a set of requirements are gathered, describing the objectives that the software must satisfy. Next is an analysis of the requirements, exposing important patterns and structures. These are called the design specifications. At th i s poi nt, sof tware desi gn begi ns. Usually a schematic design phase precedes detailed design. Upon completion of design, code is wri tten --- this is the implementation phase - - followed by testing and l11dintenance. I - I~duction 2.9 --- Sof tware engi neer i ng therefore i nvol ves 3 the foll owi ng phases in the life cycle -- 1 2 3 4 5 6 - Requirements Analysis Design ImplementationTesting Maintenance - gathering the objectives exposing patterns and structures schematic and then detailed design actual coding verifying correctness correcting, updating, revising Advances in technology and techniques to improve the process have not kept up wi th the demand for new software; or perhaps programmers have been too busy to 1earn them. Whatever the cause, many programmers have apparently decided to skip designing software in favor of just getting the job done. R I t can always be fixed later R seems to be the attitude of the day. Programming is costl y enough when it is done correctly. this haphazard rush to completion only adds to the costs, both in maintaining the software a~ in producing truly useful applications. In a software engineering project, the greatest effort is expended in the later phases of the life cycle. Coding, testing, and maintenance take far more time than analysis and schematic design. In contrast, decisions made early in the life cycle have the greatest impact on the quality and maintainability of the resulting software. Studies have shown, for example, that errors detected during [the] requirements [phase] are correc ted in far 1ess time than errors detec ted during implementation or maintenance. I n other words, the 1east effor t i s i nvesied in the most important phases of the life cycle! 2.9. I - Introduction --- CASE --- A CASE produc t i s any compu ter tool assists any phase of the software engineering process. defini tion is qui te 1 iberal due to the fact 4 that The that software -Any computer tool engineering itself is a broad activity. that assists in the process can legitimately claim the CASE label. ,,2 MCASE generation, tools can generation ization partially products. and documentation, cr it i ca 1 design. phases resulting of automate Few, design, if an y , do all the coding and testing will better in lower also and promote more maintenance standard accessible costs. In in principle, redirect resources to the requ i remen ts, anal ysi s, and schema tic 2 Through extensive user surveys (published in So-ftAlt3re Engineering: CAS£), BTR [Business Technology Research of Wellesley Hills, MAl determined that most users have been emp 1 oyi ng CASE tool s for on 1 y the past 18 to 24 months. [as of March 1988l CASE tools break down into two segments: design automation and programming. Programming tool s are primari 1 y avai labl e on IBM mainframes at prices in excess of $100,OOO, according to Bayer [David Bayer, an industry analyst with Montgomery Securities, San Francisco, CAl. The CanputerAided code of application builders and code CASE support this way CASE will, and 3 "This is the goal phases. analysis testing and maintenance. these things, however.CASE perform .e.g I - Introduction --- 5 trend, however, is to less expensive products that can run on micro and minicomputer workstation platforms. He expects more sophisticate2 programming tools to appear this year [1988]. The proj ec t inc 1uded herei n is fo11 owi ng the trend toward the micro market. The CASE technologies. ana 1ysi sand inc1 ude around Front-end desi gn ai ds. app1 ication the or upper-cd-se B.3ck-end or lower or case distinct include tools lower Cd-se p r oj ec t Th i s generators. back-end two includes definition tools which the tools centers are also labeled 4GLs or Fourth Generation Languages. 4GLs -These application generators assist the later phases of the [software engineering] life cycle, from detai 1ed They design focus through on coding, process, testing, format, and maintenance. and documen ta t i on disciplines, not information or project management. A 4GL is ac tua 11 y a thought of as a the paren t of type of CASE, 2 bu t i s more easi 1y subset of the CASE technology, and also as the CASE. In its broadest sense, it is the the back-end or lower CASE tool mentioned above. As a languages response (4GLs) to are many new becoming needs, more four th prevalent genera t i on and are quickly replacing third generation languages (3GLs) such as I Introduction --- - BASIC, PASCAL, application tel I the Using a what COBOL, 4GL, to This is collection abou t of 90% all applications. as management, record, standardized tasks are next. A that higher programs in handl ed 4GL the these does the the operating level. interface between the tell fact managemen t menial tasks "macros· and no longer the 4GL program and same from code needed operating is a all a is f or the users need, screen 1evel for programmer, The re-i nven t 4GL become or common application hardware, the then app 1 i ca t i on system fi Ie, tasks. standard one for II to the programs onl y at standardizes operator and operator and the appl ication. a the hardware devices, and the 4GL standardizes the interface between programmer, all collection higher to an contains manipulation, all thing does 4GL management wi th tasks same a which needs to task. that automate data, report developed each code contains the language of that that character 4GL system The the requ i res the operating system the programmer All 3GL detai 1 pre-written management, screen, every need only to s tan dar d of management fiel d, II of etc., app 1 i ca t i on wheel. due 1ow-I evel device collection do Just as an standard such to the programmer do. A etc. to specifically use how organized of FORTRAN, programmer compu ter 6 Q.9 A the truel y --- £9 I - Introduction --- efficient 4GL will automate possi bl e. tasks as programmer All as that many standard left for is or 7 normal the appl ication to do is to add the non-standard tasks specific to the application. 4GLs ev 0 1uti on been have of al so been languages H4 , designed to do a to do a descr ibed Ha as Ha con t i nued specialized language that has specific function H4 , as being Hable task with roughly one-tenth of the code needed in a 3GL. 4 • HWi th H automated. 4GLs, the prec i se ins truc t ions The language has been demystified. a dialogue between user and computer, the user's probl em. have been 4GLs employ interacting to solve The focus is on the task, not on the 5 computer. H Many allow an 1 evel s of end-user system-house 4GLS 4GLs ex i st, to create a by used from simp 1 er 4GLs wh i ch simpl e database to powerful software The engineers. difference between the two is the degree of flexibility and of the de ta i 1 allowed i nit s use. The simpl e 4GLs allow for only very basic, standard functions, while the powerful 4GLs allow nonstandard the versa ti 1 i ty func t ions when and the extended DmacroH of adding needed usi ng language of the the host unusua 1 , 1anguage the 4GL itself. This study considers the later, the powerful system-house 4GL. --- 2.9 I - Introduction --- ASCII, product the as system, 4 generator, and Engineering) (4) a GhostWriter, an program (2) Aided echoes the 4GL as an an Software development. herein their development ap p I i ca t i on (Computer contained consi ders define code writing process, CASE for approach def i nit ions and Pascal (3) product engineering of an automated (1) application producers 8 5 The these ex tensi on four of the language with the creation of 8macro 8 procedures and functions system-house for use create to rela ti onal database management applications. In Summary study of summary, the first this three cri tical document phases of engineering process (the requirements, phases) for involves a appl ication lower CASE). generator four th subset generat i on of generator the technology the software analysis and design language. CASE the Br i ef I y, technology (al so call ed called th i s the back-end or It can also be described as an automatic code wi th definitions, functional a contains screen/report creat i on, data base management, procedural integration as described in dictionary language, and 8The James Martin Productivity Series 82 The creation of a fourth generation language (4GL) I - ~ Introduction --- itself requires quite an involved programming project. ASCII 9 The programming team spent three-and-a-half years work on their GhostWriter written in Turbo Pascal. 1 This document analyzes the type of product produced by this company. --=== I A high-level d i r- ec t i on s • The ===- ANALYSIS I analysis at fir-st step this point is involves sever-al to define the user-s, and their- r-espective needs. The User- --- Defining the needs or- r-equir-ements of a softwar-e user-. pr-oject In or-der- also initially r-equir-es to avoi d any confusi on, defining thr-ee the ter-ms ar-e used consistently within this document -- (1) The softwar-e enQineer- who cr-eates the 4GL. (2) The application developer- who uses the 4GL. (3) The client/end-user- or- oper-ator- who uses the application cr-eated with the 4GL. In this situation, the application developer- (also known as a system developer-) using the 4GL, var-iety of 4GL be is the user- of the 4GL, however-, while this developer- pr-oduces appl ications for- a clients or- wr- it ten in end-user-s. such di ffer-en t var- ia t ions in analyzing the of needs a manner- This as r-equir-es to a 11 ow database app 1 i ca t ions. the application that for- the many Ther-efor-e developer-, also involves analyzing the needs of as many client applications as possible. The application developer- becomes the Dmiddle manU for- the client, the final application end-user-. two 1 evel s of ana 1 ysi s ar-e consi der-ed, Thus, the needs of the II - Anal.l.sis application 2.9 and develope~ the needs of the 11 develope~~s clients. James analysis - Hughes p~ocess consisting of explains --- "At a standa~d p~oject app~oach initiation, a systems analysts and time to the team - must define the use~s to p~oject the team assigned full p~elimina~y requirements of the system." "Traditionally, at dozens of users produces a to this point analysts would interview determine requirements. This often long list of wants and needs that are difficult to analyze and use for system development." "A users better approach the definition in is of to involve a preliminary few experienced requirements and major system externals - such as menus, data-entry on-line query displays and reports. sc~eens, These system externals should then be incorporated into a horizontal prototype." ·Users horizontal can rank the functions in the 8 Software En9inee~ software engineer developer and prototype to determine which functions should be au tomated." The review (use~ of and Application Developer Needs -- (the 4GL developer) the 4GL) and appl ication have much in common. They are II .e.g Anal l::,si s both developers creates general for a cl ient. applications for The software 12 engineer the application developer, and the application developer creates specific applications for the client/end-user. several quality ivi ty, code As mentioned in the introduction, requirements efficiency, ized appl ications, include maintenance increased product efficiency, and versati 1 i ty. Further standard clarification is now needed. Increased application in productivity involves the production of an less time than with previous methods. This is easily measureable by keeping time logs on all projects, however, one must remember that not all projects are created equal. Maintenance needs, most correcting errors, organizations, programming Wi th 38% includes updating is it 4GLs 78% of and adding new capabi 1 i ties. is dedicated the system for changing estimated to maintaining the time is spen t on mai n tenance. 4 A rat i 0 that 78% existing of In the systems. on or i gi na 1 codi ng and of 88% - 28% is the mi n imum acceptable goal of this project with the ultimate goal of a 95% - 5% provide ra t i o. The appl ication parameters to the 4GL developer to define is required to the data file II - Anal~sis --- structure, words, 2.9 entry screens, the majority of and report formats. other the time for using the 4GL is spent in designing the appl ication database, any application, In 13 however, as is necessary little additional in time is needed beyond that stage. Efficiency speed, memory, eFficiency can developer overlays and major measured consider data of efficient wi th disk areas timing access files. ex terna 1 code to Speed code. tests. time The when Both the app 1 i ca t i on developer concern the up using software have access speed 4GL to the processi ng. efFiciency can also be implemented using inline and proj ec t can three maintenance managing external code. keep be in 1 i ne and of H~ory and must engi neer and use involves inc 1ude use of PC/XT equ i pmen t, the code as compare another the in ~intenance order It all application compact memory to as possible. required determine by the it is necessary to The 4GL developer one algorithm memory over efficiency. eFFiciency is included here as the top priority requirement. However , Due to the fact that the constraints of the is desi gn developer not for must a truely the have measurable software an feature. engineer under 1yi ng purpose and of II - being easily updateable as new needs surface. a Y gray area-. An time- and efficient elaborate upon upon the algorithm memory-wise, maintain because of a based 14 2..9. Anal~sis but may too lack of readability. opinion their expertise. of the This becomes be quite difficult to Readability is programmers and dependant Readability and maintenance have top priority over speed and memory. Standardi zing ways. app 1 i ca t ions much to point the 4GL. be concerned input, keyboard handling; color prevent development developer's usi ng two maj or From the programming and maintenance point of view, standardized al gori thms save is impor tan t i n time. view, From this is wi th how handling, and and the app 1 i ca t i on appl ication no longer handl es testing, needs menus; and control; screen search routines; windowing; and the major purpose fo .... validity printer the wheel the The app 1 i ca t i on developer output coding, of reinventing error functions, buffers; pointers; system functions; or even the processing of data, i ndi ces and control of concerned f i 1e the wi th managemen t • 4GL. whtilt The the These application system must application and not how it does it. are tota 11 y i n developer do for the then the is special II - Ana 1~s i s .2.9. 15 Versatility measured wi th application is a time. quality to Due requirements that the of can vast really range of only specific client/end-users, it impossible to foresee and allow for all that might be needed by the appl ication developer. the major design requirements to allow for are be is possible features defined, a further requirement is code wi thin the program to add the non-standard features. Standard code is code that direct appl ication After is protected and not allowed to be changed by the application programmer. of versatility is provided for with to the application procedures in requirements are Standard Pascal 4GL macros to the developer any coded <described The that the programmer designed code to contain stubbed specific application application programmer. extended in more detai 1 standard are by The requirement code files accessible unforeseen commands and an application added. developer which programmer as files handl e language set later) the 89 are avai lable specific created - of code is by the 4GL 99"/. of all application needs. These include automatic handling of the functions in listed paragraph above. the Additional ·Standardizing Appl ications· code added by the application developer is typically 1-5% of the total. II - Analysis --- Client/End-User user is a design is directed entire Needs --- Quite often novice wi th As mentioned to to computer the needs of earlier, the client/end operation. the new computer requires the operator same a required from In more specific stdnddrd screen that all format the throughou t terms, Id)'oUt prompts will the operator are avai lable at all level with descriptions. required record or data All in en tire for second searches. numbering, attributes, in the phase Report checked are order program file. of first concurren t for OR, for and totals, the saving any the the database allow for phase NOT, and in field f.I<3lidit.v and before search Forl11dts allow for column assure opera t i on. limitations on any or all The allows to Help screens limitations, tested S~rches to be input is prompted at is for any searches of Ddtd data fields is be consistently seen type, data coded searches available the times. to the database. mul tiple allows user. this first of Color coding aids in prompting the user also. field All maintenance is the top priorty of the Every move thoroughly prompted. the respect 16 project, but consistent user-interface is the second priority. all Po --- of col umnar and can however wi 1d card formats, page counters. such as bold and underline, development cr iter ia, XOR, fields Printer be embedded in II - Analysis --- report formats. Summary --- P9 17 User-entered subtitles are also allowed. In summar y , the fun c t i on s t ha t automated include 1 - a menu system, 2 - data-entry/display screen functions (I/O screens), color coding windowing 3 - data entry, keyboard handling validity testing error handl i ng 4 - data access (searches), 5 - report generation (output) printer control 6 - file management indices saving, deleting, reading data file 7 - internal data management buffers pointers system functions processing of data wi 1 1 be I I I --=== The top interface. 1evel The design lower 1evel DESIGN ===- concen tra tes upon of design the mechanics and maintenance aspects. discuss the top level the user concentrates upon This chapter will designing phase in terms of general requirements and of the functions to be automated. Phased Development is designed for Turbo Pascal second --- Development of two major phases. this project The first phase uses 3.x BCD with the top priority features. phase uses Turbo Pascal 4 and adds The the more detailed features described in the following. System Requirements --- Design begins project declaration of the constraints. This impl emented on IBM PC/XT/ATs compatibl es preferrable) hard drive with DOS 3.1 or is to the be (XT/ATs are or higher and 328K of RAM. is recommended and mono, are supported. with A CGA, or EGA monitors The application developer is required to use Turbo Pascal 3.x in the first phase of development and as soon as version 4 is shipped, the second phase will use it as its base. III - Design IUl 19 Initialization call to execute --- A specifications. within separate of includes an the ini tial ization even screen, from desi gned for by to keep Once program immediate the created from A sets of loaded, update of Exit point. the with the program where the operator the date. this in the drive and subdirectory appl ication option of to subdirectories. the 4GL possible ie. This allows ini tial ization passed the program declares the data files are located, files parameter by the the f i les and the program is personalized logo developer, then appl ication appears to declare the program name and any copyrights and dates needed. Pressing a key continues into the main menu screen. Menus created by The main the applications. 4GL menu includes a for 1 ist the entire appl ication of installed database For example, a simple menu may include -- e = Codes 1 Chart of Accounts 2 T~ansactions 3 = Audi t Trai 1 Each menu 1ayou t is sel ected descr i bed sel ec ted, the = = resul ts in more in the use of detai 1 appropr ia te 1a ter. f i 1es are the same screen When a menu opened, the i tern I/O 2.9. 20 III - Design screen is created, and the file and field definitions are initialized. Command commandline Line appears forms are used. Once at the within bottom a menu of the selection, screen. a Two The first allows adding and updating of records and the second allows only reading of data --MenUj Add/Updatej Find/Data/CINtj RtpOl'tj PgUpj PgOn ---) "enuj Find/Data/CINtj Reportj PgUpj PgDn ---) Phase 2 includes security password options which allow for read/wri te access or read only access, therefore determining which commandline the end-user will see. I/O through a Screens --- Data entry and display (for browsing search buffer) screens are the same. Standard I/O screens contain the following: 1 - the menu title 2 - the current mode of operation 3 - a message area for errors and how to exit 4 - a data entry area 5 - a comrnandline area 6 - a field-level prompt area 7 - an input prompt for data entry limitations 8 - a status line including --- the number records in the curren t f i 1 es, the number of records in the search buffer, the record number of the record curren t 1 y bei ng en tered or viewed. 2.9 21 II I - Desi 9n --- Help available inc 1ude aids, Screens by --- pressing the user-spec i f i c and circular a user list as Help F1 screens key. the such displayed space bar constantly Phase 1 help i nforma t i on, manual are as screens accoun t i ng sequentially is pressed. in a Phase 2 screens allow for going to specific pages in the on-screen manual, for scrolling forward and backward sequentially as desired, and allows standard user manual for context-sensitive help. The is pre-installed, however this manual is accessible to the application developer for editing. Data Entry is standardized with by the application developer. these screens and also All I/O screens defined data is entered within displayed within them when in browse mode to page through a set of records in a search. Data entry is also dependant upon file definitions defined by the application developer using parameter tables. sizes, access codes, indexing, and field definitions are contained in these tables. field definition to Data entry in a field uses the determine data type, validity tests, and its location within field has field-level File length, the record. prompts displayed as entered by the operator. field the Each field is II I - Desi gn --- --- e.g 22 Phase 1 includes data types of string, real, byte, f i el ds date, and Automatic keys pressed. data fields ·Coding A as only minimum A key click option is available for lookup fac i 1 i ty explained System·. field level. in Validity is the tests bu i 1 t-i n next are preinstalled codes. and tested maximum for limits. val id usi ng the FlO key, of required for coded section on the performed at the Coded fields are allowed which require entry Numeric data is String data entry allowed beyond its maximum length limit. also sequential (such as sequen t ia 1 i nvoi ce number i ng) and defau 1 t fields are supported. of character. integer, BCD fields. dates. When an the record is for not Date entries are entry the record is tested for If tested is executed the ex i stence is acceptible it is recorded and any updates to related files are also updated at that time, such as updates to chart of account totals when a transaction is entered. Phase 2 adds data codes, (mm/dd). social security types for numbers, telephone numbers, time, and short zip dates II I - Design 2.9 23 Coding efficient for all is System -- Due to the fact to use codes applications reserved for t ~ \" available codes program. All reference data ~ i ,'" !, library for that field. time a ;. ; code saved such codes during their circular returns to allowed used to entry of throughout test the I ist the a to be as are all standard Menu 8 allows the A codes for ·CK' for check entry the data paging entry code deleted to whence flagged guarantee referenced by the coded field later. the be source or documents 'IN' for an or updating) by lists the installed through. is of be accepted order and The he operator came. reference in a coded data field the program codes must in alphabetical from entire quickly accessible <adding pop-on window the No duplicates are indexed and data for file, a va I i di ty be descriptions is used as a to data the coded data fields. the F2 key. codes and I'"~ selection Therefore, example would These pressing menu the code transaction, any in th i s An invoice. at fiel ds, the coding library before they will allowed. a This fiel ds entry data built-in coding system. coded entered in in some coding library which contains lists of used as valid data in (". is a Codes. initialization of a )i; for that i t is storage in then Once a that is and will not be that it can be Design --- Data numbered wi th op t ion Searches 1 ist the of logical AND searches search type data fields them. a ~a ~ Numer i c Searches imp 1 emen ted involving usi ng an for such cri teria. for locate string as two data to an all searches the (a fields, the beginning of allow minimum and maximum limits on the fiel ds allow user-input fields the proper beginning search the involved criteria searches a has search and -Within- 'm'. date the the special a the special i ndependen t for includes end-user of selecting contain and The is matched from to which records the numbers user-input I tallows wit h in -Begin-End B between fiel d. beg inn i n g case Data menu concurrent After options. ending string. data all to request are search selection. is prompted for Str i ng matching and data fields or an~ search). the end-user A the menu se 1 ec t he wishes --- all curren t to which --- pg 24 the names locate all string user wi thin to input search. indexed field B-tree index i ng and other will be searches wi 11 be sequentially implemented. Data search records are saved in called a circular linked list a search buffer. search buffer can be used for browsing through the screen print out (pagi ng numerous to the prev i ous or reports. Once nex t the The the data on record) search has or to been II I - Desi gn used, 2.9. 25 the search buffer can be cleared. To current see what search search buffer, at the commandline. of cr iter ia con tai ned used in have been used for the operator can enter A pop-on window will for the cri teria the curren t search. search The 'D' for data display the list coun t wi 11 buffer the of records di sp 1ayed be at the bottom of the screen. Phase wi 1 dcard 2 will add the OR, searches, and al so descending fields. sorts according XOR, wi 11 to NOT, allow any IF-THEN-ELSE and for chosen Search and replace features will phase. ascending or combination of be added in this An operator option is available to search for case sensitive data. Ad hoc searches are allowed in this phase and commonly used searches are saved as standard -macros·. Data the Reports application imp 1 emen ted field usi ng locations options, such wi 11 imbedded be Report developer. tex t f i 1 es. and field as bold, repor t, the if exists. none --- A is In phase the numbers. 1, initialized by these will list Special be inc 1 ude printer and compressed print, formats. requested numbered are These forma ts wi 11 underlining, wi th i n end-user formats to of When request i ng in i t ia 1 i ze a a search installed reports is III - Design 29 26 displayed in menu fashion. desired report, he may When opt the operator selects the to have the report format displayed before continuing. This allows the operator be report. sure col umn he has total s example) created and are by control the proper numeric available the grouping directly application breaks, other Counters, developer. than set in the au toma. t i ca 11 y repor t manages title block at the top numeric is pagi na t i on and the report. formats implement the The page length and each for grouping, format of the To application developer adds specific code. is paging, (by groups of 5, through to the key crea t i on One line that of in a the report is required to contain fields from one common file. Phase 2 allows for a more which fields different data on the same fi 1es. Phase H free form" line 2 can uses be the type repor tin contained 4GL i tsel f in to create the report formats and parameters and also allows a max imum wi dth repor t formula or a special of 132 charac ters. A mat hema. t i ca 1 logic procedure can be manually coded by the application developer. Design 2.9 27 Pr inter Suppor t --- Due the fac t market, each printer requires its own set of driver codes compressed, wide. attributes, 6 or Printers 8 such 1 ines are many there is standardization special the that little for for to per as inch, supported containing these code numbers. printers bold, a the underline, ital ics, by on and double parameter file The file is created by the application developer and allows him to install codes for for any or all printer interfaces for which he has codes. F i 1e Managemen t --- F i 1e managemen t implemented with a B-tree and indexing system. wi 11 be suppl ied by the appl ication files and their respective fields. is not another files and allowed, can be however, made. A a index renaming process defini tions the has 01 d been indices to verified. from one uti 1 i ty define file to re-indexes It uses the file, field, restructure have as a The to Restructuring of files re-indexing to be Parameters developer transfer that have been corrupted. loll ill indices backup operator then after unti 1 the has the option to delete the old indices. User Interface --- User interface is well-served by II I - Design the 2.9. 28 several standardized manual requirements screens, a previousl y pop-on code mentioned window, a pop-on or help window, and constant prompting at the field 1evel • The user wi 11 know that he is expec ted to en ter data when the color yellow (or reverse video on monochrome monitors) appears will prompted be on the by screen. listing Even all character possible input characters allowed in the input. Error messages must be preceded by a user beep to si gna 1 message area. the At all times, explaining how to exit keys will Standard these application constants. look ina pre-determi ned the user will have a message the current situation. The use of be consistent throughout the application for the operator. however, to can key combinations easi 1y developer with be are pre-installed, re-conf i gured by the the simple reassignment of key IV-SCREEN --=== Within aspects of DESIGN ===- the next four chapters are the more detailed the project. This chapter concentrates upon the I/O screen designs used by the data entry routines and report browsing routines. Standardized not only a screens --- Standardized screens are benefit to the end-user, but also to both the software engineer and the application developer. interface the is of majori ty utmost of users importance, are due novices. to End-user the fact Bei ng that abl e to consistently find error and status messages and prompts in pre-set 1oca t ions ai ds application program. is the fac t channeled through one module. the opera t i on of the However, the major advantage for the developers desired changes in great 1yin that all screen screen handl i ng formatting module. can be Any the screen layout are made in that one Figure 1 is an example of a main menu screen from an application using the 4GL. 2.9. 38 IV - Screen Design --- FIGURE 1 - Main Menu Screen: HODE = Cllllland -( HAIN HENU 1EXIT Pr• • = Esc Fl =Hanual 8 = CODES 1 = CHART OF ACCTS 2 = ACCOtMING 3 =AUDIT TRAIL 4 = SUPPUERS 5 = CUSTIltERS 6 = ItfJENTORY 7 =SALES Stl.ct I from about ---) FILES: I/O the S.cFILE= Screen program then Curllt= FO~D= --- When a uses the • INPUT Int= mai n menu standard Figure 2 and described below. .- 7 item is sel ec ted, I/O screen shown in The following list contains the description and location of the standard items in the screen layout and their reserved areas. Name Line Description of use Mode 1 Di sp 1ays curren t mode chosen from the commandline menu. Command means it is wai t i ng for a command. Add or Update are data entry modes Title 1 displays the title of the selected from the main menu. item .e.g 31 IV - Screen Design Name Line Description of use Manual 1 always shows how to get the pop-on manual or help screen Message 2 displays messages such as error messages that tell what is wrong and what to do about it, how to exit, special instructions for the current situtation Work area 4-22 area for entry and data display Commandline 24 commandline menu field level prompts Files 25 number file SecFile 25 number of records used in curren t secondary or re 1at i ona 1 f i 1 e such as a file containing sold items related to a primary fi 1 e of invoice data Found 25 number of records found in a search and contained in the current search buffer CurRN 25 record number of record curren t 1 y displayed on screen (the actual physical location within the file) Input 25 prompt area for absolutely every operator input in these formats: Byte= .. Int= .. Real= .. Max Length= (used for strings) A, C , D, F ,M , R , U, ( examp 1e of c harac t er input for commandlines) of records used in current .e.g 32 IV - Screen Design -- Figure 2 - HODE I/O Screen Format: =1111111111 ---{ title area l--message line for errors and exits Fl =Hanual This is the working area used for data display and entry Line for commandline and field-level praapts FILES=IIIII SecFILE=11111 FOUND=IIIII CurRN=11I11 IIINPUT 111111111111111111 Figure 3 application entries. def i ned developer by an may app I i ca t i on transaction. three use all for feature for data the en try of an been entered. When an entry screen as may be shows made that columnar-type example have entries are the column headings. a developer The transactions application, under demonstrates It exemplifies an actual accounting after below on the the screen In this line directly the transaction is saved by pressing the Fie key, a prompt line is inserted at this location, keeping pushing them entries. 1 i nes 4 developer. on the the previous screen as transactions templates The design of the screen within 22, is under On line 24, the control of is a field-level down, for thus further the entry area, the appl ication prompt describing the current field at which the cursor is located. IV - Screen Design - - - .Q9 33 Figure 3 - Sample Entry Screen: HODE = Add - { ACClHNTIN6 1Fl = Manual Esc = Canand Line. ENTIN F7 = Del i Fl1 = Save • F2 = CODES BIT •••••••••••••• I ••• I ••••• CREDIT ••••••••••••••••••••••••• Transact r-:- Debit ---, r-- Credit --, r Sourc," Date Acct. Mount Acct. Mount Doc Nulbtr 'l'1l'i"7--.-- - - - - ' - - - - - - ' - - - -__ - 88/'·,7,· II 88/11/11 1111 88111/12 6121 334.52 3121 23.67 un CGRfnts ___ •••••••••••••••••••••••••••••••• 334.52 B6 23.67 CJ( 3241 Beginning Bank Balance Insurance Pa~t Enter YearA10nthlDay as 87/ 31 5 --- zeros not n,ussary 2 SecFILE= Foa.D= Curllf= 3 .INPUT Byte= 1- 12 FILES:: On the fourth is printed numbers are result of app 1 i ca t ion line above, in the spaces entered two the name of the debit or credit and lines developer. when found of the to be specific Th i s respective val id. code presen ts an account Thi s i s a added examp 1 e by the of wha t special features can be accomplished with the 4GL. Color on a Coding --- When the operator sees this screen color mon i tor, the data en try area for the mon th is highlighted in yellow to indicate that this information is what is to be entered. Yellow sayS Hdo something!H. two bottom verifiy lines also what is to be The entered. IV - Col umn headi ngs status data are 2.9. 34 Screen Design on are The bottom the Entry brown. red. data mode, = "Ft line are coded that Manual", green. has already been and Titles is entered light cyan while the current data entry field is yellow. Pop-on a coding menu screen after screen is Screen -- Figure 4 shows an example of Code screen and Figure S shows an example of selecting avai lable by a particular pressing the code F2 to key 1 ist. whi le Figure 4 - MODE • Sample Coding Menu Screen: =Add CODES ) Esc =exi t Code Win-ire, bIr =11' for !lOre t = SOURCE DOCIKNTS 3 =CUTOHER CREDIT TEAMS 5 = SAlE CODES 7 = INSTALLERS Ft =Manual I 2 = stfPllER CREDIT CODES 4 =ItfJlMORY r.ATE60RY CODES 6 = SAlEIIN Enter Code number desired ---) ••• I I I FllES= Secfile= FOlND= CurRN= 3• INPUT Jot= 8 255 This in Add or Update mode. the the IV - Screen Design --- 2.9 35 After selecting the code listing desired (1 for example), a screen similar to Figure 5 is seen. Figure 5: .r Sample Code Screen MODE = Add CODES] -- CODE - l ACCOlNTIN6 1Esc = ,xi t Code WindcMi.j'C' blr = ; ; for _or, DESCRIPTl~ ------ ------------------------------- 1 1 CH 1 CK I IN 1 IT SOURCE DOCIl1ENTS Cash Transaction Ch,ck Transaction Invoic' Int'l'fst Fl = Hanual _ DElETE - N N N Y N • FILES= S,cfi IF Manual/He1 2 F~D= Screens Cur~ 3 • IIftT Int= The 1- 255 on-line available at any time by pressing the F1 key. exampl e of an appl ication 4GL general help screen. specific manual is Below is an hel p screen and of a --- 2.9 36 IV - Screen Design Figure 6: Application Specific Help Screen HODE = F[ II tWIW. I - [ ACCOtHTING 1FI = Hanual Esc = exit Hanual Windlllj space bar = page for .ore : • ACCOIlflING .' _ EQQ:\TI~ - - - - ASSETS = r LIABILITIES --, r-- EQUITY -----, i ncrease Assets: Otcreast Assets UtCrNst I IncrNse DtCrease I Increase I NIM Assets I AcclII Deprec Paid Unexpired Insur I Unearneo FItS PrePaid Expense: (Advanced Rev) Received : Paid I Payable Oraliting : Capi tal ItmtE stJttARY (tllporary proprietorship) btcrease Equity I Expenses : Inventory (Btgin)l Purchasts : ContraRlVenue : (SalK RetaAl) I (SalK Discts): Tran~ort-iR I Increase Equit; Revenues Inventory (End) Sales ContraPurchasts (Pur RaA) (Pur Disc) Uncolltct. Accts : Henui Add/Update! Find/Data/Clearj FILE~ 67 StctILE= FOtH)i: Figure 7: HOOE= PaUDj PaOn ---) • i8 • INPUT A,C,D,F,H,R,U, 23 \;urlN: 4GL General Use Help Screen lin HINW. I - [ ACCOtHTING 1FI = Hanual Esc = exi t Hanual Windlllj space bar = page for .ore F[ I Re~orti ,.---, Hoves cursor to I Tab I NEXT input field L=.J • SPECIAL INPUT KEYS ... .' fIiil ... I..-..-J _ IBlcSpc! ~ Nlllber Keys at Top of Keyboard Otletes character btfore cursorl ~LY key used to eait NlttERIC fields Ctrl a scrolling scrttn ~ Press Space Bar to continue WITH S or NIIILock ~uses ,.---, WITH TAB moves cursor I IShiftl to PREVIOUS input field I L.-..J I I ,.---, I Alt I II Deletes character above cursor in text input field I..-..-J (D;ll I..-..-J I Menu' AddI!!pdate' Find/Data/Clearj FILE~ 67 Stc~ILE= FOUND= Re~ort· PaUDj PQOn --) • INPUT A,C,D,F,",R,U, 23 turAN= as • • IV 2.9. 37 Screen Design Data Searches --- From the commandline, the operator may select RF R for Find to initiate a data search. 8 shows an examp 1 e of a Accounts application. data search menu for a If a option to of the fields to search string field is selected, select a Char t of Every possible field is listed and the operator may select one or all by. Figure UBegin-End" or I f a n umer i c described earlier. selected, the operator is prompted the operator has the RWithin U search or to da t e enter fie 1d i s the minimum and maximum desired in the search. Figure 8: Data Search Menu Screen "ODE = Search --I:~RT II' 1= 6= 11= 16= 21= OF ACCOINTS] EXIT Search l1tnu Fl =Esc SEARCH tINU ClII@l!t, 2= NoD!l!t! 3= Acc. 7= Jan Total 8= Fib Total ~ln Sal Hay Total 12= Jun Total 13= Jan Total Oct Total 17= NOli Total 18= Otc lotal 3rdOtTotal 22= 4thQtTotal =Hanual II' 4= 9& 14= 19= Acct D!script lolal Aug Total 1~ S,p Total IstQtTotal 21= 2nijOtlotal ~ ~ Har Total 11= 42 .INPUT 1- ~r Ent!r I of ittms to b! search'd ---} •• FILES: 48 S,cFILE= FOlND= Curlt+= as 22 IV - Screen Design Search E.,g 38 Da ta Wi ndow --- The opera tor may request a listing of the search criteria used to collect the current search buffer (just in case one forgot) by pressing 8D 8 in the commandl i ne. listing all Figure 9: A pop-on search cr iter ia screen appears limits of the search as in Figure 9 below. Sample Data Search Screen -[CIMT OF ACCOOOS)- MODE = ClINnd • Search Data II - Fl = Hanual •••••••••• 1• • • • •E.sc.=.l!X.iiltiifrIliCII.wiii.dcM SEARCH JTB1 FRIJt (: =begin srch) - TO ------------------ -------------------- -------------------- 3 =Acct NwI 4 =Acct tell! 2... - 4999 - F A II~------------.... I FILES: Sl!cfile= FOlJiD= CurRN= 3.. INPUT A,C,D,F,",R,U, IV - Screen Design Data search. been the 19 be Reports --- A report may be initiated after a If a repor t i s requested and a then executed, below. one is autornaticall y A search menu opera tor. format 2.9 39 The operator search has not requested from is then 1 isted as in Figure has the option to see the report (Figure 11) before executing the report in order to sure it is the correct Following one. that, the operator may opt to have the search criteria listed in the headi ng of the report Figure 19: HODE the repor t , to have page numbers, and to send to the screen, printer, or both. Sample Report Menu Screen =Rtpor t - [ CWIRl OF ACCOOOS) EXIT Search Menu = Esc I I I REPORT ~ I I I I = Chart of Accounts 3 = Account Balances - 1st Quarter 5 =Account Balances - 3rd Quarter 7 =Account Balances - Beginning Enter report number ---} •• FILES: 48 SecFILE= FOUND= FI = Hanual 2 = Account BalanctS - Yearly 4 =Account Balances - 2nd Quarter 6 =Account BalanctS - 4th Quarter 8 = Financial Report 28 CurAN= .INPUT lnt= 1 8 IV - Screen Design Figure 11: Sample Report Format MODE = Report I 11111111 Acctl 2.9 40 -(CIMT OF ACCOlNTS)- KEY to CINTINUE ]= Account HInt ACCOIHT IIAl.fW:ES - 1st lINTER F1 =Hanual =[ 11111111 Balances 1-----------Totals ------------1 January 1st Quarter Flbruary Harch iiiii iiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiii Iitlilliii iiialiiiii iilliiiiii 11111 111111111111111111111111 1111111111 1111II1II1 1111111111 1111111111 11111 111111111111111111111111 1111111111 1111111111 1111111111 1111111111 ----- ----------------------- --------- --------- --------- --------- 11111 listed 1111111111 1111111111 1111111111 1111111111 =I Page 11111 ] = FILES= 48 SecFILE= FOUND= 21 CurAN= • INPUT 1 -== V-DEVELOPER The between third priority the application discussion between this in the 4GL of a 4GL must developer and chapter and the appl ication the time the database spent area design by of is itself the the <records appl ication database establ ished, the the interface itself. The communication developer in terms of output report formats, and fields>. developer anal ysi sand the be the 4GL involves parameters which define I/O screens, and == INTERFACE installation shoul d The major now be desi gn. of Once the in the parameters involves the following steps: 1 - Parameter tables define the base appl ication for A - the file data structure B - the entry screens C - the output or report formats Specific, non-standard code is added using A - the 4GL RmacroR language described later B - the Turbo Pascal language C - in 1 i ne and ex terna 1 code allowed through Turbo Pasca 1 • 2 - In phase 1, the implementation through tables set up the 4GL itself The structure these content is The phase 2 method allows for reading the files the parameter in standard text to create and of and the same wi th is Phase 2 uses interface definition each files. method. greater security and speed in initializing internally within the program. files. tables the file definitions v .1!9 42 Develoger Interface --- The I n i ti ali za t i on provide parameters for application developer initialization of the system. must These include 1 - the location of the data files 2 - The computer type (PC/XT/AT) 3 - video mode 4 - the filler character for entry areas 5 - the client/end-user name 6 - the program name 7 - the logo screen with copyright and date 8 - the option to have the click sound for keys 9 - a table of the main menu selections and their related files The menu title selection is en try screen. is made, used it is in the used main in the menu, and when title area of a the The related files are automatically opened, managed and closed during the use of that menu item. I/O wi th Screen the Defini tions definition of --- the Screen window includes 1 2 3 4 5 6 7 - The related file number The upper left corner location The lower right corner location Background color Foreground color The window frame type number The title color defini tions environment. start This v - Deyeloper Interface --- Screen definitions 2.9 43 include a table of the following data per source field -- 1 - The source file number 2 - The en try order number (3 for 3rd f i el d entered in the input sequence) 3 - Field location on the global screen 4 - Field number within the data file 5 - Location of the lower right corner for a windowed field (as for a multiple line c ommen t fie 1 d) The final of step in defining a the work i ng or the entry screen screen is the actual data en try area of in Figure 3. the screen, contents such as The column headings and the data entry area (line 8 in the example) must be created. File the and database output/report c r ea t ed Def.PAS. is f i 1e routines, ar e Field The Definitions --- The file structure of the and routines. in tab 1 e file basis of record The form contains all specific management data routines, file and record ina t ex t f i 1e - and definitions ca 1 1 ed F i 1 e the following data pertaining to a specific file -- 1 2 3 4 5 input File security code (read/write; read only) Record size Number of fields per record Set of indices indexing the defined file The major index for the file v- --- pg 44 DeveloQer Interface --- It must be remembered that the 4GL does reserve menu 8 and file 8 for the code library described earlier. File-Def.PAS also contains a table of the following data pertaining to specific fields within a file -- 1 2 3 4 5 6 7 8 - Field data type Field name (used in the search menu) Field-level input prompt An upper case flag for string data (yes/no) Field length internally within the record Field offset internally within the record Field minimum and maximum acceptable values Character set possible for character data The final table included in File-Def.PAS is another table containing the definition of the indexing system -- 1 2 3 4 5 - The source file for the index data The total number of fields used in the key The set of ordered fields to create the key The key size in bytes A duplicate key flag (yes/no) Output/Report reports use the file, as parameters pr oper data by Output Def i n i ti ons field, to pass for and index definitions entered the appl ication forma t formats to report formats are contained in a developer the repor t to create rou tine. the The file called Rep-Def.PAS. It is initialized with a table of -- 1 - Report name 2 - Related menu selection number 3 - Report number v- The Develo2er Interface --- table initialization formats. 2.9. 45 is f 0 1 lowed by the report A format is initialized with -- 1 - The report menu number 2 3 4 5 6 - The report number Page length of the report/document Body length of the report/document The number of records per group The line spacing between groups Items 5 and 6 allow, for example, for the grouping of data in sets of 5 lines and then double spacing between them for readability. The actual following manner body by of the report is created the appl ication developer. in the Figure 12 gives an example of an accounting report format. The first charac ter the per format 1 i ne descr i bes the use of 1 i ne. The codes are T D C 1 F P - Title line (No data input into this line) Divider line (No data input) Column heading (No data input) Primary file data line Footer line (fields are totals or counters) Page number line The # symbol report line. represents the location of a field within the v- e..2 46 DeveloQer Interface --- Figure 12: Sample Report Format: = [ , ......1 ACCOIHT BALmCES - 4th QIWlTER T """" ]= D==================== Account NaIIe October Nov.uer DecBlber Quarter Bal C ----- ------------------------ -------.-- -------.-- -------.-- -------.- C Acct. """.,.1 1 "". ••••••••••••••••,....... ••••, ••••, ••, •••11.. •••••••••• F F , ••11 listed F ,.",."., ."""", "",11." =[ Page 11111 P l1li Source Data • Line Source Num • Num FileSub Flds Source Field Array · ---- ------- ---- } 5 } 7 1 1 The lower 2 3 15 16 17 21 8151617 source content lines in the 2, works like the for 3, PRINT the numbering repor t , then 16, USING in table above defines 17, of 1 isted example, and FORM BASI C. page each is the area for the fifth and seventh seventh option the for the the bot tom the fiel ds line, 1 ike on of The example defines the 15, much field coun t a t input the format. This source part each The fifth numbered format data of source array. page -- -- -- -- -- -- -- -- -- -- -- - .- 6 4 field as ]= command Fi el d line preceded by the HP H • source into in the Turbo number 9, represents of selected wi 11 the i'nput line number in fiel d has 6 fields which are 21 page the primary file the at be Pascal the time pr i n ted 01" fi rst the repor t • the format. record If the of the usi ng the v- Spec i f i c processing, is 2.9. 47 Devel02er Interface --- Code output) impossibl e to for final the stubbed and the application The following more detail uses for prove). developer Turbo developer lists to Pascal internal chapter and all for I PO 4GL to a the major (as the use of further customize commands, inline ·macros· the the the 4GL system allow complete describes (i npu t , however i t program Therefore, procedures wi thi n application code, 1ogi c is embedded into the system, the market application. external standard foresee many versions on unprotec ted A --- the code, are available for the specific ·macro· code. language in ·macro· library procedures be on 1y and functions. Th i s final thus sp ec i f i c c ode appl ication greatl y that reducing sh ou 1d would the par t of the possibly require maintenance, cost maintaining each application. the in time and manpower for --=== VI CODE This chapter concentrates organization detailed of level the of actual design DESIGN upon 4GL code requires a the ===- design modules. data A and more structure, an organization of the code files, and system diagrams. 4GL Data the 4GL must driven, Structure --- The internal data structure of be well compact limitations as designed enough for possible. in PCs, The order and major as to be parameter- unfettered structures with designed within the system are -- 1 - The use of the B-tree indexing structure 2 - The use of pointers and linked lists 3 - The direct or absolute addressing of data 4 - The allowance for subscripted arrays of poi n t er s t o r ec or ds f or men us, f i 1 es, fields, indices, and buffers Dynamically created definition records are used to contain all current working data needed for the current menu item selected. Organization the Turbo Pascal code per the coding following of Code Files --- Due to the fact that version 3 edi tor source code f i 1e organization separate and of for the can onl y handl e organ i za t i on program protected code files. 64K of purposes, includes Li sted wi th the the VI - Code Design 2.9 49 file names are the contents of each. Type-Def.Pas - all type declarations and a minimum of global variables Library .Pas - a universal supporting library con tai n i ng i ndependen t modu 1es used by the entire 4GL program FileMang.Pas - code for index keys file management Pointers.Pas - pointer management including queues, double linked lists, trees, and buffers Support .Pas - search menu print search data window get report option data report selection module data input module record management related to data en try Controls.Pas - the 3 major controling modules which call the supporting modules in Support above EnterRecord FindData PrintReport Menu-Sys.Pas - menu system Init-Fin.Pas - initialization and finalization modules Also included are two application-specific files accessible to the contain application the stubbed developer. interface These modules are for the files that the developer. They are Speciall.Pas - UpDateAcct for accounting modules any data entry specific tests Specia12.Pas - any tests required for deletions specific report tests VI - SYstem the Diagrams high-level Warnier-Orr logic of detail --- R9. 50 Desi~n Code logic diagram. the program. for --- The and diagrams design Figure in a that follow present form 13 contains simi lar the most to a general Figures 14 and 15 continue with more the Record Menu Keys section in the lower right corner of Figure 13. r- i l ! ili 11'1; .Q.9 51 VI - Code Design Figure 13: System Structure Diagram -- r Stt screen I Get data drive ~raleter (Mhere data Mill bt located) I Initialize 5 global variables and flags Initialize global ~ointers for buffers, files, indices, menus Read defaults and file definitions I (currtntly in sequential data file) Initial- ~ Introduction Screen ization I Collect Record Definitions I Retain origi~l video modej set neM default video lode I Re9uest ilitdiate update yes/no Inltalize linUS, file definitions, buffers, and printer codes I l r ring buffer pointers Re-initiaTize 5 global flags II Clear Close open files to update disk directorr I Dispose of previous screen definition pOInters Htnu --4 Hain IUIlU scrnn I Input neM ltAU selection ~en neM fi Ie set Create neM entry scrttn and saves current work windows I L r I Initialize menu variables and pointers I Control~ Initialize search record Loop I r I I Initialize quit flag I I r I I I Read Only: HtftujFindlDataiClearjReportjPgUpjPgDn I I ClIIIIc1ndLi ne-----! • I I I ReadAlrite:HtftulFindlDataiClearjReportjPgUpjPgDnj I I I AddIUpdate I ClIIIIc1nd Loop----! L I Tests for mpty filH and buffers L I Case key of ---fr Pa9fYP• Key (get prev record data; print fields) l I I Key (get next record data; print fields) • Alt PagtUp Keys (print prev sub pg Mithin record) Pa~ I I I Alt ~agtDn Keys (print next sub pg Mithin record) • I I Upda1e (call EnterRecord (lUI» I Add. (call EnterRecord » Record Report (ca II PrintReport> Key • IMenu I Clear search buffer III F'nd data r J II II II L r I Window Mhole screen Finali- -4 Clear screen zation I Video set to original video aode I Be sure all pointers are nil and files closed L e II represents "exclusive or" or XOR logic continued in more detail on follOMing pages (/A / I I I' II I I' I \ t " 1 ~ VI - Code Design Figure 14: 2.9 52 System Structure Diagram (continued) r I Cl ear r,cord buHrr I IF add --f Print ,ntry scrttll I I Print n~ r,cord nUlbrr r Ellt,r R'cord --I L Initializ, r,cord variabl's r . I SIt currtnt ,ntry ii'ld\ location, ii.ld ltngth and oiis.t I S,t input window ii netOfd ior largr t,xt ii'lds Entry --I locat, cursor Sav, rntry ii'ld screen · Initializ' ii'ld variablts loop I Fi'ld looP"! Print i.tdiat. input prlllpt · I Input routift. according to typ. until grt valid I PutDatalntoRecord H no qui t flag I 60to n.xt tntry ii.ld r I I an~rr L rFI8 Sav, (H PostOK i,. H corrKt data thtn SavtData) I F9 Archiv, ( not currtntly install'd ) Cas, oi I Functio~ F7 Del,t, (ii dll.tllbl, thtn ask again; print n'xt r,cord) K,y I I F2 Codts pop-on window I I Ent'rl1ab = go to n.lt ii.ld in rKord · I t t ShiHe Tab = go to prtv ii.ld in record DispoH oi ,ntry r,cord buH,r r I Clear rtport iomat buH'r I Print install'd r,port iONlats I Gtt report data I I I I SIt printR,port1 r I Search crit'ria in output (ytslno) I Pag, numb,rs desired (y,51no)j ii y,s, thtn ,nt,r starting pag' nUlb,r ~ PauH b,tw,n pagrs (y,51no) ~ Ch,ck print,r .,ssag' Ch,ck paOt l,ngth Increm,nf prinf out nUlbrr Gtt data r,cord I I r I I Print proprr layout iOl'llat R'cord --f Print r,cord----! Print record totals H applicabl, loop I I Print spicing bttwtn rKords ii applicabl, I L I l1ov' to n,xt search buHrr pointrr L Ch,ck pagr l,ngth ior iOMlietd Dispos, oi report ioraat buiirr and total buii,rs Rtplac, standard tntry screen 6,t data ircn last acc,sstd search buHrr nodt Print data r,cord into ,ntry screen 2.9 53 VI - Code Design Figure 15: r I I I I I I ad System Structure Diagram (continued) -- Clear search bufftr r I Lists all fitlds availablt in rtcord for search I Input loop of chostn Stt of tlBltnts for tht search I r I I String/Char (begin or ~ithin starch) I I Byttllntegtl'/Real (.iniIUII" IIaxiltllll) xxListtttnu-l Input loop of search lili tations--l Oatt (.ini... " IIaXillll) ~ I L L I r I I 6tt search indtx rtquirtd for starch crittria I I Find first rtcord nUllbtr in search , FindData--l Search loop - adds data that INts cri ttria to search bufftr I I Prints first rtcord found or Itssa9t of lNONE F0UND1 L L Over 1ay Pascal, version 3, in phase 1. in Struc ture --- Due to the 1 imi ta t i on of Turbo the management of overlays is necessary Overlays were determined to be more efficient this project than chaining, is also possible for batch fi 1e which the application developer automaticall y modules into RAM disk, an EXE due to the code design. program. Four loads all It to create a compi 1ed overlay therefore nearly giving the speed of overlay files are used in this projec t . Overlay over 1ays can logic of a Design Methodology become qu i te program. modules which call --- The i nvol ved when rules for using matched wi th the A single overlay file can not contain any module within the same overlay code VI - Code Design file, 2.9 54 including itself, memory concurrently. For should be si ze of simi 1ar individual of module largest reserved called in the overlay mai n modules preven t con t i nuous eac h over 1ay within an overlay program memory should not exist To not retain exist tradi ng of for modu 1es f i 1e sh ou 1d in a The size code file swapp i ng speed, two in or calling the modu 1es into in the modules as possible. modules. overlay and can eff i c i ency, memory contain as many the they because is the more loop to the memory overlay area for each loop. One way to create an overlay system is to create a columnar table showing the calls or interfaces between only overlayed modules. except for are Global the fact called. The this that In case, calls Initialization, are not considered, they must be declared before they major out. modules controlling that includes Menu, and modules the main are singled module which Finalization. The first and last are ignored since they are only called once at the begi nn i ng and the end of any of the the program and therefore can be located in overlay con trol loop 1ogi c i s then con trol loop call s files conveniently. the nex t area to consi der. En terRecord, Pr i n tRepor t, and The The Fi ndDa ta which are the three major operations of the entire program. VI - 2.9 55 Code Design A column is then created for each overlay file in design and each column contains the names of it. To make engineer For in shoul d example, the it easi er use use input of EnterRecord. color green data One in used PrintReport. modul es in desi gn coding the use of the modules in over 1ays, wi th high-light into the output invol ved to might invol ved by to pink the the modules ie. to searches, could ie. to draw color-coded show what modu 1 e involved used by all modules mark ie. those be used to mark those used by FindData. Any other modules might be marked with blue. is pens. those data from the program, Yellow sof tware high-l ighter program, another. To comp 1 ete the the one that will be in memory the most. dominant module should be marked, may be one dominant module one for shou 1d Fi ndDa ta, not be and one for more controlling modules. between several considered. in than If modules, one there then perhaps with each column for Pr i n tRepor t • per each is any perhaps a of red. problem in The There EnterReport, However, the to process, each column must be checked to find the dominant module, other words, all The next step lines from one module to another call s the there three maj or in redesign deciding should be VI - Code Design By file, may looking --- 2.9. 56 for the dominant module in each the speed factor can also be considered. be more efficient if it is broken overlay An overlay down into more overlays if very many of its modules are called frequently or are con tai ned that follows, Ovt/'lay II in loops that conf 1 i c to Out/' lay 12 Ovt/'lay 13 Out/'laY 14 i } HenulEntryOK , HenuIEntryOl<~} Henu2EntryOK J Henu I I I I I CodeWindCM IlnputData IEntryOK OtleteOK I II } EnterRecord HenulPostOl< , I HtnulPostOK ~} PostOK ---J Henu2PostOl< J f1enu8ScrDtf , HenulScrDef ~} CreattEntryScr"" - } f1enu Htnu2ScrDef J -, I I I I I J the diagram the * indicates the dominant module. I HanageFileSet----J Pointer library Key library xxlistHenu PrintSearchData SetUp 6etReportData ReportSelection In } FindData --=== THE VI I LIBRARY ===- The master support facility for the modules contained in the system un i versa 11 y -pseudo diagram used the protected code 1 ibrary procedures and func t ions wh i ch language- everything else is or is based. -macro language- Within of create a from which this chapter is a list of the major library modules. --- External Call Library -- PROCEDURE FrameWin (UL,UR,LL,LR,Hor,Ver : Char); FrameWi n creates a frame around the curren t using the given characters passed into it. wi ndow PROCEDURE GetScrn ( X,Y,NumChars: Integer; VAR ChAr ray ); ChArray is an untyped variable used to pass in a variable sized array of pixel data. GetScrn gets the pixel data from the screen star t i ng at posi t i on X, Y which are global coordinates. PROCEDURE PutScrn ( X,Y,NumChars: Integer; VAR ChAr ray ); ChAr ray is an untyped variable used to pass in a var i ng si zed array of pixel data. Pu tScrn pu ts the pixel data onto the screen starting at posi tion X,Y which are global coordinates. FUNCTION GetVideOMode : Integer; GetVi deoHode retr i eves the DOS. curren t video mode from PROCEDURE GotoXYAbs (X,Y: Integer); GotoXYAbs goes to the global coordinate posi tion X,Y regardless of the current window. of VII - The 2.Q. LibrQr~ 58 PROCEDURE InitVideo (Mode: Integer); I n i tV ideo i nit i ali z es the video mode to Mode wh i c h can be 8-7. Standard settings are: 7 for 88x25 text and 3 for 88x25 colo~ text. PROCEDURE SetCu~sorSize (StartLine,EndLine: Integer); This procedure sets the cursor size 1 ike the BASIC Locate statement. FUNCTION WhereXAbs: Integer; WhereXAbs returns the current location of the cursor. FUNCTION WhereYAbs: Integer; WhereYAbs returns the location of the cursor. current global global screen column screen row PROCEDURE WriteSt (St: Str255); WriteSt is a fast screen access equivalent to Write. PROCEDURE WriteStLn (St: Str255); This is a fast screen access equivalent to WriteLn. --- Window Handling Library -- PROCEDURE AddWindow (WinNum : Integer; WTitle : Str88); AddWindow saves the current window contents and current cursor position in a buffer. It can create a frame around the new wi ndow and then wi ndow i nsi de the frame. It 1 oca tes the cursor at 1,1 in the new wi ndow and then sets wi ndow colors and clears the wi ndow screen. Wi nNum is the number of an array of window definitions also set up as initialization parameters by the programmer. PROCEDURE RemoveWindow (NumToRemove: Integer); RemoveWindow removes a given number of layers of windows, resets the final wi ndow colors, and relocates the cursor to the final wi ndow'" s last cursor position. VI I The --- 2.9 59 Librar~ --- Sound Library -- PROCEDURE Beep; Beep merely beeps to get the operator's attention. PROCEDURE Click; Click creates a click sound and InKey below for each key pressed. is called only by --- String Handling Library FUNCTION UpCaseStr (S : Str255): Str255; UpCaseStr changes string S to all in1ine code. upper case using FUNCTION StrL (Len : Integer; Character : Char) : Str255; StrL returns a str i ng of 1ength Len fill ed wi th given Character. the FUNCTION De1FrontSpc (TLine : Str255) : Str255; Del FrontSpc returns a string wi th all front spaces del eted and is used for strings to be converted to numer i c data because spaces wi 11 create a run-t ime error. FUNCTION LSet (Len : Integer; Phrase : Str255) : Str255; LSet left justifies Phrase into a field of length Len FUNCTION Center (Len : Integer; Phrase : Str255 ) : Str255; Center centers Phrase in a string of length Len. --- Screen Handling Library PROCEDURE StatusLine (Which : Char; Num : Integer; Message: Str255); StatusLine handles all reserved message areas and color coding. Any rearrangement of the screen would be done here. VII - The J!.9. 69 Librar~ PROCEDURE ErrMessage (VAR err : Boolean; Message: Str255); ErrMessage calls Beep, calls StatusLine ("2" ,9,Message+" - KEY TO CCl'rrINUE), calls InKey to create a pause and allow for an Esc, and returns the previous contents of line 2. PROCEDURE ManualWindow; This procedure is called any time an Fl is pressed. It di sp 1ays the manual ina pop-on wi ndow and allows paging through the on-line manual. PROCEDURE CommandLine (VAR Command: Char; CSet : CharSet; Message: Str169); ComrnandLi ne call s Col orCodeLi ne to di sp 1ay a color coded commandline message on line 24. It then calls CharInput to input a char from CSet and sends Command character back to be used in a case to determine the next mode of operation. --- Input Library -- PROCEDURE InKey (VAR Special : Boolean; VAR Charl, Char2 : Char); InKey loops unti 1 a key is pressed. If the cl ick flag is true then it also calls click when a key is pressed and returns the key that was pressed as 2 characters. The Special boolean is a flag that is true if the key pressed i So a 2-code key. I nKey is implemented with an MsDos call. PROCEDURE ReadStr (VAR TStr : str255; LMax : Integer; which : Char; SpecialWindow: Boolean; VAR BackX, BackY : Integer ); Absolutely all user input is entered through ReadStr in str i ng form. ReadStr 1oca tes the cursor; tests for actual character input and special keys and key combinations. VII - The Librar~ 2.9. 61 PROCEDURE Intlnput ( Ins,TabOver: Integer; VAR IntNum : Integer; Bot, Top : Real; UnderL, NextLine: Integer; Promp t : Str255); Ins is 8 for a H no insert- option; any other number tells the program to insert a line at the input location. TabOver is the column position of the promp t message. In tNum is the integer to be i npu t; if an original value is passed in, then that value is displayed in the input area. Bot and Top are minimum and maximum values allowed. UnderL is the length of the underl ine prompt, in other words, the maximum length of the input area or maximum number of characters allowed to be entered. NextLine is 8 to flag for no 1 inefeed/carriage return and any other number sends the cursor to the nex t 1 i ne. Promp t i s an input message preceding the input area. The following are similar and related to Intlnput: PROCEDURE Bytelnput PROCEDURE Linelnput PROCEDURE Datelnput PROCEDURE Charlnput PROCEDURE Real Input · · Ins,TabOver VAR Bite Bot, Top UnderL, NextLine: Prompt : ( Ins,TabOver VAR TLine Bot, Top UnderL, NextLine: Prompt ( Ins, TabOver VAR TDate Bot, Top UnderL, NextLine: Prompt ( Ins,TabOver VAR TChar Bot, Top UnderL, NextLine: Prompt ( Ins,TabOver VAR TReal Bot, Top UnderL, NextLine: Prompt ( ·· · · · · · · · · · ·· · ·· ·· · Integer; Byte; Real; Integer; Str255); Integer; Str255; Real; Integer; Str255); Integer; Byte3; Real; Integer; Str255) ; Integer; Char; Real; Integer; Str255); Integer; Real; Real; Integer; Str255); VII .e.g 62 The Library --- Output Library -- PROCEDURE PrtStat; PrtStat checks to see if the printer is turned on and se1 ec t i s on. I f e i t her i s of f then i t g i ves an error message and waits for the operator to input to continue or to exit. PROCEDURE PrtPrint <Prt : Integer; Format: Str255); Prt is 1 for screen only output, 2 for printer only output, and 3 for both outputs. If Prt is 2 or 3 then PrtStat is called. Format is the message to be output with no linefeed. PROCEDURE PrtPrintLn <Prt : Integer; Format: Str255); This is identical to PrtPrint with a linefeed added. PROCEDURE FormFeed; This sends a formfeed to the printer if Prt is PROCEDURE ColorCodeLine < Prt > 1. : Integer; : Str255; LineFeed: Boolean; Integer ); VAR lk Prt is 1 for screen output only 2 for printer output only 3 for both outputs L can contain the characters ,&, or ,~, or " , ,&, sets bold attributes for printer output and sets highlighting for screen output. ,-, sets underline on for printer output and sets low lighting for screen output. " , turns off all attributes. LineFeed is true to produce a linefeed. lk returns an incremented line count if output is to the printer and Prt > 1. L VII - The Library --- 2.9 63 --- File Handling Library -- FUNCTION FileLen (DF : Datafile) : Integer; Fi 1eLen returns the number of records con tai ned in file DF. It includes the number of records used and number deleted and ready for reuse. FUNCTION UsedRecs (DatF : DataFile) : Integer; UsedRecs returns the number of used records current data in the file DatF. PROCEDURE This the wish with Oplnterrupt; procedure checks for an operator interrupt using END key. It call s CommandLi ne to ask Do you to ABORT? (Y/N)H. This is used during reports. H FUNCTION IndexKey (IndNum : Integer; RN : Integer; VR : VariantRec); IndexKey creates the index key for index number IndNum using the record number RN and the data record contained in VR, a variant record used to pass all data records. PROCEDURE NextKey (VAR IndFile VAR RN IndexFile; Integer; VAR Key); Nex tKey goes to the index f i 1e I ndFi 1e to get the record number, RN, of the nex t record in the index and returns the untyped Key for the next record. PROCEDURE PrevKey (VAR IndFile : IndexFile; VAR RN : Integer; VAR Key); This is identical to Nex tKey above, previous record. but PROCEDURE ClearKey (VAR IndFile : IndexFile); ClearKey sets the index pointer to the empty node of the index. gets the beginning VII The --- 9.9 64 Librar~ IndexFile; (VAR IndFile : Integer; VARRN VAR Key); Fi ndKey must be preceded by a Cl earKey command for IndFile. It searches for the given index Key in IndFi leo It finds the first occurance of an exact match. PROCEDURE FindKey PROCEDURE SearchKey (VAR IndFile IndexFile; VARRN Integer; VAR Key); SearchKey must be preceded by a ClearKey command for I ndFi 1e. It searches for gi ven index Key in IndFi 1 e. For exampl e, if IndFi 1 e has keys of CATALYST, CATAMOUNT, etc. and Key is CAT, then the RN associated with CATALYST is returned and Key := CATALYST. It finds the first occurance of the first par t of a key. I f none is found then returns a global flag OK as false; PROCEDURE ManageFileSet (DoWhat : Char; FSet : FileSetType); DoWhat is either '0' for open or 'c' to close files. FSet is the set of numbers of the files to be operated upon. Indices are automatically updated and the existence of fi les and indices are tested; if a f i 1 e or index does not ex i st, the opera tor is asked if the file should be created. --- Miscellaneous Modules -- FUNCTION Yes (Ins, TabOver, NextLine : Integer; Prompt : Str255) : Boolean; Yes call s Charlnput wi th character set of ['Y', 'N'] and returns a boolean value of true if the character is 'Y'. PROCEDURE ClrLine; Cl rLi ne clears located. the curren t 1 i ne where PROCEDURE IntDate (VAR IDate : Byte3); IndDate returns the system date information (year/month/day). in the cursor three bytes is of VI I --- P..9. 65 The Librar}:: PROCEDURE IntTime (VAR ITime : Byte3); IntTime returns the system time in three bytes. FUNCTI(Jo..I Date : Str8; Date .... eturns the system data in st .... ing form system time in st .... ing form '00/00/00' FUNCTI(Jo..I Time : Str8; Time returns the '00:00:00' All wi 11 are other not the procedures be call ed kernel of the program itself. and by the func t ions are the appl ication system and are sel f-managi ng and programmer. call ed on 1y They by the --=== VI I I TESTING ===- Testing of the 4GL must be extensive because it is the basis of many applications. To prevent compounding errors, separate testing stages are as follows: Stage 1 --- Fi 1e managemen t i s module to guarantee that all tested as a separate data is saved, retrieved, and deleted properly. Stage 2 --- The menuing system and screen handling are tested with stubbed calls to the file management routines. This includes verifi ed that testing all the windowing screens It system. retain their must be consistency according to the design described earlier. Stage before Input 3 integrating them routines into the are Data tested Entry separately system. The major features to be tested include -- 1 - the error handling for invalid entry of data -- alphanumeric data entered into numeric fields numeric data outside of the minimum and maximum limits characters not allowed in the field 2 - the 3 - the 4 - the use and clarity of error messages handl ing fields of the decimal point in real data cursor location, especially in string using both insert and over type modes input VIII - Testing 5 - the .12.9 67 p~ope~ ~etu~n of the input to the calling ~outine. 6 - the detection of special key combinations The fi~st me~ging them while of standa~d eve~y simultaneously befo~e Reco~d modules with an actual me~ged type must updates, addi tions, comp 1 eted be befo~e and test i ng modules. Repo~t 5 sc~een layouts. tested at temp t i ng ~epo~t gene~ation Stage be togethe~. application del et ions can 4 --- Testing the Stage the stages 3 modules layouts and coun ts, col then umna~ a~e now with tested va~ious totals, and with columna~ pagi ng a~e tested extensively. Stage accounting o~de~s, 6 The application final me~ged testing with and point of sale invoicing. is a invento~y, ~elational pu~chase --=== IX SUMMARY The anal ysi sand desi gn p .... esen ted ===- is now he .... e .... eady fo .... anothe.... mo.... e detailed stage of design and then coding. The 4GL is •••• not a substitute fo design and p .... oject management.· been completed fo .... the 6 good analysis, The majo application coding task has develope.... , howeve.... a tho .... ough analysis and design of the database iteself is the It will be only as good top p .... io.... ity befo.... e using the 4GL. as the database design majo.... has functions been that invented itself. have and the The 4GL has simplified the now been automated. si x spokes a .... e The wheel the foll owi ng management .... outines 1 - Menus and commandlines 2 - Sc .... een management 3 - Data ent y management 4 - Data sea ch management 5 - Repo.... t gene....ation 6 - File and .... eco.... d management The 4GL now contains f .... om 88 - 9~/. .... elational database appl ication. p.... esented he.... ein, the of the code needed fo .... a Wi th application the modu 1a.... can be desi gn expanded to IX - include mor-e application expanded both developer-, or- modules themselves. of by additional developer. disturbing the structure of has user been These primary maintained. or can the data goal of The secondary interface has also been maintained management struc ture the the modules 4GL capabi 1 i t i es ex i st i ng by (2) code added by the efficiency above the specific (1) Therefore, consistent managemen t the by done wi thout maintenance wi th functions cur-r-ent be files goal E..9. 69 Summar-i' --- wi 11 routines. sti 11 be screen for Any addi tional implemented management, through data entry management, etc. The accep tance of past few years. is, mor-e advancements never--endi ng It must spec ia 1 i zed 4GLs has however, be grown only developed needs of is also needed for The quest on. fulfill, keep up today and but a has There thus one never is been always revision the Even wi th the tomorrow. similar approach systems and many other areas. for efficient, well-engineered methods still There finished. real-time wi th i n the beginning. to both Database management has led the way, rap i dl y a program another after need another. the beginning of a new 4GL adventure. that is that Herei n goes totally it is might on 1y --=== BIBLIOGRAPHY ===- 1 Turbo GhostWriter: Taking the Time Out of Turbo Pascal, This Month's MENU, Vol. 1, No.2, August 1987, pp. 4. 2 paul Winsberg, CASE: Getting the Big Picture, Database Programming & Design, March, 1988, pp. 54. 3 Jan Snyders, The CASE Infosystems, March, 1988, pp. 28. 4The Reality 1986, pp. 32. of the of the Artful Dodgers, Promise, InfoSystems, November, 5 Kent Lawson, Thinking About 4GLs, January 1988, pp. 28. Information Center, 6 brochures, ASCII (Automated Software International, Inc.), received January 1988. Concepts 7pascal GhostWriter amounts to 'instant software', Comdex Show Dai 1y, Vol. 5 , No.6, N ovember 2, 1987, pp. 128. 8 James R. Hughes, Moving Out Infosystems, October 1986, pp. 76. of the Middle Ages,