Programming Languages
and Program Development
A computer program is a series of instructions that directs a computer
to perform tasks. A computer programmer, often called a developer,
creates and modifies computer programs. To create a program, programmers
sometimes write, or code, a program’s instructions using a programming
language. A programming language is a set of words, abbreviations, and
symbols that enables a programmer to communicate instructions to a
computer. Other times, programmers use a program development tool to
create a program. A program that provides a user-friendly environment
for building programs often is called a program development tool.
Types Of Programming Language
There are two types of programming languages
Low Level Language
High Level Language
A low-level language is a programming language that is machine
dependent. A machine dependent language runs on only one particular type
of computer. These programs are not easily portable to other types of
computers. High-level languages often are machine independent. A
machine-independent language can run on many different types of
computers and operating systems.
LOW LEVEL LANGUAGE
Two types of low-level languages are machine languages and assembly
languages. Machine language, known as the first generation of
programming languages, is the only language the computer directly
recognizes . Machine language instructions use a series of binary digits
(1s and 0s) or a combination of numbers and letters that represents
binary digits. The binary digits correspond to the on and off electrical
states.
Assembly language, the second generation of programming languages, a
programmer writes instructions using symbolic instruction codes.
Symbolic instruction codes are meaningful abbreviations. With an
assembly language, a programmer writes abbreviations such as A for
addition, C for compare, L for load, and M for multiply.
HIGH LEVEL LANGUAGE
A procedural language, the programmer writes instructions that tell the
computer what to accomplish and how to do it. With a procedural
language, often called a third-generation language (3GL), a programmer
uses a series of English-like words to write instructions. For example,
ADD stands for addition or PRINT means to print. Many 3GLs also use
arithmetic operators such as * for multiplication and 1 for addition.
These English like words and arithmetic symbols simplify the program
development process for the programmer.
OBJECT-ORIENTED PROGRAMMING (OOP)
Computer programmers use an object-oriented programming (OOP) language
or object oriented program development tool to implement an
object-oriented design. an object is an item that can contain both data
and the procedures that read or manipulate that data. An object
represents a real person, place, event, or transaction. A major benefit
of OOP is the ability to reuse and modify existing objects. For example,
once a programmer creates an Employee object, it is available for use
by any other existing or future program. Thus, programmers repeatedly
reuse existing objects. For example, the payroll program and health
benefits program both use the Employee object. That is, the payroll
program would use it to process employee paychecks and the health
benefits program would use it to process health insurance payments.
Programs developed using the object-oriented approach have several
advantages. The objects can be reused in many systems, are designed for
repeated use, and become stable over time. In addition, programmers
create applications faster because they design programs using existing
objects.
Object-oriented programming languages and program development tools work
well in a RAD environment. RAD (rapid application development) is a
method of developing software, in
which a programmer writes and implements a program in segments instead of waiting until the entire program is completed.
Most object-oriented program development tools are IDEs. An IDE
(integrated development environment) includes tools for building
graphical user interfaces, an editor for entering program code, a
compiler and/or interpreter, and a debugger (to remove errors, which is
discussed later in the chapter). Some IDEs work with a single
programming language others, such as Eclipse support multiple languages.
The following sections discuss a variety of object-oriented programming languages and program development tools.
Java
Java is an object-oriented programming language developed by Sun
Microsystems. When programmers compile a Java program, the resulting
object code typically is called bytecode, which is machine independent.
Java then uses a just-in-time ( JIT ) compiler to convert the bytecode
into machine dependent code that is executed immediately. Programmers
use Java Platform, Standard Edition ( Java SE ), developed by Sun
Microsystems, to create stand-alone programs for desktop computers and
servers. Similarly, programmers use Java Platform, Micro Edition ( Java
ME ) to create programs for smart phones and other mobile devices.
.NET
The Microsoft .NET Framework, or .NET (pronounced dot net), is a set of
technologies that allows almost any type of program to run on the
Internet or an internal business network, as well as stand-alone
computers and mobile devices. Similarly, ASP.NET is a Web application
frame work that provides the tools necessary for the creation of dynamic
Web sites.
C++
Developed in the 1980s by Bjarne Sroustrup at Bell Laboratories, C++
(pronounced SEE-plus-plus) is an object oriented programming language
that is an extension of the C programming language. C++ includes all the
elements of the C language, plus it has additional features for working
with objects, classes, events, and other object-oriented concepts.
Programmers commonly use C++ to develop database and Web applications.
Much application software, such as word processing and spreadsheet
programs, also is written in C++. A programmer does not need C
programming experience to be a successful C++
c#
c#(programmer. pronounced SEE-sharp) is an object-oriented programming
language based on C++ that was developed primarily by Anders Hejlsberg,
Microsoft chief architect and distinguished engineer. C# has been
accepted as a standard for Web applications and XML-based Web services.
Like Java, C# uses a JIT compiler but its resulting code is MSIL. C#
applications can be built on existing C or C++ applications, saving
development time for companies migrating from C or C++.
Program Translators
To execute a computer program written in high or low level language, it
must be first be translated. There are 3 types of system software used
for translating the code that a programmer writes into a form that the
computer can execute (i.e. machine code). These are:
1. Assemblers
2. Compilers
3. Interpreters
An Assembler converts an assembly program into machine code. A Compiler
is a program that translates a high level language into machine code. An
Interpreter is also a program that translates high-level source code
into executable code. However the difference between a compiler and an
interpreter is that an interpreter translates one line at a time and
then executes it.
4GLs
A 4GL ( fourth-generation language) is a nonprocedural language that
enables users and programmers to access data in a database. With a
nonprocedural language, the programmer writes English-like instructions
or interacts with a graphical environment to retrieve data from files or
a database. Nonprocedural languages typically are easier to use than
procedural languages. Many object-oriented program development tools use
4GLs. One popular 4GL is SQL. SQL is a query language that allows users
to manage, update, and retrieve data in a relational DBMS. These
powerful languages allow database administrators to define a database
and its structure. They also enable users to maintain and access the
data in the database.
Web Page Development
HTML and XHTML
HTML (Hypertext Markup Language) is a special formatting language that
programmers use to format documents for display on the Web. You view a
Web page written with HTML in a Web browser such as Internet Explorer,
Safari, Firefox, Opera, or Google Chrome. Similarly, XHTML (extensible
HTML) is a markup language that enables Web sites to be displayed more
easily on micro browsers in smart phones and other mobile devices. HTML
and XHTML are not actually programming languages. They are, however,
languages that have specific rules for defining the placement and format
of text, graphics, video, and audio on a Web page. HTML and XHTML use
tags or elements, which are words, abbreviations, and symbols that
specify links to other documents and indicate how a Web page is
displayed when viewed on the Web. A Web page, thus, is a file that
contains both text and HTML and/or XHTML tags. Examples of tags are
<p> to indicate a new paragraph, <tr> to create a new row in
a table, and <title> to define a document title. You can write
HTML code using any text editor such as Notepad.
XML and WML
XML (Extensible Markup Language) is an increasingly popular format for
sharing data that allows Web developers to create customized tags, as
well as use predefined tags, used for developing a single Web site whose
content can be formatted to display appropriately on various devices.
XML separates the Web page content from its format, allowing the Web
browser to display the contents of a Web page in a form appropriate for
the display device. Wireless devices use a subset of XML called WML. WML
(wireless markup language) allows Web developers to design pages
specifically for microbrowsers. Many smart phones and other mobile
devices use WML as their markup language. An extension of XSL, called
XSLT (Extensible Stylesheet Language Transformations), creates style
sheets that describe how to transform XML documents into other types of
documents. Scripts,
Applets, Servlets, And Active Controls
Markup languages tell a browser how to display text and images, set up
lists and option buttons, and establish links on a Web page. By adding
dynamic content and interactive elements such as scrolling messages,
animated graphics, forms, pop-up windows, and interaction, Web pages
become much more interesting. To add these elements, Web developers
write small programs called scripts, applets, servlets, and ActiveX
controls.
A script is an interpreted program that runs on the client. That is, a
script runs on your computer, instead of running on a Web server.
An applet also usually runs on the client inside of an interpreted
program, but the applet itself is compiled. Thus, an applet usually runs
faster than a script.
Scripts and applets shift the computational work from the Web server to
the client. A servlet, by contrast, is an applet that runs on the
server.
Similar to an applet, an ActiveX control is a small program that runs on
the client computer, instead of the server. Active controls use ActiveX
technology.
Program Development
Program development consists of a series of steps programmers use to
build computer programs. The program development life cycle consists of
six steps.
1. Analyze Requirements
2. Design Solution
3. Validate Design
4. Implement Design
5. Test Solution
6. Document Solution
The steps in the program development life cycle form a loop. Program
development is an ongoing process within system development. Each time
someone identifies errors in or improvements to a program and requests
program modifications, the Analyze Requirements step begins again. When
programmers correct errors or add enhancements to an existing program,
they are said to be maintaining the program. Program maintenance is an
ongoing activity that occurs after a program has been delivered to
users, or placed into production.
1. Analyze Requirements
The first step in program development is to analyze the requirements of
the problem the program(s) should solve, so that the programmer can
begin to develop an appropriate solution. The Analyze Requirements step
consists of three major tasks:
Review The Requirements
Meet With The Systems Analyst And Users
Identify input, processing, output, and data components.
First, the programmer reviews the requirements. The requirements may be
in the form of deliverables such as charts, diagrams, and reports.
During this step, the programmer also meets with the systems analyst and
the users. This enables the programmer to understand the purpose of the
requirements from the users’ perspective. the programmer defines the
input, processing, output (IPO), and data requirements for each program.
Many programmers use an IPO chart to show the input, processing, and
output components. An IPO chart identifies a program’s inputs, its
outputs, and the processing steps required to transform the inputs into
the outputs. Programmers review the contents of the IPO chart with the
systems analyst and the users. This allows programmers to be sure that
they completely understand the purpose of the program
2. Design Solution
The next step is to design the solution that will meet the users’
requirements. Designing the solution involves devising a solution
algorithm to satisfy the requirements. A solution algorithm, also called
program logic, is a graphical or written description of the
step-by-step procedures to solve the problem. A system can be designed
using process modeling (structured analysis and design) or object
modeling (object oriented analysis and design).
Structured Design
Structured design sometimes called top-down design, the programmer
typically begins with a general design and moves toward a more detailed
design. This approach breaks down the original set of requirements into
smaller, more manageable sections. The first step in top-down design is
to identify the major function of a program, sometimes called the main
routine or main module. Next, the programmer decomposes the main routine
into smaller sections, called subroutines or modules.
Object-Oriented Design
The programmer packages the data and the program (or procedure) into a
single unit, an object. When the structure of an object changes, any
program that accesses the object automatically accesses the change.
A control structure, also known as a construct, the logical order of
program instructions. Three basic control structures are sequence,
selection, and repetition.
Sequence Control Structure
A sequence control structure shows one or more actions following each
other in order. Actions include inputs, processes, and outputs. All
actions must be executed; that is, none can be skipped.
Selection Control Structure A selection control structure tells the
program which action to take, based on a certain condition. Two common
types of selection control structures are the if-then-else and the case.
Repetition Control Structure
The repetition control structure enables a program to perform one or
more actions repeatedly as long as a certain condition is met. Many
programmers refer to this construct as a loop. Two forms of the
repetition control structure are the do-while and do-until.
3. Validate Design
Once programmers develop the solution algorithm, they should validate,
or check, the program design for accuracy. During this step, the
programmer checks the logic for accuracy and attempts to uncover logic
errors. A logic error is a flaw in the design that causes inaccurate
results. Two techniques for reviewing a solution algorithm are a desk
check and an inspection.
4. Implement Design
Implementation of the design includes using a program development tool
that assists the programmer by generating or providing some or all code,
or includes writing the code that translates the design into a computer
program and, if necessary, creating the user interface. Coding a
program involves translating the solution algorithm into a programming
language (sometimes on paper) and then typing the programming language
code into the computer.
5. Test Solution
Once a programmer codes and enters the program, the next step is to test
it. Testing is very important. The goal of program testing is to ensure
the program runs correctly and is error free. Errors uncovered during
this step usually are one of two types: (1) syntax errors or (2) logic
errors. A syntax error occurs when the code violates the syntax, or
grammar, of the programming language. Misspelling a command, leaving out
required punctuation, or typing command words, called keywords, out of
order all will cause syntax errors. The process of locating and
correcting syntax and logic errors in a program is known as debugging
the program. The program errors themselves are the bugs. Thus, removing
the errors is debugging.
6. Document Solution
The programmer should be sure all documentation is complete and
accurate. This becomes especially valuable if the program requires
changes in the future. Proper documentation greatly reduces the amount
of time a new programmer spends learning about existing programs.