Академический Документы
Профессиональный Документы
Культура Документы
APPLIED
ARTS
OF TRINIDAD & TOBAGO
BUSINESS & INFORMATION TECHNOLOGY DIVISION
ITEC133
Programming 1
Lecture Note 1
Kadeem Best
Table of Contents
An Overview of a Computer ...................................................................................................... 1
What is a computer?............................................................................................................... 1
Hardware ................................................................................................................................ 1
Computer Organization ...................................................................................................... 1
Software ................................................................................................................................. 2
Operating Systems(O.S) .............................................................................................. 2
Application Programs .................................................................................................. 3
Programming Fundamentals ...................................................................................................... 3
What is programming? ........................................................................................................... 3
Programming Languages ....................................................................................................... 3
What is a programming Language? ................................................................................... 3
Generations of Programming Languages........................................................................... 3
Types of Programming Languages .................................................................................... 4
Steps in Developing Programs ............................................................................................... 4
1.
Define the problem .................................................................................................. 4
2.
Analyze the problem ................................................................................................ 4
3.
Develop the solution (Develop an Algorithm) ........................................................ 5
4.
Code the solution(Algorithm) into a Programming Language ................................ 5
5.
Compile and Run the Program ................................................................................ 5
Algorithm ............................................................................................................................... 5
Pseudocode ............................................................................................................................ 5
Trace Tables ........................................................................................................................... 5
Overview of Java ....................................................................................................................... 6
What is Java ........................................................................................................................... 6
History of Java ....................................................................................................................... 6
Typical Java Development Environment ............................................................................... 6
An overview of the software development process. .......................................................... 7
The Java Platform .................................................................................................................. 7
Java Editions .......................................................................................................................... 8
The Java Runtime .................................................................................................................. 8
The Java Development Kit..................................................................................................... 9
Introduction to Object Oriented Concepts ................................................................................. 9
Objects ................................................................................................................................... 9
What Is an Object? ............................................................................................................. 9
Classes.............................................................................................................................. 10
An Overview of a Computer
What is a computer?
A computer is an electronic device capable of performing computations and making
logical decisions at speeds millions (even billions) of times faster than human beings
can. It has the ability to store, retrieve, and process data. You can use a computer to
type documents, send email, and browse the internet. You can also use it to handle
spreadsheets, accounting, database management, presentations, games, and more.
A computer can be divided into two main parts: hardware and software.
Hardware
Hardware is any part of your computer that has a physical structure, such as the
computer monitor or keyboard.
Computer Organization
Regardless of differences in physical appearance, virtually every computer may be
envisioned as divided into six logical units or sections:
Input Unit
This is the receiving section of the computer. It obtains information (data and
computer programs) from input devices (Input devices accept data in a form
that the computer can utilize) and places this information at the disposal of
other units so that it can be processed. Most information is entered into
computer through keyboards and mouse devices. However, Information can
also be entered in many ways, including by speaking to your computer, by
scanning images etc.
Output Unit
This is the shipping section of the computer. It takes information that the
computer has processed and places it on various output devices to make the
information available for use outside the computer. Most information output
from computers today is displayed on screens, printed on paper etc.
Memory Unit
This is the rapid-access, relatively low-capacity warehouse section of
computer. It retains information that has been entered through the input unit,
1
Software
Software is any set of instructions that tells the hardware what to do. It is what
guides the hardware and tells it how to accomplish each task. Some examples of
software are web browsers, games, and word processors such as Microsoft Word.
Software can be broken down into : Operating Systems, Application Programs.
Operating Systems(O.S)
An operating system is the most important software that runs on a computer.
It manages the computers memory, processes, and all of its software and
hardware. Examples of Operating Systems include: - Windows Vista,
Windows XP , Windows 7 and Mac OS.
2
Application Programs
Application Programs are designed to perform a specific function directly for
the user or, in some cases, for another application program. Examples of
application programs include word processors; database programs; Web
browsers; development tools; drawing, paint, and image editing programs;
and communication programs
Programming Fundamentals
What is programming?
Programming is instructing a computer to do something for you with the help of a
programming language
Programming Languages
What is a programming Language?
An artificial language used to write instructions that can be translated into machine
language and then executed by a computer.
Some programming languages include :- formula translation (FORTRAN), C, C++,
PASCAL, BASIC, Java
These languages therefore, had syntax that was much easier to understand. Third
generation languages are known as "high level languages" and include C, C++,
Java, and Javascript, among others.
Procedural
Procedural languages execute a sequence of statements that lead to a result.
In essence, a procedural language expresses the procedure to be followed to
solve a problem. Procedural languages typically use many variables and have
heavy use of loops and other elements of "state", which distinguishes them
from functional programming languages. Functions in procedural languages
may modify variables or have other side effects (e.g., printing out information)
other than the value that the function returns.
Object-oriented
Object-oriented programming views the world as a collection of objects that
have internal data and external means of accessing parts of that data. The
goal of object-oriented programming is to think about the problem by dividing
it into a collection of objects that provide services that can be used to solve a
particular problem.
Algorithm
An Algorithm is a set of step by step instructions if followed faithfully should give a
solution to a problem.
Pseudocode
Pseudocode is a structured way of expressing an algorithm. It uses the structural
conventions of a programming language, but is intended for human reading rather
than machine reading
Trace Tables
A trace table is a technique used to test algorithms, in order to make sure that no
logical errors occur whilst the algorithm is being processed. The table usually takes
the form of a multi-column, multi-row table; With each column showing a variable,
and each row showing each number input into the algorithm and the subsequent
values of the variables.
Overview of Java
What is Java
Java technology is both a programming language and a platform.
Simple
Object oriented
Distributed
Multithreaded
Dynamic
Architecture neutral
Portable
High performance
Robust
Secure
History of Java
The Java programming language is designed to meet the challenges of application
development in the context of heterogeneous, network-wide distributed
environments. Paramount among these challenges is secure delivery of applications
that consume the minimum of system resources, can run on any hardware and
software platform, and can be extended dynamically.
The Java programming language originated as part of a research project to develop
advanced software for a wide variety of network devices and embedded systems.
The goal was to develop a small, reliable, portable, distributed, real-time operating
platform. When the project started, C++ was the language of choice. But over time
the difficulties encountered with C++ grew to the point where the problems could
best be addressed by creating an entirely new language platform. Design and
architecture decisions drew from a variety of languages such as Eiffel, SmallTalk,
Objective C, and Cedar/Mesa. The result is a language platform that has proven
ideal for developing secure, distributed, network-based end-user applications in
environments ranging from network-embedded devices to the World-Wide Web and
the desktop.
The API is a large collection of ready-made software components that provide many
useful capabilities. It is grouped into libraries of related classes and interfaces; these
libraries are known as packages.
Java Editions
The Java platform editions contain additional Java APIs for creating different types of
applications: Java comes in 3 main editions:
Java 2 Standard Edition (J2SE) - Designed to run on desktop and
workstations computers.
Java 2 Enterprise Edition (J2EE)=- With built-in support for Servlets, JSP, and
XML, this edition is aimed at server-based applications.
Java 2 Micro Edition (J2EE)- Designed for devices with limited memory,
(mainly phones) display and processing power.
Objects
What Is an Object?
Objects are key to understanding object-oriented technology. Look around right now
and you'll find many examples of real-world objects: your dog, your desk, your
television set, your bicycle.
Real-world objects share two characteristics: They all have state and behavior. Dogs
have state (name, color, breed, hungry) and behavior (barking, fetching, wagging
tail). Bicycles also have state (current gear, current pedal cadence, current speed)
and behavior (changing gear, changing pedal cadence, applying brakes). Identifying
the state and behavior for real-world objects is a great way to begin thinking in terms
of object-oriented programming.
Take a minute right now to observe the real-world objects that are in your immediate
area. For each object that you see, ask yourself two questions: "What possible states
can this object be in?" and "What possible behavior can this object perform?". Make
sure to write down your observations. As you do, you'll notice that real-world objects
vary in complexity; your desktop lamp may have only two possible states (on and off)
and two possible behaviors (turn on, turn off), but your desktop radio might have
additional states (on, off, current volume, current station) and behavior (turn on, turn
off, increase volume, decrease volume, seek, scan, and tune). You may also notice
that some objects, in turn, will also contain other objects. These real-world
observations all translate into the world of object-oriented programming.
A software object.
Software objects are conceptually similar to real-world objects: they too consist of
state and related behavior. An object stores its state in fields (variables in some
programming languages) and exposes its behavior through methods (functions in
some programming languages).
Classes
In the real world, you'll often find many individual objects all of the same kind. There
may be thousands of other bicycles in existence, all of the same make and model.
Each bicycle was built from the same set of blueprints and therefore contains the
same components. In object-oriented terms, we say that your bicycle is
an instance of the class of objects known as bicycles. A class is the blueprint from
which individual objects are created.
10