Programming Languages Notes Software Design & Development: Languages & environments, Low level operations and computer architecture.

Slides:



Advertisements
Similar presentations
What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word processor), it must be given the instructions.
Advertisements

Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language.
Software Development Languages and Environments. Programming languages High level languages are problem orientated contain many English words are easier.
Chapter 3: Modules, Hierarchy Charts, and Documentation
Tuan Tran. What is CISC? CISC stands for Complex Instruction Set Computer. CISC are chips that are easy to program and which make efficient use of memory.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Java.  Java is an object-oriented programming language.  Java is important to us because Android programming uses Java.  However, Java is much more.
Programming Languages Language Design Issues Why study programming languages Language development Software architectures Design goals Attributes of a good.
Introduction to Programming with Java “Object Oriented” Programming Compiling & Running Java Programs.
The Analytical Engine Module 6 Program Translation.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
11/11/05ELEC CISC (Complex Instruction Set Computer) Veeraraghavan Ramamurthy ELEC 6200 Computer Architecture and Design Fall 2005.
SM3121 Software Technology Mark Green School of Creative Media.
SOFTWARE SYSTEMS SOFTWARE APPLICATIONS SOFTWARE PROGRAMMING LANGUAGES.
1 CHAPTER 4 LANGUAGE/SOFTWARE Hardware Hardware is the machine itself and its various individual equipment. It includes all mechanical, electronic.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
Programming Languages – Coding schemes used to write both systems and application software A programming language is an abstraction mechanism. It enables.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
1 Software Development Topic 2 Software Development Languages and Environments.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
High-level Languages.
Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 1 Classification of Languages 1. Procedural.
BIT 1003 – Presentation 7. Contents GENERATIONS OF LANGUAGES COMPILERS AND INTERPRETERS VIRTUAL MACHINES OBJECT-ORIENTED PROGRAMMING SCRIPTING LANGUAGES.
Previously Fetch execute cycle Pipelining and others forms of parallelism Basic architecture This week we going to consider further some of the principles.
CS1Q Computer Systems Lecture 14 Simon Gay. Lecture 14CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.
1 Comp 104: Operating Systems Concepts Java Development and Run-Time Store Organisation.
The Teacher Computing Computer Languages [Computing]
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
PROGRAMMING LANGUAGES
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
A compiler is a computer program that translate written code (source code) into another computer language Associated with high level languages A well.
Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An.
Introduction to OOP CPS235: Introduction.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
The Functions and Purposes of Translators Translators, Interpreters and Compilers - High Level Languages.
CISC. What is it?  CISC - Complex Instruction Set Computer  CISC is a design philosophy that:  1) uses microcode instruction sets  2) uses larger.
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
Week 6 Dr. Muhammad Ayaz Intro. to Assembly Language.
CIS 234: Object-Oriented Programming with Java
Computer Languages [Computing] Computing.
Java Programming: From the Ground Up
The language focusses on ease of use
Component 1.6.
Visit for more Learning Resources
Before You Begin Nahla Abuel-ola /WIT.
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
High and low level languages
Chapter 1 Introduction.
PROGRAMMING LANGUAGES
CSCI-235 Micro-Computer Applications
A Closer Look at Instruction Set Architectures
Microprocessor and Assembly Language
Chapter 1 Introduction.
课程名 编译原理 Compiling Techniques
Application Development Theory
Types of Programming Languages
Teaching Computing to GCSE
Teaching Computing to GCSE
Translators & Facilities of Languages
Computers: Hardware and Software
Central Processing Unit
1.1 The Characteristics of Contemporary Processors, Input, Output and Storage Devices Types of Processors.
Programming Languages
.Net Framework Details Imran Rashid CTO at ManiWeber Technologies.
Principles of Programming Languages
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Reasons To Study Programming Languages
Presentation transcript:

Programming Languages Notes Software Design & Development: Languages & environments, Low level operations and computer architecture

Contents High Level Languages & Low Level Languages High Level Languages & Low Level Languages  Questions Questions Declarative Languages  Questions Questions Object Orientated Languages  Questions Questions Translation – Emulation, Virtual Machines & Mobile Devices Translation – Emulation, Virtual Machines & Mobile Devices  Questions Questions

High Level Languages A High level programming language uses a grammar and syntax that is closer to natural languages like English than to the machine code understood by computers HLLs abstract the architecture of the computer from the programmer. The programmer does not need to think of their program in terms of memory locations, busses and processor registers HLLs are easier to code in as a result, but they need to be translated to something the processor can understand. Additionally the automated translation process can sometimes result in inefficient code LiveCode uses very English-like grammar and syntax

Purposes High level programming languages are designed with specific purposes in mind. Even general purpose HLLs are designed with specific fields of use:  Java – an object orientated general purpose language designed for portability via use of virtual machines  Ada – a strongly typed general purpose language designed to be hard to crash, used for critical systems  LiveCode – a natural language general purpose language, easier for beginners and non programmers to learn  PHP – primarily designed for manipulating data to generate webpages dynamically  Prolog – a declarative language associated with artificial intelligence and expert system creation

Low Level Languages A low level programming language uses instructions that correspond to the processors instruction set and architecture LLLs do not abstract the details of memory locations, registers and similar from the programmer. This makes them harder to program in. However, a low level language program can be optimised directly by the programmer to run faster Machine code and assembly language are examples of low level languages An example of assembly language, with registers being addressed directly

In practice, the difference between high level languages and low level languages is a continuous spectrum rather than one or the other Higher Level Lower Level LiveCode, other natural language languages C family – ability to allocate memory directly Java – virtual machine, type polymorphism and garbage collection Assembly languages – processor instructions, register addressing Machine code – 1s and 0s

Imperative & Procedural Programming Languages In imperative programming languages, the program code is a series of instructions that change the state of the program Most programming languages you have encountered so far are imperative, or have been used imperatively Procedural programming languages are languages that break up programs into subprograms Procedural programming languages offer the advantages of code reuse – the same subprogram can be called multiple times – and ease of reading, design and implementation because they are modular.

Questions – High Level Languages and Low Level Languages Answer questions in full sentences! 1. What is a high level programming language? 2. Give one advantage and one disadvantage of high level programming languages 3. What is a low level programming language 4. Give one advantage and one disadvantage of low level programming languages 5. Explain why the C family of languages is considered lower level than LiveCode, but higher level than machine code 6. What is meant by a procedural programming language 7. Give two benefits of using a procedural programming language 8. Find out about 3 other high level programming languages not listed on the purposes slide. Write a sentence or two about each describing its purposes and characteristics

Declarative Programming Languages Declarative programming languages state rules and definitions to be followed. They are different from imperative languages in that they do not state how to compute things There are a number of different types of declarative languages, including constraint programming, functional programming and logical programming. Logical programming is the type most associated with declarative programming languages. Prolog is a notable example SWISH Prolog is a free online Prolog environment that you can use

Logical Programming - Rules Programs written in a logical programming language are a series of rules and facts about a certain subject. For example, the simplest form of rules in Prolog: woman(alice). This rule states that Alice is a woman. We might have other similar rules for other women in the program too. Rules can also state relationships: mother_of(alice, bob). Which states that Alice is the mother of Bob. We could have similar rules for other mother-child relationships. However, Prolog doesn’t understand the inverse of the relationship in the humans do. We would have to make another rule: child_of(X, Y) :- mother_of(Y, X).

Logical Programming - Variables Variables in logical programming behave differently from those in imperative programming A logical programming variable is not used to store information. It can have potentially any value. The programmed rules constrain the potential values. Variables are used to query the rules. For example, with the following rules: woman(alice). woman(belle). woman(carol). We can make the query: ?- woman(X). X has three values: alice, belle & carol.

Questions – Declarative Languages Answer questions in full sentences! 1. What is meant by the term declarative language? 2. List the types of programming that can be considered declarative 3. In logical programming, what are rules? 4. Explain how logical programming variables are different from imperative programming variables 5. Using SWISH Prolog ( ) find a tutorial online and learn how to use some simple Prologhttp://swish.swi-prolog.org/

Object Orientated Languages Object orientated programming builds on the idea of record data types and procedural programming. Object orientated programs use data structures called objects or classes. Classes contain variables called attributes and procedures called methods. Classes define the way instances of their type behave and object orientated programs are about the interactions between instances of various classes

Inheritance In object orientated languages, a class can inherit from another class. When a class inherits, it automatically includes all the attributes and methods of its parent class. Additional attributes can be added to the child class. For example, the Vehicle class might include noOfWheels as an attribute, and both the Truck and Car class also include that, but the Truck class might also need to include cargoCapacity as an attribute Vehicle CarTruck

A method inherited from a parent class can be overridden by programming a method with the same name in the child class. In this example, if the getNoOfWheels() method is called by Truck instance, it will use the method defined in the Vehicle class. If the checkIfOverSpeedLimit() method is called though, it will ignore the one defined in the vehicle class and use the version defined in the Truck class. Vehicle noOfWheels speed getNoOfWheels checkIfOverSpeedLimit Truck cargoCapacity checkIfOverSpeedLimit

Type Polymorphism Type polymorphism refers to the fact that a variable of a given class can store an instance of that class, or any of its child classes In this example, an array of Vehicles could potentially store vehicles, cars and trucks. What makes type polymorphism particularly useful is that any method calls will use overridden methods of the appropriate child class. Something can be stored as a Vehicle, but still behaves like a Truck! Vehicle CarTruck

Questions – Object Orientated Languages Answer questions in full sentences! 1. What is meant by the an object orientated language? 2. Explain how object orientated methods differ from subprograms in a procedural language 3. In what ways is an object orientated class similar to a record? 4. Explain what is meant by inheritance when talking about an object orientated language. What can classes inherit from their parents? 5. What is meant by overriding when talking about inheritance? 6. Explain why type polymorphism is an advantage for object orientated languages 7. Find a tutorial online and learn how to use some Java – pay particular attention to classes or Ask your teacher to demonstrate how Greenfoot uses inheritance and type polymorphism

Translation Recall that:  Processors operate using machine code – 1s and 0s  High Level Languages use English-like syntax  Programs have to be translated to machine code in order to run on a computer, either by interpreters or compilers In fact, we do not need to translate a high level language program all the way to the native machine code of a computer. It is possible to translate programs to an intermediate state that would require further translation or additional software to run, and there are a number of advantages for doing so

Emulation An emulator is software that is capable of running the machine code of a processor on an entirely different processor Emulators run entirely in software and often include the emulation of other related hardware such as sound and graphic cards. This potentially makes them relatively slow to run programs. This allows programs that could not otherwise be used to be run on a computer. Emulation is particularly useful for running older software on modern computers, especially where the software may no longer be compatible. DOSBox emulates IBM compatible PCs running the DOS operating system

Virtual Machines Virtual machines specify a hardware architecture and bytecode instruction set. However, virtual machines aren’t usually implemented in hardware. Instead they either run as an emulator or translate to native machine code. Because they translate to native machine code, and because the bytecode is much closer to the machine code, virtual machines can run faster than emulators. Virtual machines are very useful for making software portable. Once a virtual machine has been implemented for a specific computer, any number of programs can be compiled to bytecode. 1980s game developers Infocom wrote their games in a virtual machine to make them easier to port to different platforms

Mobile Devices - Architecture Smartphones broadly make use of similar architecture to other computers. However, smartphone processors are usually RISC devices RISC processors make use of a simplified instruction set as compared to desktop PCs. RISC machine codes usually take less processor cycles to execute This means that they are smaller, use less power and generate less heat. RISC processors are ideal for mobile devices where battery life and comfort in your pocket are an issue. However, there are implications for application development

Mobile Devices - Development Mobile devices typically use processors with a drastically different machine code instruction set. Developing applications directly on a mobile device is impractical – touchscreen keyboards are not good for large amounts of typing and the storage space on a phone is relatively small Mobile app development takes place on desktop computers. Emulation is used for the majority of testing the program, enabling the desktop to simulate the phone’s hardware. App Inventor’s emulator allows mobile phone applications to be tested on desktop PCs

Questions – Translation Answer questions in full sentences! 1. Explain why programs need to be translated from HLLs 2. What is meant by emulation? 3. Give one advantage and one disadvantage of using emulation 4. Explain what a virtual machine is? 5. Explain how virtual machines can help make software more portable 6. Give two differences between emulation and a virtual machine. 7. Describe how the machine code instruction set on a mobile device differs from the instruction set on a desktop computer 8. Why are RISC processors usually used on mobile devices 9. How is emulation used to test mobile phone apps?