90 likes | 213 Views
Advanced Higher Computing Based on Heriot-Watt University Scholar Materials. Comparison of OO with other languages. Lesson Objectives. Comparison of OO with Other Languages. Procedural Languages. Main Program. Subprogram A. Subprogram B. Subprogram C.
E N D
Advanced Higher ComputingBased on Heriot-Watt University Scholar Materials Comparison of OO with other languages Alford Academy Business Education and Computing
Lesson Objectives Comparison of OO with Other Languages Alford Academy Business Education and Computing
Procedural Languages Main Program SubprogramA Subprogram B Subprogram C Program is a collection of blocks or modules of code The modules (or procedures) process data (parameters) Procedures have a defined sequence of instructions and these are executed until the program ends Alford Academy Business Education and Computing
Similarities and Differences with OO Object Oriented Procedural Modules are free standing and can be separately compiled 1. Have control structures for iteration and selection Modules are methods that are part of a class Data and code (methods) are not separate and are encapsulated into an object 2. Change values of variables through assignment Data and code are separate 3. Problem specific Alford Academy Business Education and Computing
Declarative Languages With this type of language the computer is treated not as a machine that processes data but as a machine that can perform logic Programmer declares facts and relationships between items planet(saturn,large,900,atmosphere,rings,19). SCHOLAR Page 64 Alford Academy Business Education and Computing
Similarities and Differences with OO Object Oriented Declarative No rigid control structures such as loops, if then else Variables can be reassigned Data structures are dynamic ie only exists at run time 1. Prolog operates on a database – some argue that this is the same with OO where searching is part of the object Instantiation means to create a new object Variables are type free – ie can represent number, string, lists Instantiation is an instruction to give a variable a value Alford Academy Business Education and Computing
Event Driven Languages In event driven environments the user executes what is known as an event procedure such as clicking a mouse or hitting a key to run part of the code They do not have a set sequence of instructions to execute Event driven programming and object oriented programming are inextricable linked to GUI systems Languages such as Java and Visual Basic provide support for event-driven programming through the use of objects, classes and methods Alford Academy Business Education and Computing
Low Level Languages 1. Are machine dependent 2. Are difficult to program and debug 3. Are not compiled or interpreted 4. Demand a large expense of time on the part of the programmer 5. Contain no high level constructs 6. Execute extremely fast 7. Produce lines of code that have a 1:1 relationship with machine instructions Alford Academy Business Education and Computing
Activities • Read Scholar pp61 - 70 • Answer all Review question • Homework – Complete class work Alford Academy Business Education and Computing