software development languages and environments

21
Software Development Languages and Environments

Upload: ghita

Post on 11-Jan-2016

36 views

Category:

Documents


0 download

DESCRIPTION

Software Development Languages and Environments. Programming languages. High level languages. are problem orientated contain many English words are easier to understand must be translated into machine code are designed to solve particular types of problems. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Software Development Languages and Environments

Software Development Languages and Environments

Page 2: Software Development Languages and Environments

Programming languages

High level languages

• are problem orientated• contain many English words• are easier to understand• must be translated into machine code• are designed to solve particular types of

problems

Page 3: Software Development Languages and Environments

Classification of Programming Languages

Lots of way’s to classify languages

• Higher Computing examines four– Procedural– Event Driven– Declarative– Scripting

• There are many, many more you don’t need to worry about just now for example– Object Orientated– Page Description Languages– Parallel

Page 4: Software Development Languages and Environments

Procedural LanguagesKey features• Carried out in a fixed

sequence with a start and end point

• Can be split into separate functions and procedures

• Have control structures such as If statements, for..next loops and do..while loops

Examples of procedural languages are:

•BASIC•Pascal•C

A lot of programmers are familiar with at least one procedural language

Page 5: Software Development Languages and Environments

Example Pascal Procedural Code

Page 6: Software Development Languages and Environments

Declarative Languages

Key features• Consist of facts and rules• No fixed sequence of

instructions• Are queried (asked

questions) which they try to find a solution to

• Uses pattern matching to answer queries

– facts and rules combined in different ways until a solution, or no solution, is found

Examples of declarative languages are:

•Prolog•LISP•ML•Scheme•Erlang

languages such as Prolog and LISP are used predominantly in the field of Artificial Intelligence.

Page 7: Software Development Languages and Environments

Here are some facts:

Parent (Liz, Tom). means that Liz is a parent of TomFemale (Liz). means that Liz is femaleMale(Tom).Parent(Bert, Tom).

Here is a rule:

Mother(X, Y) :- means that X is a mother of Y IF Parent(X, Y), Female(X) X is a parent of Y AND X is female!

Query could be Mother(X, Tom) which would give the answer X=Liz

Example Prolog Declarative Code

Page 8: Software Development Languages and Environments

Event Driven Languages

Key Features• no fixed order of

instructions• wait for user input

(clicking a button) before performing an action

• front end for creating graphical user interfaces

• share the same type of language features as procedural languages

Examples of event driven languages are:

•Visual Basic•Delphi (Object Pascal)•Smalltalk

Used for creating a wide range of desktop applications for modern OS’s such as Mac OSX and Windows Vista

Page 9: Software Development Languages and Environments

Example Visual Basic Event Driven Code

Page 10: Software Development Languages and Environments

Scripting Languages

Key Features• usually built-in to existing

applications• automate or extend the

functionality of applications• have extra functions,

procedures and data types related to the application

– Selection.Font.Name– Range(“A1”).Select

• run slower than other programs because they’re interpreted

• share the same type of language features as procedural languages

Examples of scripting languages are:

•VBA (Visual Basic for Applications)•Javascript•TCL

Lots of people create and use macros who wouldn’t consider themselves programmers

Page 11: Software Development Languages and Environments

Choosing an appropriate language

• the experience and expertise of the development team

• the languages available to the organisation• which language has the facilities most

appropriate to solve the problem• the availability of a suitable

complier/interpreter• the portability of the code produced

Page 12: Software Development Languages and Environments

Identifying what language features are needed

During the Design Phase

Identify objects and operations needed for the new program

This allows the developer to choose a language during the implementation phase that has appropriate features

Example

A mail order application would have the following objects

Orders, Receipts, Customer Details

And operationsAdd new customer, fill out order, create receipt

An event-driven language might be the most appropriate language type to use in this case

Page 13: Software Development Languages and Environments

Example VBA Scripting Code

Page 14: Software Development Languages and Environments

High Level Language Translators - Compiler

Source program

Machine code object program

Errors and

diagnostics

Compiler

Compiler stops

Page 15: Software Development Languages and Environments

High Level Language Translators - Interpreter

Program statement

Machine code

Errors and

diagnostics

InterpreterMachine code instruction performed

Interpreter stops

Page 16: Software Development Languages and Environments

The Translation High Level Languages

Relative Advantages of Interpreters & Compilers

• The main difference between an interpreter and a compiler is that a compiler generates a complete machine code program only once and this program can be saved and run.

• The interpreter on the other hand needs to analyse and interpret the same program statements each time it meets them this can be wasteful when processing a loop.

Page 17: Software Development Languages and Environments

The Translation High Level Languages

Relative Advantages of Interpreters & Compilers

Errors:• When the interpreter encounters an error it reports this to the user

immediately and halts further execution of the program.

Such instant feedback, pinpointing the exact location of the error, helps the programmer to find and remove errors.

This makes the interpreter the preferred translator at the implementation stage

• Compilers, on the other hand, analyse the entire program, taking note of where errors have occurred, and places these in an error/diagnostic file. If errors have occurred then the program cannot run. Programmers must then use the error messages to identify and remove the errors in the source code.

Page 18: Software Development Languages and Environments

The Translation High Level Languages

Relative Advantages of Interpreters & Compilers

Speed:

• An important difference is that interpreters can be 2 to 10 times slower than compilers. One reason for this is that they translate the same statements within a loopover and over again.

Compilers can produce much more efficient object code than interpreters thus making the compiled programs to run faster.

Page 19: Software Development Languages and Environments

The Translation High Level Languages

Relative Advantages of Interpreters & Compilers

Ease of use:

• Interpreters are more suitable for beginners to programming since errors are immediately displayed, corrected by the user, until the program is able to be executed.

• On the whole compilers tend to be more difficult to use.

Page 20: Software Development Languages and Environments

MacrosBenefits of Macros

• Can extend and add new features to a program that the developers didn’t think of

• Can simplify and repeat complex or frequently used commands

• Can be assigned to a keyboard shortcut to make it easier to use when required

Creating a Macro

1. Record a series of actions in an application you are using

2. Code gets generated and saved as a program script

3. Script can then be assigned to a keystroke

Or

1. Write and save the script in an editor

2. Run the script in the application and find and fix any errors

3. Script can then be assigned to a keystroke

Page 21: Software Development Languages and Environments

Example Exam Questions1. Describe two characteristics of a scripting language not commonly found

in a procedural language (2)

2. A program contains the following statement:

Is_a(rover, dog).

State which type of programming language is being used. (1)

3. State two benefits of using a macro to create an alphabetical list of customers whose account balance is over £5000. (2)

4. Macros are written in a high level language. State the type of high level language that is used to write macros. (1)

5. State two features of a declarative programming language (2)

6. State two methods of creating a macro (2)