CS2173 Lecture 1 - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

CS2173 Lecture 1

Description:

Generating machine language from source code is accomplished in a process called ... There are two basic types of translation. One is done at the time the ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 13
Provided by: jasonc79
Category:
Tags: cs2173 | lecture

less

Transcript and Presenter's Notes

Title: CS2173 Lecture 1


1
CS2173Lecture 1
  • Getting Started An Introduction
    toIntroduction to Programming

2
A computer is a machine. It requires directions
(control) to operate. Programs provide this
control. computer program a structured
combination of data and instructions that
operate a computer. Also called
software. programming the process of writing a
computer program in a language that the computer
can respond to and that other programmers can
understand
3
programming language the set of instructions,
data, and rules that can be used to construct a
computer program High-Level VS. Low-Level
Languages High-Level Languages are designed to
be easily human-readable. They tend to look
like English. Low-Level Languages are
instructions that are directly tied to one type
of computer. Examples High-Level Java, C,
Pascal, FORTH, PHP, Low-Level Assembly
Language
4
Diagram of a Basic Computer Program Procedure
-oriented language A program is a series of sets
of instructions (procedures) that are
individually concerned with producing a result
from a set of inputs.
5
Object-oriented language Deals with objects
things that have both attributes (color, size),
and actions (methods) associated with
them. Java is an object-orientedlanguage. It
is also designed to be cross-platform
compatible (see figure)
6
  • Algorithms and Methods
  • Algorithm
  • a step-by-step sequence of events (or
    instructions) that describes how the data are to
    be processed to produce the desired result (or
    side-effect).
  • a very precise and specific plan
  • When we implement an algorithm in Java, we create
    something called a method. Other languages refer
    to methods as functions or procedures.

7
Before we write a program, we must create a plan
detailing what the program is going to do
(algorithm). We tend to express these algorithms
in a written form called pseudocode. Pseudocode
a set of English-like statements not tied to
any specific programming language that are used
to describe an algorithm or program The most
important thing about pseudocode is that it
should make sense to you. You should then be
able to easily translate from the pseudocode plan
to an actual program written in a high-level
language.
8
Classes and Objects Class a single unit that
defines both the data that will be used and the
operations that can be performed on the data.
Object (formal definition) a specific instance
of a class, or a specific item from a
class. So, a class defines all the common traits
for a group of objects, while an object itself is
one unique item from a class.
9
Example The term rectangle applies to a class
of objects having four sides where the opposite
sides are equal in length and whose adjacent
sides are perpendicular. A specific rectangle,
well call it r1, is shown to the right.r1 is
a rectangle object. It isthe rectangle that
measures 2X3. The 2 and 3 (dimensions) of the
rectangle are attributes. Methods may also be
provided For a rectangle we might provide
methods for finding area or perimeter.
10
When we want to use a class method, say f, on a
specific object, we say we call that objects f
method. We do so by using the dot
notation r1.findPerimeter() The line above
would tell a specific rectangle named r1 to find
its perimeter using the findPerimeter class
method. If we had needed any additional
information (besides what r1 already knows about
itself), we would put it in the
parentheses.Think of this like a sentence. The
thing to the left of the dot is the subject (the
who), and the thing to the right of the dot is
the verb (the what).
11
Before we run a program, it must be translated
into a language the computer can understand
(machine language). Generating machine language
from source code is accomplished in a process
called translation. There are two basic types
of translation.One is done at the time the
program is being run. This is called
interpretation.The other is done when the
programmer finishes the program, but before
running. This is called compilation.
12
Interpreted VS. Compiled languages Compiling
the process of translating a file containing a
compiled language to a file containing machine
code. Done before run-time. Interpreting the
process of translating a file containing an
interpreted language to machine code at
run- time. No machine-language file is
created. Java does it differently
Write a Comment
User Comments (0)
About PowerShow.com