Structures. Procedural (Imperative) Languages Procedural languages work on the basis of explicitly telling the computer ‘how to do something’; by using.

Slides:



Advertisements
Similar presentations
1 VBScript Session What we learn last session?
Advertisements

Bellwork If you roll a die, what is the probability that you roll a 2 or an odd number? P(2 or odd) 2. Is this an example of mutually exclusive, overlapping,
1 Knowledge Representation Introduction KR and Logic.
1 Classes and Objects in Java Basics of Classes in Java.
© 2005 by Prentice Hall Appendix 3 Object-Oriented Analysis and Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George.
Chapter 6 Structures and Classes. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 6-2 Learning Objectives Structures Structure types Structures.
Classes, Exceptions, Collections, and Scrollable Controls
Credit hours: 4 Contact hours: 50 (30 Theory, 20 Lab) Prerequisite: TB143 Introduction to Personal Computers.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
0 - 0.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
CS4026 Formal Models of Computation Part II The Logic Model Lecture 1 – Programming in Logic.
SQL: The Query Language Part 2
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design 1.
Configuration management
Chapter 11: Models of Computation
ABC Technology Project
Access Lesson 13 Programming in Access Microsoft Office 2010 Advanced Cable / Morrison 1.
Creating Tables. 2 home back first prev next last What Will I Learn? List and provide an example of each of the number, character, and date data types.
By Waqas Over the many years the people have studied software-development approaches to figure out which approaches are quickest, cheapest, most.
© S Haughton more than 3?
5.9 + = 10 a)3.6 b)4.1 c)5.3 Question 1: Good Answer!! Well Done!! = 10 Question 1:
User Defined Functions
Twenty Questions Subject: Twenty Questions
Linking Verb? Action Verb or. Question 1 Define the term: action verb.
Alford Academy Business Education and Computing1 Advanced Higher Computing Based on Heriot-Watt University Scholar Materials Comparison of OO with other.
Problem Solving and Algorithm Design
Lecture 6: Software Design (Part I)
Introduction to Databases
Past Tense Probe. Past Tense Probe Past Tense Probe – Practice 1.
This, that, these, those Number your paper from 1-10.
CS101: Introduction to Computer programming
Project 6: Working with If Statements Essentials for Design JavaScript Level One Michael Brooks.
Event 4: Mental Math 7th/8th grade Math Meet ‘11.
Addition 1’s to 20.
25 seconds left…...
Test B, 100 Subtraction Facts
11 = This is the fact family. You say: 8+3=11 and 3+8=11
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 15 Programming and Languages: Telling the Computer What to Do.
Week 1.
Chapter 9 Interactive Multimedia Authoring with Flash Introduction to Programming 1.
Chapter 11 Describing Process Specifications and Structured Decisions
Chapter 13 – Introduction to Classes
Introduction to Recursion and Recursive Algorithms
CS 1 Introduction CS 1 Part 11. Hardware 1.Central Processing Unit (CPU) 2.Main Memory 3.Secondary Memory / Storage 4.Input Devices 5.Output Devices CS.
Software Development Languages and Environments. Programming languages High level languages are problem orientated contain many English words are easier.
1. An Overview of Prolog.
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
Python quick start guide
Chapter 9 High-Level Programming Languages: C++. Chapter Goals Describe the expectations of high level languages Distinguish between functional design.
Object Oriented Software Development
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
Programming Paradigms
AS Computing Introduction to Programming. What is a Computer Program? A list of instructions that a computer must work through, in a logical sequence,
Jigar Gaglani.  Programming paradigm is a fundamental style of computer programming  Paradigms differ in concepts and abstractions used to represent.
I Power Higher Computing Software Development Development Languages and Environments.
Programming Models/ Paradigms Chapter 5: Programming Languages.
Logic Programming Logic programming Candidates should be familiar with the concept of logic programming for declaring logical relationships.
Software Design and Development Languages and Environments Computing Science.
OCR A Level F453: High level languages Programming techniques a. identify a variety of programming paradigms (low-level, object- oriented,
Programming paradigms
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
High and low level languages
Computer Programming.
Presentation transcript:

Structures

Procedural (Imperative) Languages Procedural languages work on the basis of explicitly telling the computer ‘how to do something’; by using a sequence of commands called imperatives (as in English grammatical form of the imperative; do this, then do that,... etc)

Declarative Languages Declarative languages adopt a totally different programming approach, of which Prolog (Programming in Logic) is the best known example Declarative languages work on the basis of telling the computer ‘what to do’ rather than how to do it (as procedural languages do) – The programmer defines the facts and rules. – These facts and rules are then queried to see whether TRUE or FALSE

A Declarative Example 1age (edward 20) 2age (robert 19) 3age (flora 17) 4age (emma 17) 5age (andrew 16) 6minimum_age (motor_cycle 16) 7minimum_age (car 17) 8minimum_age (heavy_goods_vehicle 20) 9passed_test (edward heavy_good_vehicle) 10passed_test (andrew motor_cycle) 11passed_test (emma car) 12has_provisional_licence (andrew) 13has_provisional_licence (robert) 14permitted_to_drive (X V) If passed_test (X V) 15 permitted_to_drive (X V) If has_provisional_licence (X) And age (X A) And minimum_age (V L) And A>=L statements 1 to 13 are facts statements 14 and 15 are rules ? permitted_to_drive (flora car) the program uses rule 14 the answer to which is no. The program then examines rule 15 and having scanned the facts returns the answer ‘No’ to the user ? permitted_to_drive (robert motor_cycle) using rule 15 and facts 2, 6 and 13, the program returns ‘Yes’ ? permitted_to_drive (emma V) using rule 14 and fact 11 the program returns ‘car’ queries

Declarative Example - Key features The program statement consist of a number of facts and rules about a particular subject Program statements may be written in any sequence, making it easy to add new facts and rules Executing the program involves stating a goal to be achieved and allowing PROLOG to determine whether the goal can be achieved with the given facts and rules The route through the program does not have to be explicitly stated by the programmer. If one route fails to achieve the goal, the program has the ability to backtrack and try another route until either the goal is achieved or there are no further route to try

Object-Oriented (Object-Event) Languages Object-oriented programming (OOP) -sometime called object-event programming- is probably the most important recent development in programming. OOP provides a third distinctive approach to programming is quite different from either the procedural or the declarative ones. OOP is separate objects (algorithms) running together with their own data and logic OOP is based on defining attributes and behaviours(this could be a piece of code or even an item such as a lamp) and there characteristics much like we do in the real world.

Object-Oriented (Object-Event) Languages In chemistry this is the norm. We find a metal and we assign it attributes and behaviour e.g. size, is it a conductor etc.. OOP has two key fundamental parts Classes and Objects

Classes A class is a blue print for and object to fit into It is not the object itself A definition of Properties (Attributes) and Methods(behaviours ) AttributeBehaviour Sizesleep agewalk Genderjump

Objects Objects is created from a class It can have one to many relationship (you can make many items from one class)

One last thing… Don’t forget that OOP is standalone classes (Methods and Properties) that can make objects. This is called Encapsulation. Methods Properties