Presentation is loading. Please wait.

Presentation is loading. Please wait.

OCR A Level F453: 3.3.6 High level languages 3.3.7 Programming techniques a. identify a variety of programming paradigms (low-level, object- oriented,

Similar presentations


Presentation on theme: "OCR A Level F453: 3.3.6 High level languages 3.3.7 Programming techniques a. identify a variety of programming paradigms (low-level, object- oriented,"— Presentation transcript:

1 OCR A Level F453: 3.3.6 High level languages 3.3.7 Programming techniques a. identify a variety of programming paradigms (low-level, object- oriented, declarative and procedural); b. explain with examples the terms object oriented, declarative and procedural as applied to high-level languages, showing an understanding of typical uses. c. discuss the concepts and, using examples, show an understanding of data encapsulation, classes and derived classes, and inheritance when referring to object-oriented languages; d. understand the purpose of the Unified Modelling Language (UML); e. interpret class, object, use case, state, sequence, activity and communication diagrams; f. create class, object, use case and communication diagrams; g. discuss the concepts and, using examples, show an understanding of backtracking, instantiation, predicate logic and satisfying goals when referring to declarative languages.

2 a. identify a variety of programming paradigms (low- level, object-oriented, declarative and procedural); b. explain with examples the terms object oriented, declarative and procedural as applied to high-level languages, showing an understanding of typical uses. g. discuss the concepts and, using examples, show an understanding of backtracking, instantiation, predicate logic and satisfying goals when referring to declarative languages. OCR A Level F453: 3.3.6 High level languages

3 Low level languages Binary & machine code are low level languages, languages that the computer can understand without with translation. Whether assembly language is low level or high level depends on which book you read\ past paper you look at. Most of the time the OCR say that assembly language is a high level language. OCR A Level F453: 3.3.6 High level languages

4 Procedural languages All the languages you have looked at so far (Python, Java script etc) are procedural languages. They describe exactly the sequence of steps required to solve a problem using sequence, selection and iteration. They also use subroutines (functions & procedures). They are sometimes called imperative languages OCR A Level F453: 3.3.6 High level languages

5 Declarative languages A declarative program consists of a number of facts and rules about a given subject. Statements can be in any order (so it is easy to add new facts and rules). Executing a program means stating a goal that needs to be achieved. Declarative languages state what is required. student (James) student (Sarah) student (Katie) teacher (Mr Smith) teaches(a, b) if teacher(a) and student(b) Facts Rule OCR A Level F453: 3.3.6 High level languages

6 Declarative languages student (James) student (Sarah) student (Katie) teacher (Mr Smith) teaches(a, b) if teacher(a) and student(b) Users then set their goal and receive their answer. teaches(James, Katie)? Would be FALSE student(Sarah)? Would be TRUE OCR A Level F453: 3.3.6 High level languages

7 Backtracking: After finding a solution to a goal you go back and follow an alternative path to try and find another solution. Instantiation: Giving a variable a value Student(James) Predicate logic: A mathematical proof that asserts whether a given statement is TRUE or FALSE. Satisfying goals: The process of finding the answer to a goal in a declarative language. Declarative languages: Key terms OCR A Level F453: 3.3.6 High level languages

8 Object Orientated languages Object Oriented languages (C++ and Java) treat all items as classes. For example a Car program might include wheel, door and engine classes. Classes contain attributes and methods. So a wheel object might have the attributes radius, colour, circumference and the method turn(). OCR A Level F453: 3.3.6 High level languages

9 Objects Objects are instances of Classes. So you might have a Wheel class with the attributes and methods of all wheels. Then a front_wheel object and a back_wheel object. Both these inherit the characteristics of a wheel but can implement them in different ways. OCR A Level F453: 3.3.6 High level languages

10 Object Orientated languages Wheel class: Attributes: Methods: radius: Turn() colour: circumference: front_wheel object: Attributes: radius: 50cm colour: Black circumference: 314 cm Methods: Turn() back_wheel object: Attributes: radius: 100cm colour: Black circumference: 628 cm Methods: Turn() OCR A Level F453: 3.3.6 High level languages

11 c. discuss the concepts and, using examples, show an understanding of data encapsulation, classes and derived classes, and inheritance when referring to object-oriented languages; OCR A Level F453: 3.3.6 High level languages

12 Object Oriented concepts Class: Describes shared attributes and methods. It acts as a template for objects which inherit attributes and methods from the class. Superclass: A class from which other classes inherit characteristics. For example a vehicle class could be a superclass of the car class. Derived classes: A class which inherits methods and attributes from a superclass. For example a car class could be derived from a vehicle class. Inheritance: Occurs when an object or class has it’s own attributes and methods as well as those from it’s superclass. Encapsulation: Means that the data in objects can only be accessed via methods from that object. OCR A Level F453: 3.3.6 High level languages

13 d. understand the purpose of the Unified Modelling Language (UML); OCR A Level F453: 3.3.6 High level languages

14 UML is a diagrammatic way of describing an Object Orientated program (OO). UML diagrams always represent classes in this format This is an example UML diagram showing a Vehicle class. Unified Modelling Language (UML) Class name List of attributes List of Methods Vehicle strColour: String intWheels: Integer funcGetWheels() funcMove() OCR A Level F453: 3.3.6 High level languages

15 Unified Modelling Language (UML) Person strAddress: String funcGetAddress() Student intStudentID: Integer strStuName: String funcDisplayStu() Teacher intStaffID: Integer intPay: Integer funcFindPay() Superclass Derived class OCR A Level F453: 3.3.6 High level languages

16 e. interpret class, object, use case, state, sequence, activity and communication diagrams; f. create class, object, use case and communication diagrams; OCR A Level F453: 3.3.6 High level languages

17 Class diagram: The same as a UML diagram OCR A Level F453: 3.3.6 High level languages

18 An object is an instance of a class (front_wheel). Objects can be represented as a diagram using Object Diagrams. There are just two symbols you need to know. Anonymous Objects Objects Object Diagrams :PersonChild fltHeight = 150 intAge = 14 strToy = Bear OCR A Level F453: 3.3.6 High level languages

19 Have almost nothing to do with high-level programming. But are really useful for creating & designing databases. They show the functionality of a system rather than how things should be done. Use Case Diagrams System Employs Executive Worker OCR A Level F453: 3.3.6 High level languages

20 Systems have users; in a UCD users are called actors. Actors are represented by stick figures, UCD has two types of Actor: Initiating actor (ie Executive) Receiving actor (ie Worker) Actions are represented on the UCD by an oval. Actors are linked to actions by lines called association lines. These show which actions are associated with which actors. Use Case Diagrams OCR A Level F453: 3.3.6 High level languages

21 State diagrams are used to describe how an object should behave. Diagrams start with a black circle (called the entry point) to represent the initial state of the system. Arrows show the transition between different states of the system. The last symbol in the diagram is a white circle with a spot in it (called the exit point). State diagrams OCR A Level F453: 3.3.6 High level languages

22 ●The first circle is the entry point ●The arrows show the transition between states ●States are represented by rounded rectangles (Doing homework, playing a game). ●The trigger that changes the state is ‘Friend arrives’ ●The circle with a dot shows the exit point. State diagram: States of a student Doing homework Playing a game Friend arrives OCR A Level F453: 3.3.6 High level languages

23 Sequence diagrams show how objects interact with each other over time. Each object has a dotted timeline underneath it. Boxes appear on the timeline whenever the object is doing something. Sequence diagrams :user:powerButton:computer funcButtonPress() funcTurnOn() funcPowerOn() funcPowerLightOn() funcPowerOn() OCR A Level F453: 3.3.6 High level languages

24 Activity diagrams are just flowcharts with different symbols. Activity diagrams Start Activity Input Horizontal line: used when lots of things happen at once. End Decision Output OCR A Level F453: 3.3.6 High level languages

25 Activity diagrams are just flowcharts with different symbols. Activity diagrams Go to lesson Make notes Leave Is the teacher in? Read Yes No OCR A Level F453: 3.3.6 High level languages

26 Communication diagrams are used to show how different objects work together to carry out a task. Each object is represented by a rectangle. Objects are joined by arrows which show which direction information flows. These arrows are labeled to show the methods used and the order in which they occur in the communication. Communication diagrams :Secretary :Head of department :Student :Teacher 1: getReport() 2: getData() 3: getGrade() 4: sendGrade() 5:sendData() 6:sendReport() OCR A Level F453: 3.3.6 High level languages


Download ppt "OCR A Level F453: 3.3.6 High level languages 3.3.7 Programming techniques a. identify a variety of programming paradigms (low-level, object- oriented,"

Similar presentations


Ads by Google