lecture 1

Upload: rashid-mehmood

Post on 13-Oct-2015

50 views

Category:

Documents


0 download

DESCRIPTION

Java Introduction

TRANSCRIPT

  • 5/22/2018 Lecture 1

    1/51

    COMP 102x

    Introduction to Computing with Ja

    Lecture One

    T.C. Pong

    Department of Computer Science & Engineerin

    HKUST

    Introducti

  • 5/22/2018 Lecture 1

    2/51

    Learning Objectives

    Take a real-life problem and abstract out th

    aspects necessary to solve it

    Formulate formal solutions to well defined pr

    using the logic of a programming language

  • 5/22/2018 Lecture 1

    3/51

    What is a well defined prob

    A well-defined problem means that

    a solution exists for the problem

    the solution can be found in a finite num

    Examples:

    1 x 2 + 3

    1 + 2 x 3

    = 5

    1 + (2 x 3) = 7

    (1 + 2) x 3 = 9

  • 5/22/2018 Lecture 1

    4/51

    Learning Objectives

    Take a real-life problem and abstract out the p

    aspects necessary to solve it Formulate formal solutions to well defined prob

    the logic of a programming language

    Implement formal solutions using Java in an inte

    development environment Have an understanding of basics of data abstract

    the object-oriented framework

  • 5/22/2018 Lecture 1

    5/51

    Data Abstraction

    Data Abstraction: To separate what can be dothe data from how it is represented.

    For example, numbers can be represented in many

    Arabic numerals:

    0, 1, 2, 3, 4, 5, 6, 7, 8, 9

    Roman numerals:

    I, II, III, IV, V, VI, VII, VIII, IX, X Chinese numerals:

    ,,,,,,,,,,

    Numbers in computers:

    0, 1

  • 5/22/2018 Lecture 1

    6/51

    Computer Science

    Computer Science is a discipline that studies the tand applications of computational systems.

    Computational systems

    Hardware aspect Designing and building computer systems in the fo

    devices that are able to execute programs

    Software aspect Studying the behavior of algorithms or computer p

    determine whether they are correct and efficient

    Application aspect Using computer systems to solve complex real-wor

  • 5/22/2018 Lecture 1

    7/51

    Hardware and Software

    There are two important compone

    the computer.

    Hardware component

    Software component

    h

  • 5/22/2018 Lecture 1

    8/51

    The First Computer

    The worlds first all-purpose elecomputer, ENIAC, was created

    in 1946.

    It weighted over 30 tons, conta

    ~18,000 vacuum tubes and occ

    1800 ft2(or 180 m2) of space.

    This image is from the Wikimedia Commons.

    Source: U.S. Army

    http://commons.wikimedia.org/wiki/Main_Pagehttp://commons.wikimedia.org/wiki/Main_Page
  • 5/22/2018 Lecture 1

    9/51

    Moores Law

    Gordon Moore(1965): The

    processing power

    of computer chip

    doubles

    approximately

    every 18 months.This image is from the Wikimedia Commons. Author: W

    d

    http://commons.wikimedia.org/wiki/Main_Pagehttp://commons.wikimedia.org/wiki/User:Wgsimonhttp://commons.wikimedia.org/wiki/User:Wgsimonhttp://commons.wikimedia.org/wiki/Main_Page
  • 5/22/2018 Lecture 1

    10/51

    Hardware perspective

    ProcessingInput

    devices

    Outp

    devic

    Memory Storage d

    A flowchart illustrates

    the data flow through

    different hardware

    components

    Stored program computer

    C t l P i U it (CPU)

  • 5/22/2018 Lecture 1

    11/51

    Central Processing Unit (CPU)

    The central processing unit (CPU) is the bcomputer

    CPUs may appear anywhere

    Desktop computers, mobile devices such as iPads

    It retrieves instructions from the memoryperforms computation

    It consists of two sub-units:

    Arithmetic logic unit

    Control unit

    Processing

    A ith ti L i U it d C t l U

  • 5/22/2018 Lecture 1

    12/51

    Arithmetic Logic Unit and Control U

    Arithmetic logic unit

    Basic arithmetic operations: + , - , x , /

    Logical comparisons: = , > ,