You are on page 1of 9

Lecture # 1

Evolution of OOP

The OOP (Object Oriented Programming) approach is most commonly used


approach now a day. OOP is being used for designing large and complex
applications. Before OOP many programming approaches existed which had
many drawbacks. 

These programming approaches have been passing through revolutionary


phases just like computer hardware. Initially for designing small and simple
programs, the machine language was used. Next came the Assembly
Language which was used for designing larger programs. Both machine and
Assembly languages are machine dependent. Next came Procedural
Programming Approach which enabled us to write larger and hundred
lines of code. Then in 1970, a new programming approach called
Structured Programming Approach was developed for designing medium
sized programs. In 1980's the size of programs kept increasing so a new
approach known as OOP was invented. 

1) Monolithic Programming Approach


2) Procedural Programming Approach
3) Structured Programming Approach
4) Object Oriented Programming Approach

Monolithic Programming Approach: In this approach, the program


consists of sequence of statements that modify data. All the statements of
the program are Global throughout the whole program. The program control
is achieved through the use of jumps i.e. goto statements. In this approach,
code is duplicated each time because there is no support for the function.
Data is not fully protected as it can be accessed from any portion of the
program. So this approach is useful for designing small and simple
programs. The programming languages like ASSEMBLY and BASIC follow
this approach. 

Procedural Programming Approach: This approach is top down


approach. In this approach, a program is divided into functions that perform
a specific task. Data is global and all the functions can access the global
data. Program flow control is achieved through function calls and goto
statements. This approach avoids repetition of code which is the main
drawback of Monolithic Approach. The basic drawback of Procedural
Programming Approach is that data is not secured because data is global
and can be accessed by any function. This approach is mainly used for
medium sized applications. The programming languages: FORTRAN and
COBOL follow this approach. 

Structured Programming Approach: The basic principal of structured


programming approach is to divide a program in functions and modules.
The use of modules and functions makes the program more comprehensible
(understandable). It helps to write cleaner code and helps to maintain
control over each function. This approach gives importance to functions
rather than data. It focuses on the development of large software
applications. The programming languages: PASCAL and C follow this
approach. 

Object Oriented Programming Approach: The OOP approach came into


existence to remove the drawback of conventional approaches. The basic
principal of the OOP approach is to combine both data and functions so that
both can operate into a single unit. Such a unit is called an Object. This
approach secures data also. Now a day this approach is used mostly in
applications. The programming languages: C++ and JAVA follow this
approach. Using this approach we can write any lengthy code.
Lecture # 2
Procedure-oriented Programming(POP) and Object-oriented
programming(OOP) both are the programming approaches, which uses
high-level language for programming. A program can be written in both the
languages, but if the task is highly complex, OOP operates well as compared
to POP. In POP, the ‘data security’ is at risk as data freely moves in the
program, as well as, ‘code reusability’ is not achieved which makes the
programming lengthy, and hard to understand.
Large programs lead to more bugs, and it increases the time of debugging.
All these flaws lead to a new approach, namely “object-oriented
programming”. In object-oriented programming’s primary concern is
given on ‘data security’; it binds the data closely to the functions which
operate on it.
It also resolves the problem of ‘code reusability’, as if a class is created, its
multiple instances(objects) can be created which reuses the members and
member functions defined by a class. There are some other differences
which can be explained with the help of a comparison chart.

Basis For
POP OOP
comparison
Basic Procedure/Structure oriented . Object oriented.
Approach Top-down. Bottom-up.
Main focus is on "how to get the task Main focus is on 'data security'.
Basis done" i.e. on the procedure or structure Hence, only objects are permitted
of a program . to access the entities of a class.
Large program is divided into units Entire program is divided into
Division
called functions. objects.
Entity accessing Access specifier are "public",
No access specifier observed.
mode "private", "protected".
Overloading or Neither it overload functions nor It overloads functions,
Polymorphism operators. constructors, and operators.
Inheritance achieved in three
Inheritance Their is no provision of inheritance. modes public private and
protected.
Data is hidden in three modes
Data hiding & There is no proper way of hiding the
public, private, and protected.
security data, so data is insecure
hence data security increases.
Global data is shared among the Data is shared among the objects
Data sharing
functions in the program. through the member functions.
Friend functions or No concept of friend function. Classes or function can become a
Basis For
POP OOP
comparison
friend of another class with the
keyword "friend".
friend classes
Note: "friend" keyword is used
only in c++
Virtual classes or Concept of virtual function appear
No concept of virtual classes .
virtual function during inheritance.
Example C, VB, FORTRAN, Pascal C++, JAVA, VB.NET, C#.NET.

Object Oriented Paradigm


What is Paradigm: a typical example or pattern of something; a pattern or model.
Some Common Paradigms

You should know these:

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, goto-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:
o Class-based: Objects get state and behavior based on membership in a class.
o Prototype-based: Objects get behavior 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.
Object-Oriented Analysis
Object–Oriented Analysis (OOA) is the procedure of identifying software engineering
requirements and developing software specifications in terms of a software system’s object
model, which comprises of interacting objects.

The main difference between object-oriented analysis and other forms of analysis is that in
object-oriented approach, requirements are organized around objects, which integrate both data
and functions. They are modelled after real-world objects that the system interacts with. In
traditional analysis methodologies, the two aspects - functions and data - are considered
separately.

Grady Booch has defined OOA as, “Object-oriented analysis is a method of analysis that
examines requirements from the perspective of the classes and objects found in the vocabulary of
the problem domain”.

The primary tasks in object-oriented analysis (OOA) are −

 Identifying objects
 Organizing the objects by creating object model diagram
 Defining the internals of the objects, or object attributes
 Defining the behavior of the objects, i.e., object actions
 Describing how the objects interact

The common models used in OOA are use cases and object models.
Object-Oriented Design
Object–Oriented Design (OOD) involves implementation of the conceptual model produced
during object-oriented analysis. In OOD, concepts in the analysis model, which are
technology−independent, are mapped onto implementing classes, constraints are identified and
interfaces are designed, resulting in a model for the solution domain, i.e., a detailed description
of how the system is to be built on concrete technologies.

The implementation details generally include −

 Restructuring the class data (if necessary),


 Implementation of methods, i.e., internal data structures and algorithms,
 Implementation of control, and
 Implementation of associations.

Grady Booch has defined object-oriented design as “a method of design encompassing the
process of object-oriented decomposition and a notation for depicting both logical and physical
as well as static and dynamic models of the system under design”.

Object-Oriented Programming
Object-oriented programming (OOP) is a programming paradigm based upon objects (having
both data and methods) that aims to incorporate the advantages of modularity and reusability.
Objects, which are usually instances of classes, are used to interact with one another to design
applications and computer programs.

The important features of object–oriented programming are −

 Bottom–up approach in program design


 Programs organized around objects, grouped in classes
 Focus on data with methods to operate upon object’s data
 Interaction between objects through functions
 Reusability of design through creation of new classes by adding features to existing classes

Some examples of object-oriented programming languages are C++, Java, Smalltalk, Delphi, C#,
Perl, Python, Ruby, and PHP.
1. Java is Simple:
The Java programming language is easy to learn. Java code is easy to read and write.

 
2. Java is Familiar:
Java is similar to C/C++ but it removes the drawbacks and complexities of C/C++ like pointers and
multiple inheritances. So if you have background in C/C++, you will find Java familiar and easy to learn.

3. Java is an Object-Oriented programming language:


Unlike C++ which is semi object-oriented, Java is a fully object-oriented programming language. It has all
OOP features such as abstraction, encapsulation, inheritance and polymorphism.

4. Java supports Functional programming:


Since Java SE version 8 (JDK 8), Java is updated with functional programming feature like functional
interfaces and Lambda Expressions. This increases the flexibility of Java.

5. Java is Robust:
With automatic garbage collection and simple memory management model (no pointers like C/C++),
plus language features like generics, try-with-resources,… Java guides programmer toward reliable
programming habits for creating highly reliable applications.

6. Java is Secure:
The Java platform is designed with security features built into the language and runtime system such as
static type-checking at compile time and runtime checking (security manager), which let you creating
applications that can’t be invaded from outside. You never hear about viruses attacking Java
applications.

7. Java is High Performance:


Java code is compiled into bytecode which is highly optimized by the Java compiler, so that the Java
virtual machine (JVM) can execute Java applications at full speed. In addition, compute-intensive code
can be re-written in native code and interfaced with Java platform via Java Native Interface (JNI) thus
improve the performance.

8. Java is Multithreaded:
The Java platform is designed with multithreading capabilities built into the language. That means you
can build applications with many concurrent threads of activity, resulting in highly interactive and
responsive applications.

9. Java is Platform Independence:


Java code is compiled into intermediate format (bytecode), which can be executed on any systems for
which Java virtual machine is ported. That means you can write a Java program once and run it on
Windows, Mac, Linux or Solaris without re-compiling. Thus the slogan “Write once, run anywhere” of
Java.

Besides the above features, programmers can benefit from a strong and vibrant Java ecosystem:

 Java is powered by Oracle - one of the leaders in the industry. Java also gets enormous support
from big technology companies like IBM, Google, Redhat,… so it has been always evolving over
the years.
 There are a lot of open source libraries which you can choose for building your applications.
 There are many superior tools and IDEs that makes your Java development easier.
 There are many frameworks that help you build highly reliable applications quickly.
 The community around Java technology is very big and mature, so that you can get support
easily. Thank you.

You might also like