4GL.ppt
-
Upload
john-mathew -
Category
Documents
-
view
38 -
download
0
description
Transcript of 4GL.ppt
44ththGenerationGenerationProgrammingProgrammingLanguagesLanguages
GenerationGenerationProgrammingProgrammingLanguagesLanguages
By: Meisam Mousavi (116722)
Approximate Time: 25 Min.No. Of Slides: 33
Presentation OverviewPresentation Overview
• Programming Languages Being CategorizedProgramming Languages Being Categorized• 44thth Generation Programming Languages Generation Programming Languages• History Of 4GLHistory Of 4GL• Why 4GL?Why 4GL?• Different Types Of 4GLDifferent Types Of 4GL
• Additional ComponentsAdditional Components• 4GL Advantages & Disadvantages4GL Advantages & Disadvantages• 4GL In Action4GL In Action• ORACLE As A 4GEORACLE As A 4GE• Structured Query Language (SQL)Structured Query Language (SQL)• Microsoft English QueryMicrosoft English Query
Page 1 Of 33Page 1 Of 33
5 Classes Of 5 Classes Of Programming LanguagesProgramming Languages
•First Generation First Generation – Machine LanguageMachine Language
•Second Generation Second Generation – Assembly LanguageAssembly Language
•Third GenerationThird Generation– high-level programming languages, such as C, C++, and Javahigh-level programming languages, such as C, C++, and Java
•Fourth GenerationFourth Generation•Fifth Generation Fifth Generation
– languages used for artificial intelligence and neural networkslanguages used for artificial intelligence and neural networks
Page 2 Of 33Page 2 Of 33
44thth Generation Generation Programming LanguagesProgramming Languages
• A A fourth-generation programming fourth-generation programming languagelanguage (or 4GL) is a programming (or 4GL) is a programming language designed with a specific purpose language designed with a specific purpose in mind such as the development of in mind such as the development of commercial business software.commercial business software.
• fourth-generation languages are closer to fourth-generation languages are closer to human languageshuman languages than typical high-level than typical high-level programming languages.programming languages.
• Most 4GLs are used to Most 4GLs are used to access databasesaccess databases. .
Page 3 Of 33Page 3 Of 33
History Of 4GLHistory Of 4GL
• The term 4GL was according to The term 4GL was according to James MartinJames Martin first used in his first used in his 19821982 book book Applications Applications Development Without ProgrammersDevelopment Without Programmers to refer to to refer to non-procedural high-level specification languages.non-procedural high-level specification languages.– A SPECIFICATION language is one that enables a A SPECIFICATION language is one that enables a
programming task to be performed by the programming task to be performed by the construction of a set of non-procedural construction of a set of non-procedural statements.statements.
• In 1987 Grindley distinguished between a In 1987 Grindley distinguished between a PurePure and a and a HYBRIDHYBRID 4GL 4GL
Page 4 Of 33Page 4 Of 33
Why 4GL?Why 4GL?
• Programming effortProgramming effort– They can be easily learnt since there are They can be easily learnt since there are
relatively few commands, functions and relatively few commands, functions and structures. structures.
• The cost of software development.The cost of software development.• Alter and maintainAlter and maintain• Ease of useEase of use• Simplicity of design and implement Simplicity of design and implement
Page 5 Of 33Page 5 Of 33
Why 4GL?Why 4GL?
• The time it takes to develop softwareThe time it takes to develop software– Programs written in a 4GL can be written very quickly. Programs written in a 4GL can be written very quickly.
Each statement written may generate a large amount Each statement written may generate a large amount of code containing a high level of functionality and of code containing a high level of functionality and productivity. For example, consider the SQL productivity. For example, consider the SQL statement: statement:
SELECT surname, line_no, ddress_lineSELECT surname, line_no, ddress_lineFROM patient, patient_addressFROM patient, patient_addressWHERE patient.nhs_no=patient_address.nhs_nWHERE patient.nhs_no=patient_address.nhs_nORDER BY patient.nhs_no, line_noORDER BY patient.nhs_no, line_no
To write the equivalent in a 3GL would require many To write the equivalent in a 3GL would require many lines of code and the procedural and iteration lines of code and the procedural and iteration structures that are absent from SQL. structures that are absent from SQL.
Page 6 Of 33Page 6 Of 33
Different Types Of 4GLDifferent Types Of 4GL
– TheoryTheory• Pure 4GLPure 4GL: A specification language made up of non-: A specification language made up of non-
procedural instruction sets.procedural instruction sets.• HYBRID 4GLHYBRID 4GL: A number of pure 4GLs combined with : A number of pure 4GLs combined with
and held together by a more procedural language.and held together by a more procedural language.– ImplementationImplementation
• Report generatorsReport generators • Forms generatorsForms generators • 4GLs4GLs (sometimes termed (sometimes termed fourth generation fourth generation
environmentsenvironments) ) – attempt to automatically generate whole systems attempt to automatically generate whole systems
from the outputs of CASE tools, specifications of from the outputs of CASE tools, specifications of screens and reports, and possibly also the screens and reports, and possibly also the specification of some additional processing logic. specification of some additional processing logic.
Page 7 Of 33Page 7 Of 33
Additional ComponentsAdditional Components
• Some 4GLs have integrated tools which allow for Some 4GLs have integrated tools which allow for the easy specification of all the required the easy specification of all the required information. information. – James Martin's James Martin's Information EngineeringInformation Engineering systems systems
development methodology development methodology • allow the input of the results of system analysis and design in allow the input of the results of system analysis and design in
the form of Data Flow Diagrams, Entity Relationship Diagrams, the form of Data Flow Diagrams, Entity Relationship Diagrams, Entity Life History Diagrams etc from which hundreds of Entity Life History Diagrams etc from which hundreds of thousands of lines of COBOL would be generated.thousands of lines of COBOL would be generated.
– Oracle Corporation’s Oracle Designer and Oracle Oracle Corporation’s Oracle Designer and Oracle Developer Developer • could be integrated to produce database definitions and the could be integrated to produce database definitions and the
forms and reports programs. forms and reports programs.
Page 8 Of 33Page 8 Of 33
4GL Advantages & 4GL Advantages & DisadvantagesDisadvantages
• Being specification languages, their Being specification languages, their use requires, in theory at least, no use requires, in theory at least, no programming task; the necessary programming task; the necessary code will be generated directly from code will be generated directly from the specification.the specification.
• Can only address a small and very Can only address a small and very highly specialized area of highly specialized area of development development
Page 9 Of 33Page 9 Of 33
4GL In Action4GL In Action
• Database query languages:Database query languages:– SQL SQL – Oracle SQL*Plus Oracle SQL*Plus – Progress 4GL Progress 4GL
• Data-stream languages:Data-stream languages:– AVS AVS – APE APE – Iris Explorer Iris Explorer
• Screen painters and generators:Screen painters and generators:– Oracle Forms Oracle Forms
Page 10 Of 33Page 10 Of 33
4GL In Action4GL In Action• Report Generators:Report Generators:
– Oracle Reports Oracle Reports – LINC LINC – GEMBase GEMBase – BuildProfessional BuildProfessional – Informix-4GLInformix-4GL– Focus Focus – MetafontMetafont– RPG-II RPG-II – S S – IDL-PV/WAVE IDL-PV/WAVE – Gauss Gauss – MathematicaMathematica
Page 11 Of 33Page 11 Of 33
OracleOracleAs A 4GEAs A 4GE
Page 12 Of 33Page 12 Of 33
FOURTH GENERATION FOURTH GENERATION ENVIRONMENT (4GE) ?ENVIRONMENT (4GE) ?
• In order to provide an environment In order to provide an environment in which a complex system can be in which a complex system can be developed, a number of different developed, a number of different types of "pure" fourth generation types of "pure" fourth generation languages must be integrated, and languages must be integrated, and further procedural programming further procedural programming facilities must be provided. facilities must be provided.
Page 13 Of 33Page 13 Of 33
4GE Components4GE Components
Typical 4GE components:Typical 4GE components: – END-USER QUERY LANGUAGE (e.g. SQL), END-USER QUERY LANGUAGE (e.g. SQL), – SCREEN FORMATTER (e.g. Oracle's SCREEN FORMATTER (e.g. Oracle's
screen painter in SQL*Forms), screen painter in SQL*Forms), – REPORT GENERATOR. REPORT GENERATOR.
Page 14 Of 33Page 14 Of 33
4GE Components4GE Components
• DATA DICTIONARY :DATA DICTIONARY :– Central to all fourth generation environmentsCentral to all fourth generation environments– A system database, rather than a user database, A system database, rather than a user database,
which holds which holds metadatametadata as opposed to the data as opposed to the data itself and the itself and the DATABASE MANAGEMENT SYSTEMDATABASE MANAGEMENT SYSTEM..
– A place to store all the various schemas and A place to store all the various schemas and mappings in both source and object formmappings in both source and object form
– Cross-reference information :Cross-reference information :•Which programs use which pieces of the databaseWhich programs use which pieces of the database•Which user requires which reportsWhich user requires which reports•Qhat terminals are connected to the systemQhat terminals are connected to the system•……
Page 15 Of 33Page 15 Of 33
DBMS RulesDBMS Rules
• The database management system The database management system performs two functions: performs two functions: – Filehandler for the systems developed Filehandler for the systems developed
using the components of the 4GEusing the components of the 4GE– It is the software that manages the It is the software that manages the
data dictionary. data dictionary.
Page 16 Of 33Page 16 Of 33
Oracle as a 4GEOracle as a 4GE– SQL*PlusSQL*Plus Allows users to create and manipulate tables using SQL. Allows users to create and manipulate tables using SQL. – SQL*FormsSQL*Forms An interactive applications generator for creating advanced, An interactive applications generator for creating advanced,
forms-based applications. forms-based applications. – SQL*LoaderSQL*Loader A module to simplify the process of the entry of large A module to simplify the process of the entry of large
quantities of data into tables. quantities of data into tables. – SQL*ReportSQL*Report A module for generating complex reports. A module for generating complex reports. – SQL*MenuSQL*Menu A module to enable the coordination of forms by an A module to enable the coordination of forms by an
interactive menuing system. interactive menuing system. – SQL*DDSQL*DD Design Dictionary - a structured system to monitor and control Design Dictionary - a structured system to monitor and control
the development from the initial analysis to running and maintenance. the development from the initial analysis to running and maintenance. – EASY*SQLEASY*SQL An interface for inexperienced users of SQL using a mouse An interface for inexperienced users of SQL using a mouse
and screen graphics. and screen graphics. – SQL*CalcSQL*Calc An Excel compatible spreadsheet that may use database data; An Excel compatible spreadsheet that may use database data;
the spreadsheet cells can call SQL statements. the spreadsheet cells can call SQL statements. – SQL*GraphSQL*Graph Provides a graphical representation of data retrieved from Provides a graphical representation of data retrieved from
the database. the database. – SQL*TextSQL*Text A module for creating a forms interface to large text A module for creating a forms interface to large text
databases.databases.
Page 17 Of 33Page 17 Of 33
SQLSQLStructured Query LanguageStructured Query Language
Page 18 Of 33Page 18 Of 33
SQL Command TypesSQL Command Types
Query CommandsQuery Commands– SelectSelect– Create ViewCreate View– ……
• Update CommandsUpdate Commands– InsertInsert– DeleteDelete– UpdateUpdate– ……
Page 19 Of 33Page 19 Of 33
• A typical SQL query has the form:A typical SQL query has the form:select select AA1, 1, AA2, ..., 2, ..., AnAnfromfrom rr1, 1, rr2, ..., 2, ..., rmrmwhere where PP
– Ais Ais represent attributesrepresent attributes– ris ris represent relationsrepresent relations– PP is a predicate. is a predicate.
• The result of an SQL query is a The result of an SQL query is a relation.relation.
Retrieving Data (Select Command)
Page 20 Of 33Page 20 Of 33
• Provide a mechanism to hide certain data from Provide a mechanism to hide certain data from the view of certain users. To create a view we the view of certain users. To create a view we use the command:use the command:
where:
<query expression> is any legal expression
The view name is represented by v
create view all-customer as (select branch-name, customer-name from depositor, account where depositor.account-number = account.account-number) union (select branch-name, customer-name from borrower, loan where borrower.loan-number = loan.loan-number)
• A view consisting of branches and their customersA view consisting of branches and their customers
Retrieving Data (Views)
Page 21 Of 33Page 21 Of 33
Modification of the Modification of the DatabaseDatabase
• Delete all account records at the Perryridge branchDelete all account records at the Perryridge branch
delete from delete from accountaccountwherewhere branch-name = branch-name = ‘Perryridge’‘Perryridge’
• Add a new tuple to Add a new tuple to account account with with balancebalance set to null set to null
insert into insert into accountaccountvalues values (‘A-777’,‘Perryridge’, (‘A-777’,‘Perryridge’, nullnull))
• Increase all accounts with balances over $10,000 by 6%, all other Increase all accounts with balances over $10,000 by 6%, all other accounts receive 5%.accounts receive 5%.
updateupdate account accountset set balance = balance balance = balance 1.06 1.06where where balance balance > 10000> 10000
Page 22 Of 33Page 22 Of 33
Domain Types in SQLDomain Types in SQL
• char(n).char(n). Fixed length character string, with user-specified length Fixed length character string, with user-specified length n.n.• varchar(n). varchar(n). Variable length character strings, with user-specified Variable length character strings, with user-specified
maximum length maximum length n.n.• int. int. Integer (a finite subset of the integers that is machine-Integer (a finite subset of the integers that is machine-
dependent).dependent).• smallint.smallint. Small integer (a machine-dependent subset of the integer Small integer (a machine-dependent subset of the integer
domain type).domain type).• numeric(p,d).numeric(p,d). Fixed point number, with user-specified precision of Fixed point number, with user-specified precision of pp
digits, with digits, with nn digits to the right of decimal point. digits to the right of decimal point. • real, double precision.real, double precision. Floating point and double-precision floating Floating point and double-precision floating
point numbers, with machine-dependent precision.point numbers, with machine-dependent precision.• float(n).float(n). Floating point number, with user-specified precision of at Floating point number, with user-specified precision of at
least least nn digits. digits.• Null values are allowed in all the domain types. Declaring an attribute Null values are allowed in all the domain types. Declaring an attribute
to be to be not nullnot null prohibits null values for that attribute. prohibits null values for that attribute.• create domaincreate domain construct in SQL-92 creates user-defined domain construct in SQL-92 creates user-defined domain
typestypescreate domain create domain person-name person-name charchar(20) (20) not nullnot null
Page 23 Of 33Page 23 Of 33
Date/Time Types in SQL (Cont.)Date/Time Types in SQL (Cont.)
• date.date. Dates, containing a (4 digit) year, month and date Dates, containing a (4 digit) year, month and date– E.g. E.g. datedate ‘2001-7-27’ ‘2001-7-27’
• time. time. Time of day, in hours, minutes and seconds. Time of day, in hours, minutes and seconds.– E.g. E.g. time time ’09:00:30’ ’09:00:30’ time time ’09:00:30.75’ ’09:00:30.75’
• timestamptimestamp: date plus time of day: date plus time of day– E.g. E.g. timestamptimestamp ‘2001-7-27 09:00:30.75’ ‘2001-7-27 09:00:30.75’
• IntervalInterval: period of time: period of time– E.g. Interval ‘1’ dayE.g. Interval ‘1’ day– Subtracting a date/time/timestamp value from another gives an Subtracting a date/time/timestamp value from another gives an
interval valueinterval value– Interval values can be added to date/time/timestamp valuesInterval values can be added to date/time/timestamp values
• Can extract values of individual fields from date/time/timestampCan extract values of individual fields from date/time/timestamp– E.g. E.g. extractextract ( (year fromyear from r.starttime) r.starttime)
• Can cast string types to date/time/timestamp Can cast string types to date/time/timestamp – E.g. E.g. castcast <string-valued-expression> <string-valued-expression> as dateas date
Page 24 Of 33Page 24 Of 33
Entity Management Entity Management CommandsCommands• An SQL relation is defined using the An SQL relation is defined using the create table create table command:command:
– create table create table branchbranch((branch-namebranch-name char(15) char(15) not null,not null,branch-citybranch-city char(30),char(30),assetsassets integer)integer)
• The The drop table drop table command deletes all information about the dropped command deletes all information about the dropped relation from the database.relation from the database.
• The The alter tablealter table command is used to add attributes to an existing command is used to add attributes to an existing relation. relation. – alter table alter table r r add add A DA D
• The The alter tablealter table command can also be used to drop attributes of a command can also be used to drop attributes of a relationrelation– alter table alter table rr drop drop A A
Page 25 Of 33Page 25 Of 33
Embedded SQLEmbedded SQL• The SQL standard defines embeddings of SQL in a variety of The SQL standard defines embeddings of SQL in a variety of
programming languages such as Pascal, PL/I, Fortran, C, programming languages such as Pascal, PL/I, Fortran, C, and Cobol.and Cobol.
• A language to which SQL queries are embedded is referred A language to which SQL queries are embedded is referred to as a to as a host host language, and the SQL structures permitted in language, and the SQL structures permitted in the host language comprise the host language comprise embedded embedded SQL.SQL.
• EXEC SQL statement is used to identify embedded SQL EXEC SQL statement is used to identify embedded SQL request to the preprocessorrequest to the preprocessor
EXEC SQL <embedded SQL statement > END-EXECEXEC SQL <embedded SQL statement > END-EXECNote: this varies by language. E.g. the Java embedding Note: this varies by language. E.g. the Java embedding usesuses
# SQL { …. } ; # SQL { …. } ; Sample:
EXEC SQLdeclare c cursor for select customer-name, customer-cityfrom depositor, customer, accountwhere depositor.customer-name = customer.customer-name and depositor account-number = account.account-number
and account.balance > :amountEND-EXEC
Page 26 Of 33Page 26 Of 33
Dynamic SQLDynamic SQL
• Allows programs to construct and submit SQL queries at run Allows programs to construct and submit SQL queries at run time.time.
• Example of the use of dynamic SQL from within a C Example of the use of dynamic SQL from within a C program.program.
char * char * sqlprog = “ sqlprog = “update update account account setset balance = balance * balance = balance * 1.051.05
where where account-number = ?”account-number = ?”EXEC SQL EXEC SQL prepareprepare dynprog dynprog from from :sqlprog;:sqlprog;charchar account account [10] = “A-101”;[10] = “A-101”;EXEC SQL EXEC SQL execute execute dynprogdynprog using using :account;:account;
• The dynamic SQL program contains a ?, which is a place The dynamic SQL program contains a ?, which is a place holder for a value that is provided when the SQL program is holder for a value that is provided when the SQL program is executed.executed.
Page 27 Of 33Page 27 Of 33
Microsoft Microsoft English QueryEnglish Query
Page 28 Of 33Page 28 Of 33
What Is English Query?What Is English Query?
With English Query, developers can With English Query, developers can use their SQL and OLAP databases use their SQL and OLAP databases as a basis to build an English Query as a basis to build an English Query application, which allows end users application, which allows end users to query the database in English.to query the database in English.
SELECT sum(Orders.Quantity) from Orders, Parts WHERE Orders.State='WA'andDatepart(Orders.Purchase_Date,'Year')='1996'andPart.PartName = 'ProductX' and Orders.Part_ID = Parts.Part_ID
Page 29 Of 33Page 29 Of 33
How it works?How it works?
Page 30 Of 33Page 30 Of 33
ReferencesReferences
• Microsoft English Query TutorialsMicrosoft English Query Tutorials
• Microsoft SQL Server 2000 User ManualMicrosoft SQL Server 2000 User Manual
• http://portal.acm.orghttp://portal.acm.org
• http://burks.brighton.ac.uk/http://burks.brighton.ac.uk/
• http://www.soi.city.ac.uk/http://www.soi.city.ac.uk/
• http://en.wikipedia.org/wiki/4GLhttp://en.wikipedia.org/wiki/4GL
• http://encyclopedia.fablis.com/index.php/Fourth-generhttp://encyclopedia.fablis.com/index.php/Fourth-generation_languageation_language
Page 31 Of 33Page 31 Of 33
Page 32 Of 33Page 32 Of 33
Thanks For
Attention!