Computer Science G10: Programming Languages and Paradigms
Computer Science G10: Programming Languages and Paradigms
Examples of 3GL
Fortran, Algol60, Algol68, Basic, Pascal, C, and Ada
Examples of 4th GL
Standard ML, Lisp, Haskel, SQL, Visual Basic, etc.
Examples of 5th GL
Prolog, OPS5,
Logic Programming
- In the logical paradigm, programs are written as logical statements that describe the
properties the solution must have. A logic program does not specify how to compute
the solution, but rather consists of a declarative description of the problem as a set
of rules.
Object-Oriented Programming
- In object-oriented programming, data structures are viewed as objects, and
programmers create relationship between these objects. A group of objects that
have the same properties, operations, and behaviors, is called a class.
- A good C++ program has the elements of both OOP and classic programming
approaches.
C Applies:
A. A procedural approach, where the program is performed step-by-step in a series.
B. A structured approach, where the complicated program is divided into several small
subsets that are each performed separately, later building up to be the whole set.
In computer programming, seeing things as objects has added benefits such as:
1. The code for an object can be written independently from other objects. This is known
as modularity.
2. Having object promotes code re-use. If an object has already been created, it can be
shared in other programs that require a similar object. In your own program, you can also
have several objects that have the same class.
3. It is easier to debug objects since the code is written separately from the rest of the
program.
OOP Concepts
Encapsulation -This is the process of combining data and function to form a class of
object. - putting the data together as one.
Polymorphism- “Poly” means many and “morph” means forms. So, by adding the two
terms, “polymorphism” means many forms. There may be several instances of different
functions , but they may have been derived from only one and the same function but with a
different name.
NOTE:
- Please study the structure of the program/code of the different
programming languages.
- Refer to your assignment on the different codes based from the given
programming languages from the Lesson 1 Assessment (Elaborate part)
If you want the sample code below as your output in your computer class, what programming
language will you use?
#include <iostream.h>
Main()
{
cout << “Hello World!”;
return 0;
}
a. C
b. Pascal
c. C++
d. Java