Docsity

engg1111 computer programming, Study Guides, Projects, Research of Java Programming

Partial preview of the text

Download engg1111 computer programming and more Study Guides, Projects, Research Java Programming in PDF only on Docsity!

Introduction

ENGG1111 E/F Computer Programming and Applications 2017 - 2018 Loretta Choi

What are we going to learn?

  • Why programming? (Why this course?)
  • What is Computer Science?
  • Basic computer concepts
    • What are the basic components in a computer?
    • How does a computer execute a program?
  • A sample C++ program
  • Testing and debugging
  • Program design

What can computing devices do?

  • Tedious tasks
  • Repetitive tasks
  • Dangerous tasks
  • Computers carry out these tasks, but, who tells

them how to do / what to do?

Who should learn programming?

  • Computer scientists / engineers / scientists /

mathematicians … ONLY?

  • Steve Jobs: “Everyone should learn programming…”
  • Take a look at code.org

Programming is FUN!

  • It’s fun and exciting to see your

own ideas actually work

  • Start with a purpose and formulate your

problem

  • leisure / entertainment / services / business
  • Devise your own solution
  • Implement your idea with a program
  • See it works

Applications

  • We use application software (or applications /

apps) everywhere in our daily life

What is Computer Science?

  • From Wikipedia:
    • Computer science is the scientific and practical
approach to computation^ and its applications
  • Theoretical side:
    • How difficult is a problem? What is the least amount
of resources (time / space) needed?
  • Can computers solve all problems efficiently?
  • Take a look at the courses offered by the CS dept
  • http://www.cs.hku.hk/programme/courses-offered.jsp

How to learn programming?

  • Take a course
  • Read books / codes / manuals
  • Write codes, keep practicing
  • Note the behavior/outcomes of different codes
  • Don’t be afraid to make mistakes
  • Be explorative, ask “what if?” and test your ideas
  • Be patient, be persistent
  • Got stuck?
    • Ask questions but be specific “I don’t understand. My program doesn’t work.” vs. “I’m getting this error, what does it mean? how to fix it?”
    • Seek answers from the Web, e.g. Google

From a Problem to a Program

  • Think about the spoken languages Good Morning (^) おはよう 早晨^ Bonjour These are just the syntaxes of specific languages Most importantly, what message do you want to convey? A problem / A task A solution (An algorithm) A computer Problem^ program solving Coding Which method? Which data structure? Which programming language? Which programming construct?

BASIC CONCEPTS Understanding how computer works

Hardware

  • The actual physical parts that

make up a computer.

  • Central Processing Unit (CPU)
    • The “brain” of the computer.
    • Follows instructions in a program.
    • Performs simple tasks like
      • Addition, subtraction, multiplication and division.
      • Move data from one memory location to another. A quad-core i7 CPU

Hardware

  • Main Memory
    • Long list of memory cells.
    • Each memory cell has an address (a number) that gives its position in the memory.
    • Each memory cell consists of 8 binary digits (8 bits = 1 byte).
    • Volatile^ – information will be lost when the computer is switched off. … Address 1 Address 2 Address 3 … 0 0 0 0 0 0 0 1 Main Memory Information is represented as “0”s and “1”s in main memory. A DDR3 RAM

Hardware

  • Input Devices
    • Any device that allows a user to

communicate information with

the computer.

  • Output devices
    • Any device that allows a

computer to communicate

information to the user.

Software

  • Software that are frequently encountered in

programming

  • Operating system
  • Command prompt
  • Editor
  • Compiler and linker
  • IDE (Integrated Development Environment)