1 introduction from bina nusantara university

Post on 06-Apr-2016

214 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

introduction OOPsemoga bisa membantu waktu pertama kali dan untuk mengenal lebih dalam lagi apa itu oop

TRANSCRIPT

COMP6175 – Object Oriented ProgrammingTopic 1 - Introduction

OUTLINE MATERIALS

• Programming Paradigms• Unstructured Programming• Structured Programming• Object – Oriented Programming• Object – Oriented Programming Languages• Why C++• C++ Example

Topic 1 – Introduction

Topic 1 - Introduction

Programming Paradigms• Programming paradigm is a way of

conceptualizing what it means to perform computation and how tasks to be carried out on the computer should be structured and organized.

• Paradigms are the way that we think about problems and how to solve the problems by considering :– the nature of problems– how they are to be approached

Programming Paradigms (2)• Programming paradigm also refers to the

approach used to develop a program for solving problems.

• Broadly, programming can be classified into three categories:– Unstructured Programming– Structured Programming– Object-oriented Programming

Unstructured Programming• Unstructured Programming refers to writing

simple and small programs which consist of only one main program, and all the actions of input, process and output are done within a program.

• goto Statement• Multi Entry and Multi Exit Subprogram• Spaghetti Code

Structured Programming• goto less Programming• Structured Theory

– Sequential – Selection– Iteration

• Single Entry and Single Exit Subprogram• Using structured programming, a program is

broken down into small independent tasks that are small enough to be understood easily, where each task has its own functionality and performs a specific part of the actual processing

Structured Programming (2)• Structured Programming can be performed in

two ways:– Procedural Programming– Modular Programming

Structured Programming (3)• Procedural Programming

– This programming has a single program that is divided into small segments, called as procedures (also known as functions, routines, subroutines or methods).

• Modular Programming– The programs coded with procedural usually fits in a

single code file and it is for relatively small program– If the program gets large, modular programming is

recommended– Modular programming is where large programs is broken

down into some smaller program units known as modules– Each module is designed to perform specific functions

Object-Oriented Programming• Object-oriented programming (OOP), is a programming

paradigm that represent concepts as “objects” where each objects will have “data fields” and “methods”

• Data fields or also known as data members or attributes are used to describe the object while methods are used to describe the interactions between object.

• In OOP, an object is an instance of a “class”.

• More about OOP will be discussed in next session

Object-Oriented Programming• Object-oriented programming (OOP), is a programming

paradigm that represent concepts as “objects” where each objects will have “data fields” and “methods”

• Data fields or also known as data members or attributes are used to describe the object while methods are used to describe the interactions between object.

• In OOP, an object is an instance of a “class”.

• More about OOP will be discussed in next session

Structured Programming VS OOP• Structured Programming

– Focuses on process– Top Down approach– A Single module will be split into several smaller modules– General to Specific– If the requirements are clear at the first instance we can go

for Top down approach• OOP

– Focuses on object– Bottom Up approach– Lot of small modules will be grouped to form a single large

module– Specific to General– In circumstances where the requirements may keep on

adding, we go for Bottom up approach

OO Programming Languages• There are many programming languages which

support OOP, some of them are:– C++– Java– C#

C++ Philosophy• C++

– General-purpose language, as efficient and portable as C

– support multiple programming styles ( procedural programming, data abstraction, o-o programming, and generic programming )

– providing a smooth transition from C– avoids features that are platform specific or

not general purpose

Java• Compared to C++:

– no header files, – no macros, – no pointers and references, – no unions, – no operator overloading, – no templates

• Object-orientation: – Classes– Inheritance– Doesn’t support multiple inheritance use interface

Java (2)• Robust:

– Strong typing – no pointer– garbage collection

• Secure: – access control

• Portable– Runs in many OS, such as Windows, Linux, iOS

• Multi-threaded

C#• C# : pronounced C Sharp• It is a multi-paradigm language that include

functional, imperative, OO and component-oriented disciplines

• C# is intended to be a programming language that is :– simple, – modern, – general-purpose, – Object-oriented

• It was initially named Cool, which stood for "C-like Object Oriented Language."

• However, in July 2000, the name of the programming language was given as C#.

Why C++ ?• C++ is a general-purpose

programming language with a bias towards systems programming that– is a better C– expressive– supports object-oriented programming – supports generic programming

• containers: stack of char, int, double etc• generic algorithms: sort(), copy(), search()

any container Stack/Vector/List

C++ Example

include <iostream>

using namespace std;

int main(){cout<<"Welcome to C++ Programming";cin.get();return 0;

}

My First Program in C++

Q & A

References• Deitel, P., & Deitel, H. (2012). C++ How to Program.8th

edition. New Jersey: Prentice Hall. Chapter 1 & 2• ITL Education Solutions Limited. (2011). Introduction

to Computer Science. 2nd edition. Pearson Education. ISBN: 9788131760307 . Chapter 8

THANK YOU

top related