UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE...
-
Upload
kelley-griffith -
Category
Documents
-
view
216 -
download
1
Transcript of UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE...
![Page 1: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/1.jpg)
CHAPTER 4 : Part 2INTRODUCTION TO SOFTWARE DEVELOPMENT:PROGRAMMING & LANGUAGES
![Page 2: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/2.jpg)
Module Objectives
• At the end of the module, students should be able to:
– List and describe the levels of programming languages:
machine, assembly, high level, very high level, and natural
– Describe the major programming languages that are in
use today
– Explain the concepts of object-oriented programming
![Page 3: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/3.jpg)
What is Programming ?
• Computer program – a series of instructions that directs a computer to
perform task.
• Programming language – a set of words, symbols, and codes that enables a
programmer to communicate instructions to a computer.– a set of rules that provides a way of telling the computer
what operations to perform
![Page 4: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/4.jpg)
Levels of Programming Languages
• Lower-level languages – more like the 0s and 1s the computer itself uses
• Higher-level languages – more like the languages people use
• Divided into five generations1. Machine language
2. Assembly languages
3. High-level languages
4. Very high-level languages
5. Natural languages
![Page 5: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/5.jpg)
1. Machine Language
• Programs and memory locations are written in strings of 0s and 1s
• Problems with machine languages– Programs are difficult to write and debug– Each computer has its own machine language
• Only option available to early programmers
![Page 6: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/6.jpg)
2. Assembly Languages
• Substitute mnemonic codes for 0s and 1s – For example, A for add, C for compare, etc.– Use names rather than binary addresses for memory
locations
• Require an assembler to translate the program into machine language
• Still used for programming chips and writing utility programs
• Example: MOV AL, 61h ; Load AL with 97 decimal (61 hex)
![Page 7: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/7.jpg)
3. High-Level Languages
• Transformed programming– Programmers could focus on solving problems
rather than manipulating hardware– Programs could be written and debugged much
more quickly
• Requires a compiler to convert the statements into machine language– Each computer has its own version of a
compiler for each language
![Page 8: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/8.jpg)
4. Very High-Level Languages
• Also called fourth-generation languages (4GLs)
• Considered nonprocedural languages– The programmer specifies the desired results,
and the language develops the solution– Programmers can be about 10 times more
productive using a fourth-generation language than a third-generation language
![Page 9: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/9.jpg)
5. Natural Languages
• Resemble written or spoken English– Programs can be written in
a natural syntax, rather than in the syntax rules of a programming language
• The language translates the instructions into code the computer can execute
![Page 10: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/10.jpg)
Major Programming Languages
• FORTRAN• COBOL• BASIC• RPG
• Visual Basic• C
• Java
![Page 11: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/11.jpg)
FORTRAN
• The first high-level language• Stands for FORmula
TRANslator• Used primarily for
engineering, mathematical, and scientific tasks
![Page 12: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/12.jpg)
COBOL
• Stands for COmmon Business-Oriented Language
• Used primarily for business requirements– Processes large data files– Produces well-formatted
reports
![Page 13: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/13.jpg)
BASIC
• Stands for Beginners’ All-Purpose Symbolic Instruction Code
• Developed to teach programming to college students
• Became very popular with the introduction of the microcomputer
![Page 14: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/14.jpg)
RPG
• Stands for Report Program Generator• Designed to allow rapid creation of
reports– Programmer simply describes the source
data and desired report format
![Page 15: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/15.jpg)
Visual Basic
• Allows programmer to create Windows-like user interfaces– Programmer drags a control
(button, text box, etc.) onto the form
– VB creates the code associated with that control
• VB is event-driven– The user controls the program
![Page 16: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/16.jpg)
C
• Originally designed to write systems software– Offers the ease of use of a
high-level language with the efficiency of an assembly language
• Very portable – can be used with virtually every combination of computer and operating system
#include <stdio.h> main(){ int number; printf("Enter an integer\n"); scanf("%d",&number); printf("Integer entered by you is %d\n", number); return 0;}
![Page 17: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/17.jpg)
Java• A network-friendly programming language that
permits a piece of software to run directly on many different platforms– Allows programmers to write one version of the
program, rather than a separate version of each platform
• Very useful for Internet development– Java applets can run in the user’s Web browser
public class HelloWorld { // method main(): ALWAYS the APPLICATION entry
point public static void main (String[] args) {
System.out.println ("Hello World!"); }
}
![Page 18: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/18.jpg)
Object-Oriented Programming
• Object – a self-contained unit that contains both data and its related functions
• Key terms in object-oriented programming– Encapsulation – an object isolates both its data and its
related instructions– Attributes – facts that describe the object
• Also called properties
– Methods – instructions that tell the object to do something
– Messages – an outside stimulus that results in the change of the state of an object
![Page 19: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/19.jpg)
Using Objects
• Programmers define classes of objects
– The class contains all attributes that are unique to objects of that class
– An object is an instance (occurrence) of a class
• Objects are arranged hierarchically in classes and subclasses
– Subclasses are derived from classes– Inheritance – a subclass possesses all
attributes of the class from which it is derived
– Additional attributes can be coded in the subclasses
![Page 20: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/20.jpg)
Activating the Object
• A message is sent to the object, telling it to do something– The object’s methods tell it how to do it
• Polymorphism – each object has its own way to process the message– For example, the class may have a Move
method, but each subclass implements that method differently
![Page 21: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/21.jpg)
Object-Oriented Languages
• C++• Java• C#• Visual Basic
![Page 22: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/22.jpg)
C++
• An enhancement of the C language– Includes all features of C – Adds support for object-oriented programming
• Can be used as simply an improvement of C, without the object-oriented features
![Page 23: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/23.jpg)
Java
• A pure object-oriented program• Used to create small programs called
applets– Applets can be delivered over the Web and run
on any platform
![Page 24: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/24.jpg)
C#
• Microsoft’s answer to Java• Has the same advantages over C++ that Java
has• Designed to work within Microsoft’s .NET
environment– .NET is designed for building, deploying, and
running Web-based applications
![Page 25: UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.](https://reader035.fdocuments.in/reader035/viewer/2022081519/56649e4f5503460f94b46b4a/html5/thumbnails/25.jpg)
Visual Basic
• Previous versions supported some object technology
• The current version, VB.NET, is the first to support inheritance and polymorphism– These two traits are required for a true object-
oriented language