Lecture Slide 1 Introduction

Embed Size (px)

Citation preview

  • 7/28/2019 Lecture Slide 1 Introduction

    1/19

    Module

    Fundamentals of ProgrammingInstructor: Fred. Yeboah

    Email:[email protected]

  • 7/28/2019 Lecture Slide 1 Introduction

    2/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 2

    Course Objectives

    Understand basics of programming

    Analyse problem

    Design solution algorithms using flow chart andpseudo-code

    Prove correctness of developed algorithms

  • 7/28/2019 Lecture Slide 1 Introduction

    3/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 3

    Session 1What is programming ?

  • 7/28/2019 Lecture Slide 1 Introduction

    4/19@2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 4

    What is programming?

    is the act of writing instructions using a

    particular programming technology or languagefor a computing device to execute them

    Note: for any special computing device to provide a

    functionality to its user implies a program has beenwritten by someone for that device.

    Think of the following computing devices:

    mobile phones, personal computers, servers, calculators,scientific calculators, etc...

  • 7/28/2019 Lecture Slide 1 Introduction

    5/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 5

    What you need to know

    Computing devices do what we tell them to do

    and NOT what we want them to do!

    Computing devices do not have the capacity to

    think and make judgment on their own

    Computing devices have different capacity in

    terms of volume of instructions to execute andspace to store information or data

  • 7/28/2019 Lecture Slide 1 Introduction

    6/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 6

    What is a programming language?

    A programming language gives the programmer

    the ability to express him / her intention bywriting them as instructions for the computingdevice.

    Its also referred to asprogramming technology

    Programming languages are synonymous towritten languages. Think of this:

    C programming (C) - French

    Java programming - English

    Visual Basic (V.B) - German

    Note: they all have rules & sentence structure

  • 7/28/2019 Lecture Slide 1 Introduction

    7/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 7

    Types of programming languages

    Programming languages allow programmers to

    code software.

    The three major families of languages are:

    Machine languages

    Assembly languages

    High-Level languages

  • 7/28/2019 Lecture Slide 1 Introduction

    8/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 8

    Machine Languages

    Comprised of 1s and 0s

    The native language of a computer

    Difficult to program one misplaced 1 or 0 will

    cause the program to fail.

    Example of code:

    1110100010101 111010101110

    10111010110100 10100011110111

  • 7/28/2019 Lecture Slide 1 Introduction

    9/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 9

    Assembly Languages

    Assembly languages are a step towards easier

    programming. Assembly languages comprised of a set of

    elemental commands which are tied to aspecific processor.

    Assembly language code needs to betranslated to machine language before thecomputer processes it.

    Example:

    ADD 1001010, 1011010

  • 7/28/2019 Lecture Slide 1 Introduction

    10/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 10

    High_level Languages

    High-level languages represent a giant leap

    towards easier programming.

    The syntax of HL languages is similar toEnglish.

    Historically, we divide HL languages into twogroups:

    Procedural languages

    Object-Oriented languages (OOP)

  • 7/28/2019 Lecture Slide 1 Introduction

    11/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 11

    Compiling / Interpretation

    Regardless of the HL Language

    all HL programs need to be translated to machine

    code so that a computer can process the program.

    Some programs are translated using a compiler.During compilation all source code are translated all

    at once.

    Some programs are translated using an interpreter.Such programs are translated line-by-line instead of allat once (like compiled programs).

  • 7/28/2019 Lecture Slide 1 Introduction

    12/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 12

    Examples of the syntax

    Written languages

    English : I love you

    German: ich libe dish

    French : Je t'aime

    Programming languages

    Java : System.out.println(Hello, World);

    C : printf(Hello, World ); VB : PRINT "Hello, World"

  • 7/28/2019 Lecture Slide 1 Introduction

    13/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 13

    Some programming technologies

  • 7/28/2019 Lecture Slide 1 Introduction

    14/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 14

    Interacting with a computing device

    Speakerencodes

    information

    Listener

    decodes

    information

    Listener returns

    feedback to speaker

    Communication cycle

    One complete unit ofcommunication includes:

    An idea to be sent.

    An encoder.

    A sender.

    A medium.

    A receiver.

    A decoder.

    A response.

  • 7/28/2019 Lecture Slide 1 Introduction

    15/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 15

    Interacting with a computing device (2)

    Substituting a

    computer for one ofthe people in thecommunicationprocess.

    Process is basicallythe same.

    Response may be

    symbols on themonitor.

    User

    encodesinformation Computer decodes

    information

    Computerreturns results

    to user

  • 7/28/2019 Lecture Slide 1 Introduction

    16/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 16

    Where do they differ?

    While communication between individuals use the

    same language, computing devices and individuals donot.

    The following areas are where they differ

    Semantics

    Syntax

    S i f i

  • 7/28/2019 Lecture Slide 1 Introduction

    17/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 17

    Semantics: Refer to meaning

    Human language:

    Refers to the meaning ofwhat is being said.

    Words often pick up multiplemeanings.

    Phrases sometimes haveidiomatic meanings:

    let sleeping dogs lie

    Computer language:

    Refers to the specificcommand you wish thecomputer to perform.

    Input, Output, Print

    Each command has avery specific meaning.

    Computers associate onemeaning with onecomputer command.

    S R f f

  • 7/28/2019 Lecture Slide 1 Introduction

    18/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 18

    Syntax: Refers to form or structure

    Human language: Refers to rules

    governing grammaticalstructure.

    Pluralization, tense,agreement of subjectand verb,pronunciation, andgender.

    Computer language: Refers to rules governing

    exact spelling andpunctuation, plus:

    Formatting, repetition,

    subdivision of tasks,identification of variables,definition of memoryspaces.

    S t R f t f t t (2)

  • 7/28/2019 Lecture Slide 1 Introduction

    19/19

    @2011 AITI-KACE All Rights Reserved - Fundamentals of Programming 19

    Syntax: Refers to form or structure (2)

    Human language: Humans tolerate the

    use of language.

    How many ways can

    you say no? Do theyhave the samemeaning?

    Computer language: Computers do not

    tolerate syntax errors.