Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School 2009 1 Unit 2 Software Development Process Topic 5 Languages.

Slides:



Advertisements
Similar presentations
Software Development Languages and Environments. Programming languages High level languages are problem orientated contain many English words are easier.
Advertisements

Programming Paradigms and languages
The Assembly Language Level
Tutorial 12: Enhancing Excel with Visual Basic for Applications
SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
Computers Are Your Future
Programming Types of Testing.
SDP Languages and Environments. Types of Languages and Environments There are 4 main types of language that you must be able to describe at Higher level.
Computers: Tools for an Information Age
Introduction to a Programming Environment
Russell Taylor Lecturer in Computing & Business Studies.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 1 Program Design
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
Copyright © 2001 by Wiley. All rights reserved. Chapter 1: Introduction to Programming and Visual Basic Computer Operations What is Programming? OOED Programming.
Adding Automated Functionality to Office Applications.
1 CHAPTER 4 LANGUAGE/SOFTWARE Hardware Hardware is the machine itself and its various individual equipment. It includes all mechanical, electronic.
Systems Software Operating Systems.
Unit Six Assignment 1 Chris Boardley.
CS102 Introduction to Computer Programming
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Languages and Environments Higher Computing Unit 2 – Software Development.
Slide 1 System Software Software The term that we use for all the programs and data that we use with a computer system. Two types of software: Program.
1 Software Development Topic 2 Software Development Languages and Environments.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
Learning Objectives Data and Information Six Basic Operations Computer Operations Programs and Programming What is Programming? Types of Languages Levels.
CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 1 Classification of Languages 1. Procedural.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
Discovering Computers 2009 Chapter 13 Programming Languages and Program Development.
Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
I Power Higher Computing Software Development Development Languages and Environments.
Chapter Three The UNIX Editors.
Intermediate 2 Computing Unit 2 - Software Development Topic 2 - Software Development Languages and Environments.
Chapter One An Introduction to Programming and Visual Basic.
Choosing the write programming language for the job. The choice of language may be based on: The experience and expertise of the development team. The.
Intermediate 2 Computing Unit 2 - Software Development.
 Software Development Life Cycle  Software Development Tools  High Level Programming:  Structures  Algorithms  Iteration  Pseudocode  Order of.
JavaScript 101 Introduction to Programming. Topics What is programming? The common elements found in most programming languages Introduction to JavaScript.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Chapter – 8 Software Tools.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Software Design and Development Languages and Environments Computing Science.
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Your Interactive Guide to the Digital World Discovering Computers 2012 Chapter 13 Computer Programs and Programming Languages.
Software Development – Topic 2 Types of Programming Language.
Software Development Languages and Environments. Computer Languages Just as there are many human languages, there are many computer programming languages.
Evolution and History of Programming Languages
CSCI-235 Micro-Computer Applications
Computer Programming.
Chapter One: An Introduction to Programming and Visual Basic
and Program Development
Lecture 8 Programming Paradigm & Languages. Programming Languages The process of telling the computer what to do Also known as coding.
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Presentation transcript:

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Unit 2 Software Development Process Topic 5 Languages and Environments

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages This topic will introduce you to the various types of programming languages that would be available at the implementation phase of the software development process. Classification of Programming Languages Historically programming languages were classified according to whether they were a general purpose language that could be applied to a broad range of situations, or a special purpose language that were designed for specific tasks. Alternatively, high-level languages can be classified according to their structure and purpose. 1. Procedural 2. Declarative 3. Event-driven 4. Scripting

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages - Procedural Languages A procedural programming language tells the computer how to do something, written as an ordered sequence of steps that describe exactly what it must do at each step. These instructions, which form the basis of an algorithm, are followed in sequence by the computer. Three basic constructs are used to define the order of the steps: Sequence (the logical ordering of steps); Selection (eg use of IF/CASE statements to make a decision) Iteration (repeating steps eg For/Next, Repeat/Until, While/Wend loops)

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages - Procedural Languages Both iteration and selection are because they can alter the flow of control of program control constructs execution. Examples of procedural languages are ALGOL, Fortran, Pascal, Basic, C and COBOL. Features of Procedural language:- declare variables stating their type eg real, integer, string, currency define how the data is to be stored (eg single variable/array), has a definitive start and end is problem oriented follows a sequential path has a range of data types available eg single, integer, real, and arrays logical and arithmetic operators are available (AND/OR/NOT) modular to allow top down design parameter passing

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages - Declarative Languages Declarative languages model problem solutions very differently. Programmers specify what the problem is rather than how to solve it. In PROLOG, for example, a program represents knowledge as facts and uses rules to test facts. Facts and rules form the basis of PROLOG programs to represent knowledge that are stored in a database. This database can then undergo querying.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages - Declarative Languages Problem: Suppose we want to find out whether a person drives a fast car. We start by building a set of facts and rules for our knowledge database. Solution: person(judy) ; - this is the fact that Judy is a person person(james) ; - this is the fact that James is a person drives_car(james, ford escort) ; - this is the fact that James drives a Ford Escort drives_car(judy,porsche) ; - this is the fact that Judy drives a Porsche drives_fast_car(X) : - drives_car(X,Y) and Y = “porsche” – this is a rule for X driving a fast car.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages - Declarative Languages In this example we could ask the program to tell us whether Judy drives a fast car by typing the goal: ?drives_fast_car(judy) The result would be YES since the goal is satisfied. If we asked: ?drives_fast_car(james) Then the result would be NO as drives_car(james,Y) would give Y = “ford escort” This would then cause the rule drives_fast_car(james) to fail as Y does not equal “porsche” and the goal is not satisfied. You can see from the code that there is no description of the type of data or its internal representation. There are simply statements of facts and a rule.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages - Declarative Languages In this example we could ask the program to tell us whether Judy drives a fast car by typing the goal: ?drives_fast_car(judy) The result would be YES since the goal is satisfied. If we asked: ?drives_fast_car(james) Then the result would be NO as drives_car(james,Y) would give Y = “ford escort” This would then cause the rule drives_fast_car(james) to fail as Y does not equal “porsche” and the goal is not satisfied. You can see from the code that there is no description of the type of data or its internal representation. There are simply statements of facts and a rule.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages - Declarative Languages Contrast this with a procedural language where the programmer would need to set up a structure to hold the knowledge and predefine its type (string, number etc). Then they would need to describe the steps taken to search the structure in order to answer the query. A declarative language is simplistically described as telling the computer what to do and not how to do it.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages – Event Driven Languages Event driven programming languages have evolved to handle events. Events can include timers, interrupts, loading of files, etc, or can involve mouse clicks, keyboard presses and cursor movements. After each event is handled, nothing happens until the next event occurs. Note that event-driven programs do not have a predefined pathway in the execution of the code; as opposed to procedural programming style, i.e. they have no beginning or end. Graphical user interface programs are typically programmed in an event- driven style using languages such as Visual Basic and Visual C.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages – Event Driven Languages A Scripting language is a style of ’programming’ that produces ASCII text-based scripts, which are usually designed for writing small programs like batch files. Often referred to as ’glue-code’ they are instead, seen as being an enhancement of particular software packages. Examples of present day scripting languages are VBScript, JavaScript, Perl, Python, TCL (Tool Command Language), etc. Applications that provide scripting capability allow the user to extend the functionality of the application by programming a sequence of actions. For example, in Filemaker Pro (a database package) it is possible to write scripts that open and close files, copy data from records or enter a certain database mode such as browse or find.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages – Scripting Languages Benefits Of Scripting Languages One of the main benefits of scripted languages is that they require no compilation. The language is interpreted at run-time so the instructions are executed immediately. Scripting languages also have a simple syntax which, for the user: Makes them easy to learn and use Assumes minimum programming knowledge or experience Allows complex tasks to be performed in relatively few steps Allows simple creation and editing in a variety of text editors

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages – Scripting Languages The Need For Scripting Languages Nowadays scripting languages are becoming more popular due to the emergence of web-based applications. The market for producing dynamic web content is now expanding extremely rapidly such that new scripting languages have been developed to allow users with little or no programming expertise to develop interactive web pages with minimum effort. Also the increases in computer performance over the past few years has promoted a comparable increase in the power and sophistication of scripting languages that, unlike conventional programming languages, can even have certain security features built-in. Downloading web-based content from a remote site to a user’s local machine can include animations, graphics, MP3 audio files, video clips and so on and this is authenticated by the scripting language.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages – Macros Creating A Macro A macro is a way to automate a task that you perform repeatedly or on a regular basis. It is a series of commands and actions that can be stored and run whenever you need to perform the task. Instructions can be simple, such as entering text and formatting it, or complex, like automating tasks that would take several minutes to do manually. Macro contents consist of ASCII text and can be created and edited in any simple text editor. Many programs (like Microsoft Word and Microsoft Excel) can create macros easily. All you have to do is "record" a set of actions as you perform them. For example, you could record opening a new document using a specific template, inserting a header and inserting a name and address and greeting. Each time you "replayed" the macro, it would perform those tasks.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages – Macros Running A Macro A macro can be initiated by: Inserting your name and address on documents Formatting text with specified font and size Accessing websites from a list of ’favourites’ Inserting special symbols or graphics into documents Automate playing of audio CDs while you work on the computer Pressing selected key combination (hot keys) Clicking an icon on the toolbar that has been created for the macro Running the macro from the Tools menu of the application. Example tasks could include:

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Classification of Programming Languages – Macros Questions What is the purpose of a scripting language? Describe two benefits of scripting languages. What is a macro? How do you edit a macro? Describe how a macro is run. Give 5 examples of tasks that macros written in scripting languages are used for.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Translation Methods At the end of the implementation stage, all going well a structured program listing will be produced, complete with internal documentation. This will be thoroughly checked against the design and against the original specification. The high-level code written at this stage is called source code, which must be translated into machine code, called object code that the computer understands. There are two methods of translating source code into object code; a compiler and an interpreter.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Translation Methods A compiler, which is a complex program in itself, translates source code into object code that is then loaded into main memory and executed.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Translation Methods A compiler, which is a complex program in itself, translates source code into object code that is then loaded into main memory and executed. Compilation is broken down into several logical phases: 1. Lexical analysis 2. Syntax analysis 3. Semantic analysis

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Translation Methods An Interpreter Unlike a compiler, an interpreter checks syntax and generates object code one source line at a time. Think of this as very similar to a group of translators at a United Nations’ Conference, who each have to convert sentences spoken by delegates into the native language of their representative.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Translation Methods When an error is encountered, the interpreter immediately feeds back information on the type of error and stops interpreting the code. This allows the programmer to see instantly the nature of the error and where it has occurred. He or she can then make the necessary changes to the source code and have it re-interpreted. As the interpreter executes each line of code at a time the programmer is able to see the results of their programs immediately, which can also help with debugging.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Translation Methods Advantages The main difference between an interpreter and a compiler is that compilation requires analysis and the generation of machine code only once, whereas an interpreter may need to analyse and interpret the same program statements each time it meets them, e.g. instructions appearing within a loop. For example the following Visual Basic code would be interpreted each time the loop is entered:

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Translation Methods Errors This has implications for error reporting. For instance, 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. 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.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Translation Methods Speed Another 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 loop over and over again. Compilers can produce much more efficient object code than interpreters thus making the compiled programs to run faster. Ease of use Interpreters however are more suitable for beginners to programming since errors are immediately displayed, corrected by the user, until the program can be executed. On the whole compilers tend to be more difficult to use.

Computing Higher – SD Unit - Topic 5 – Languages and Environments P Lynch, St Andrew’s High School Translation Methods Questions 1.Describe the translation process. 2.Describe how a compiler works. 3.Describe how an interpreter works. 4.Describe the main difference between a compiler and an interpreter. 5.Compare a compiler and interpreter in terms of; a)Error finding; b)Speed; c)Ease of Use.