The graduates have the ability to
a. Articulate and discuss the latest developments in the specific field of practice.
(Philippine Qualifications Framework (PQF) level 6 descriptor)(Graduate Outcomes:
CS10, IS10, IT13)
b. Effectively communicate orally and in writing using both English and Filipino (Graduate
Outcomes: CS08, IS08, IT10)
c. Work effectively and independently in multi-disciplinary and multi-cultural teams. (PQF
level 6 level descriptor) (Graduate Outcomes: CS07, IS07, IT08)
d. Act in recognition of professional, social and ethical responsibility (Graduate Outcomes:
CS09, IS09, IT12)
e. Preserve and promote “Filipino Historical and cultural heritage” based on R.A. 7722)
The graduates of BS Information Technology must have the ability to
a. Analyse complex problems, and identify and define the computing requirements needed
to design an appropriate solution (Graduate Outcomes: CS02, IS02-03, IT03)
b. Apply computing and other knowledge domains to address real-world problems
(Graduate Outcomes: CS01, IS01, IT01)
c. Design and develop computing solutions using a system-level perspective (Graduate
Outcomes: CS03-05, IS04-05, IT05)
d. Utilize modern computing tools (Graduate Outcomes: CS06, IS06, IT07)
Course Title: Integrative Programming and Technologies 102
Course Description:
In this course, Organizations use many disparate technologies that need to
communicate and work with each other. A key component to the discipline of Information
Technology is the integration of applications and systems. This knowledge area examines the
various types of programming languages and their appropriate use. It also addresses the use of
scripting languages, architectures, application programming interfaces and programming
practices to facilitate the management, integration and security of the systems that support an
organization.
Course Outcomes
1. Compare the different encrypting and decrypting techniques that ensures security of
data.
2. Recommend where an application language and scripting language would be more
appropriate and give a valid reason to support your selection.
3. Design, develop and test an application that uses the abstract class.
Module 1: Overview of Programming Languages
Introduction
This module will discuss the history of programming languages at the beginning until
this new generation how differed the programming languages and Programming paradigms.
Also this will focus compiled and interpretative languages and application vs. scripting
languages.
Lesson 1
History of Programming Languages
I. Learning Outcomes
In this lesson, the students should be able to:
1. Describe the benefits and weaknesses associated with using a virtual machine.
2. Compare the differences between the structured and object-oriented programming
paradigms.
3. Compare the differences between application and scripting languages
II. Core Content
A History of Computer Programming Languages
Ever since the invention of Charles Babbage’s difference engine in 1822, computers have
required a means of instructing them to perform a specific task. This means is known as a
programming language. Computer languages were first composed of a series of steps to wire a
particular program; these morphed into a series of steps keyed into the computer and then
executed; later these languages acquired advanced features such as logical branching and
object orientation. The computer languages of the last fifty years have come in two stages, the
first major languages and the second major languages, which are in use today.
In the beginning, Charles Babbage’s difference engine could only be made to execute
tasks by changing the gears which executed the calculations. Thus, the earliest form of a
computer language was physical motion. Eventually, physical motion was replaced by electrical
signals when the US Government built the ENIAC in 1942. It followed many of the same
principles of Babbage’s engine and hence, could only be “programmed” by presenting switches
and rewiring the entire system for each new “program” or calculation. This process proved to
be very tedious.
In 1945, John Von Neumann was working at the Institute for Advanced Study. He
developed two important concepts that directly affected the path of computer programming
languages. The first was known as “shared-program technique” ([Link]). This
technique stated that the actual computer hardware should be simple and not need to be
hand-wired for each program. Instead, complex instructions should be used to control the
simple hardware, allowing it to be reprogrammed much faster.
The second concept was also extremely important to the development of programming
languages. Von Neumann called it “conditional control transfer” ([Link]). This idea
gave rise to the notion of subroutines, or small blocks of code that could be jumped to in any
order, instead of a single set of chronologically ordered steps for the computer to take. The
second part of the idea stated that computer code should be able to branch based on logical
statements such as IF (expression) THEN, and looped such as with a FOR statement.
“Conditional control transfer” gave rise to the idea of “libraries,” which are blocks of code that
can be reused over and over. (Updated Aug 1 2004: Around this time, Konrad Zuse, a German,
was inventing his own computing systems independently and developed many of the same
concepts, both in his machines and in the Plankalkul programming language. Alas, his work did
not become widely known until much later.
In 1949, a few years after Von Neumann’s work, the language Short Code appeared
([Link]). It was the first computer language for electronic devices and it required the
programmer to change its statements into 0’s and 1’s by hand. Still, it was the first step towards
the complex languages of today. In 1951, Grace Hopper wrote the first compiler, A-0
([Link]). A compiler is a program that turns the language’s statements into 0’s and 1’s
for the computer to understand. This lead to faster programming, as the programmer no longer
had to do the work by hand.
In 1957, the first of the major languages appeared in the form of FORTRAN. Its name
stands for FORmula TRANslating system. The language was designed at IBM for scientific
computing. The components were very simple, and provided the programmer with low-level
access to the computers innards. Today, this language would be considered restrictive as it only
included IF, DO, and GOTO statements, but at the time, these commands were a big step
forward. The basic types of data in use today got their start in FORTRAN, these included logical
variables (TRUE or FALSE), and integer, real, and double-precision numbers.
Though FORTAN was good at handling numbers, it was not so good at handling input and
output, which mattered most to business computing. Business computing started to take off in
1959, and because of this, COBOL was developed. It was designed from the ground up as the
language for businessmen. Its only data types were numbers and strings of text. It also allowed
for these to be grouped into arrays and records, so that data could be tracked and organized
better. It is interesting to note that a COBOL program is built in a way similar to an essay, with
four or five major sections that build into an elegant whole. COBOL statements also have a very
English-like grammar, making it quite easy to learn. All of these features were designed to make
it easier for the average business to learn and adopt it.
(Updated Aug 11 2004) In 1958, John McCarthy of MIT created the LISt Processing (or
LISP) language. It was designed for Artificial Intelligence (AI) research. Because it was designed
for a specialized field, the original release of LISP had a unique syntax: essentially none.
Programmers wrote code in parse trees, which are usually a compiler-generated intermediary
between higher syntax (such as in C or Java) and lower-level code. Another obvious difference
between this language (in original form) and other languages is that the basic and only type of
data is the list; in the mid-1960’s, LISP acquired other data types. A LISP list is denoted by a
sequence of items enclosed by parentheses. LISP programs themselves are written as a set of
lists, so that LISP has the unique ability to modify itself, and hence grow on its own. The LISP
syntax was known as “Cambridge Polish,” as it was very different from standard Boolean logic
(Wexelblat, 177):
x V y - Cambridge Polish, what was used to describe the LISP
program
OR(x,y) - parenthesized prefix notation, what was used in the
LISP program
x OR y - standard Boolean logic
LISP remains in use today because its highly specialized and abstract nature.
The Algol language was created by a committee for scientific use in 1958. Its major
contribution is being the root of the tree that has led to such languages as Pascal, C, C++, and
Java. It was also the first language with a formal grammar, known as Backus-Naar Form or BNF
(McGraw-Hill Encyclopedia of Science and Technology, 454). Though Algol implemented some
novel concepts, such as recursive calling of functions, the next version of the language, Algol 68,
became bloated and difficult to use ([Link]). This lead to the adoption of smaller and
more compact languages, such as Pascal.
Pascal was begun in 1968 by Niklaus Wirth. Its development was mainly out of necessity
for a good teaching tool. In the beginning, the language designers had no hopes for it to enjoy
widespread adoption. Instead, they concentrated on developing good tools for teaching such as
a debugger and editing system and support for common early microprocessor machines which
were in use in teaching institutions.
Pascal was designed in a very orderly approach, it combined many of the best features of
the languages in use at the time, COBOL, FORTRAN, and ALGOL. While doing so, many of the
irregularities and oddball statements of these languages were cleaned up, which helped it gain
users (Bergin, 100-101). The combination of features, input/output and solid mathematical
features, made it a highly successful language. Pascal also improved the “pointer” data type, a
very powerful feature of any language that implements it. It also added a CASE statement, that
allowed instructions to to branch like a tree in such a manner:
CASE expression OF
possible-expression-value-1:
statements to execute...
possible-expression-value-2:
statements to execute...
END
Pascal also helped the development of dynamic variables, which could be created while a
program was being run, through the NEW and DISPOSE commands. However, Pascal did not
implement dynamic arrays, or groups of variables, which proved to be needed and led to its
downfall (Bergin, 101-102). Wirth later created a successor to Pascal, Modula-2, but by the time
it appeared, C was gaining popularity and users at a rapid pace.
C was developed in 1972 by Dennis Ritchie while working at Bell Labs in New Jersey. The
transition in usage from the first major languages to the major languages of today occurred
with the transition between Pascal and C. Its direct ancestors are B and BCPL, but its similarities
to Pascal are quite obvious. All of the features of Pascal, including the new ones such as the
CASE statement are available in C. C uses pointers extensively and was built to be fast and
powerful at the expense of being hard to read. But because it fixed most of the mistakes Pascal
had, it won over former-Pascal users quite rapidly.
Ritchie developed C for the new Unix system being created at the same time. Because of
this, C and Unix go hand in hand. Unix gives C such advanced features as dynamic variables,
multitasking, interrupt handling, forking, and strong, low-level, input-output. Because of this, C
is very commonly used to program operating systems such as Unix, Windows, the MacOS, and
Linux.
In the late 1970’s and early 1980’s, a new programing method was being developed. It
was known as Object Oriented Programming, or OOP. Objects are pieces of data that can be
packaged and manipulated by the programmer. Bjarne Stroustroup liked this method and
developed extensions to C known as “C With Classes.” This set of extensions developed into the
full-featured language C++, which was released in 1983.
C++ was designed to organize the raw power of C using OOP, but maintain the speed of C
and be able to run on many different types of computers. C++ is most often used in simulations,
such as games. C++ provides an elegant way to track and manipulate hundreds of instances of
people in elevators, or armies filled with different types of soldiers. It is the language of choice
in today’s AP Computer Science courses.
In the early 1990’s, interactive TV was the technology of the future. Sun Microsystems
decided that interactive TV needed a special, portable (can run on many types of machines),
language. This language eventually became Java. In 1994, the Java project team changed their
focus to the web, which was becoming “the cool thing” after interactive TV failed. The next
year, Netscape licensed Java for use in their internet browser, Navigator. At this point, Java
became the language of the future and several companies announced applications which would
be written in Java, none of which came into use.
Though Java has very lofty goals and is a text-book example of a good language, it may
be the “language that wasn’t.” It has serious optimization problems, meaning that programs
written in it run very slowly. And Sun has hurt Java’s acceptance by engaging in political battles
over it with Microsoft. But Java may wind up as the instructional language of tomorrow as it is
truly object-oriented and implements advanced techniques such as true portability of code and
garbage collection.
Visual Basic is often taught as a first programming language today as it is based on the
BASIC language developed in 1964 by John Kemeny and Thomas Kurtz. BASIC is a very limited
language and was designed for non-computer science people. Statements are chiefly run
sequentially, but program control can change based on IF..THEN, and GOSUB statements which
execute a certain block of code and then return to the original point in the program’s flow.
Microsoft has extended BASIC in its Visual Basic (VB) product. The heart of VB is the
form, or blank window on which you drag and drop components such as menus, pictures, and
slider bars. These items are known as “widgets.” Widgets have properties (such as its color) and
events (such as clicks and double-clicks) and are central to building any user interface today in
any language. VB is most often used today to create quick and simple interfaces to other
Microsoft products such as Excel and Access without needing a lot of code, though it is possible
to create full applications with it.
Perl has often been described as the “duct tape of the Internet,” because it is most often
used as the engine for a web interface or in scripts that modify configuration files. It has very
strong text matching functions which make it ideal for these tasks. Perl was developed by Larry
Wall in 1987 because the Unix sed and awk tools (used for text manipulation) were no longer
strong enough to support his needs. Depending on whom you ask, Perl stands for Practical
Extraction and Reporting Language or Pathologically Eclectic Rubbish Lister.
Programming languages have been under development for years and will remain so for
many years to come. They got their start with a list of steps to wire a computer to perform a
task. These steps eventually found their way into software and began to acquire newer and
better features. The first major languages were characterized by the simple fact that they were
intended for one purpose and one purpose only, while the languages of today are
differentiated by the way they are programmed in, as they can be used for almost any purpose.
And perhaps the languages of tomorrow will be more natural with the invention of quantum
and biological computers.
Programming Paradigms
A programming paradigm is a style, or “way,” of programming.
Some languages make it easy to write in some paradigms but not others.
Some Common Paradigms
Imperative: Programming with an explicit sequence of commands that update state.
Declarative: Programming by specifying the result you want, not how to get it.
Structured: Programming with clean, go to-free, nested control structures.
Procedural: Imperative programming with procedure calls.
Functional (Applicative): Programming with function calls that avoid any global state.
Function-Level (Combinator): Programming with no variables at all.
Object-Oriented: Programming by defining objects that send messages to each other.
Objects have their own internal (encapsulated) state and public interfaces. Object
orientation can be:
Class-based: Objects get state and behaviour based on membership in a class.
Prototype-based: Objects get behaviour from a prototype object.
Event-Driven: Programming with emitters and listeners of asynchronous actions.
Flow-Driven: Programming processes communicating with each other over predefined
channels.
Logic (Rule-based): Programming by specifying a set of facts and rules. An engine infers
the answers to questions.
Constraint: Programming by specifying a set of constraints. An engine finds the values
that meet the constraints.
Aspect-Oriented: Programming cross-cutting concerns applied transparently.
Reflective: Programming by manipulating the program elements themselves.
Array: Programming with powerful array operators that usually make loops
unnecessary.
Some Major Paradigms
Imperative Programming
Control flow in imperative programming is explicit: commands show how the computation
takes place, step by step. Each step affects the global state of the computation.
result = []
i = 0
start:
numPeople = length(people)
if i >= numPeople goto finished
p = people[i]
nameLength = length([Link])
if nameLength <= 5 goto nextOne
upperName = toUpper([Link])
addToList(result, upperName)
nextOne:
i = i + 1
goto start
finished:
return sort(result)
Structured Programming
Structured programming is a kind of imperative programming where control flow is defined by
nested loops, conditionals, and subroutines, rather than via gotos. Variables are generally local
to blocks (have lexical scope).
result = [];
for i = 0; i < length(people); i++ {
p = people[i];
if length([Link])) > 5 {
addToList(result, toUpper([Link]));
}
}
return sort(result);
Early languages emphasizing structured programming: Algol 60, PL/I, Algol 68, Pascal, C, Ada 83,
Modula, Modula-2. Structured programming as a discipline is sometimes though to have been
started by a famous letter by Edsger Dijkstra entitled Go to Statement Considered Harmful.
Object Oriented Programming
OOP is based on the sending of messages to objects. Objects respond to messages by
performing operations, generally called methods. Messages can have arguments. A society of
objects, each with their own local memory and own set of operations has a different feel than
the monolithic processor and single shared memory feel of non object oriented languages.
One of the more visible aspects of the more pure-ish OO languages is that conditionals and
loops become messages themselves, whose arguments are often blocks of executable code. In
a Smalltalk-like syntax:
result := List new.
people each: [:p |
p name length greaterThan: 5 ifTrue: [result add (p name upper)]
]
result sort.
^result
This can be shortened to:
^people filter: [:p | p name length greaterThan: 5] map: [:p | p name
upper] sort
Many popular languages that call themselves OO languages (e.g., Java, C++), really just take
some elements of OOP and mix them in to imperative-looking code. In the following, we can
see that length and toUpper are methods rather than top-level functions, but for and if are
back to being control structures:
result = []
for p in people {
if [Link] > 5 {
[Link]([Link]);
}
}
return [Link];
The first object oriented language was Simula-67; Smalltalk followed soon after as the first
“pure” object-oriented language. Many languages designed from the 1980s to the present have
labeled themselves object-oriented, notably C++, CLOS (object system of Common Lisp), Eiffel,
Modula-3, Ada 95, Java, C#, Ruby.
Declarative Programming
Control flow in declarative programming is implicit: the programmer states only what the result
should look like, not how to obtain it.
sort(
fix(λf. λp.
if(equals(p, emptylist),
emptylist,
if(greater(length(name(head(p))), 5),
append(to_upper(name(head(p))), f(tail(p))),
f(tail(people)))))(people))
Yikes! We’ll describe that later. For now, be thankful there’s usually syntactic sugar:
let
fun uppercasedLongNames [] = []
| uppercasedLongNames (p :: ps) =
if length(name p) > 5 then (to_upper(name
p))::(uppercasedLongNames ps)
else (uppercasedLongNames ps)
in
sort(uppercasedLongNames(people))
Huh? That still isn’t very pretty. Why do people like this stuff? Well the real power of this
paradigm comes from passing functions to functions (and returning functions from functions).
sort(
filter(λs. length s > 5,
map(λp. to_upper(name p),
people)))
We can do better by using the cool |> operator. Here x |> f just means f(x). The operator has
very low precedence so you can read things left-to-right:
people |> map (λp. to_upper (name p)) |> filter (λs. length s > 5) |> sort
Let’s keep going! Notice that you wouldn’t write map(λx. square(x)), right? You would write
map(square). We can do something similar above, but we have to use function composition,
you know, (f o g)x is f(g(x)), so:
people |> map (to_upper o name) |> filter (λs. length s > 5) |> sort
Logic and Constraint Programming
Logic programming and constraint programming are two paradigms in which programs are built
by setting up relations that specify facts and inference rules, and asking whether or not
something is true (i.e. specifying a goal.) Unification and backtracking to find solutions (i.e..
satisfy goals) takes place automatically.
Languages that emphasize this paradigm: Prolog, GHC, Parlog, Vulcan, Polka, Mercury, Fnil.
Compiled vs Interpretative languages
Compiled Language
- A compiled language is one where the program, once compiled, is expressed in the
instructions of the target machine. For example, an addition "+" operation in your
source code could be translated directly to the "ADD" instruction in machine code.
- Compiled languages are converted directly into machine code that the processor can
execute. As a result, they tend to be faster and more efficient to execute than
interpreted languages.
Advantages of compiled languages
- Programs that are compiled into native machine code tend to be faster than interpreted
code. This is because the process of translating code at run time adds to the overhead,
and can cause the program to be slower overall.
Disadvantages of compiled languages
The most notable disadvantages are:
- Additional time needed to complete the entire compilation step before testing
- Platform dependence of the generated binary code
-
Interpreted/Interpretative Language
- An interpreted language is one where the instructions are not directly executed by the
target machine, but instead read and executed by some other program (which normally
is written in the language of the native machine). For example, the same "+" operation
would be recognised by the interpreter at run time, which would then call its own
"add(a,b)" function with the appropriate arguments, which would then execute the
machine code "ADD" instruction.
- Interpreters run through a program line by line and execute each command. Here, if the
author decides he wants to use a different kind of olive oil, he could scratch the old one
out and add the new one. Your translator friend can then convey that change to you as
it happens.
You can do anything that you can do in an interpreted language in a compiled language and
vice-versa - they are both Turing complete. Both however have advantages and disadvantages
for implementation and use.
I'm going to completely generalise (purists forgive me!) but, roughly, here are the advantages of
compiled languages:
- Faster performance by directly using the native code of the target machine
- Opportunity to apply quite powerful optimisations during the compile stage
Advantages of interpreted languages:
- Easier to implement (writing good compilers is very hard!!)
- No need to run a compilation stage: can execute code directly "on the fly"
- Can be more convenient for dynamic languages
- Interpreted languages tend to be more flexible, and often offer features like dynamic
typing and smaller program size. Also, because interpreters execute the source program
code themselves, the code itself is platform independent.
Disadvantage of interpreted languages
- The most notable disadvantage is typical execution speed compared to compiled
languages.
Note that modern techniques such as bytecode compilation add some extra complexity - what
happens here is that the compiler targets a "virtual machine" which is not the same as the
underlying hardware. These virtual machine instructions can then be compiled again at a later
stage to get native code (e.g. as done by the Java JVM JIT compiler).
Application vs. scripting languages
Scripting Languages
The difference between both of them is based on their compilation process.
Scripting Languages
Scripting languages don’t require to be compiled rather they are interpreted. Means scripting
languages used an interpreter to convert their code into native machine code.
Here also remember that scripting languages run slower than programming languages. And also
they cannot directly access the low-level details of the hardware.
For example, your C program needs a compiler to convert its code into native machine code.
But on the other hand, JavaScript doesn’t need a compiler rather it uses an interpreter to
convert its code into native machine code. So that’s why JavaScript sometimes called the
“Scripting Language”.
Application of Scripting Language
- To automate certain tasks (Build System like Gradle use scripts for automation)
- Extracting information from a set of data
Examples of Scripting Language (These languages are traditionally used without explicit
compilation process. But today some of them may vary.)
- JavaScript
- Lua
- Perl
- Python
- PHP
- VBScript etc.
Application
Application is something which is used by customer predominantly
Example
For instance: I create a software which scans the PC for potential threats of Virus and
Malware's then the particular software is an Application for the customer.
Now inside the same software I might write few lines of code which can be part of the
application or some service functionality for my application. Now these are called scripts which
can be written to:
- Send me anonymous data.
- Check for latest software updates for the application.
- Send me application crash reports.
III. Assessment
Activity 1
Instruction: Make one copy of this assessment section only, use a4 bond paper size for
uniformity and write your name at the above and the subject name. Write your answer
in the space provided or inside the box.
Guide Question
1. Contrast the scripting and non-scripting languages? Discuss concisely.