0% found this document useful (0 votes)
18 views

Chapter 1 Introduction To OOP .

International oop

Uploaded by

sekeriyeaxmed566
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Chapter 1 Introduction To OOP .

International oop

Uploaded by

sekeriyeaxmed566
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

Object Oriented Programming II (OOP) II

Object Oriented Programming


OOP II
Chapter:1 Introduction to Object Oriented
Programming in C#

1.1 Copyright © 2017 Pearson Education Ltd.


Introduction to OOP

OOP stands for Object-Oriented Programming . it is a way of developing software


applications using real-world terminologies to create entities that interact with one
another using objects.
Object-oriented programming makes applications flexible (easy to change or add new
features), reusable, well-structured, and easy to debug and test.
The core concept of the object-oriented approach is to break complex problems into
smaller objects.
C# is pronounced as "C-Sharp". It is an object-oriented programming language
provided by Microsoft that runs on .Net Framework.
1.2 Copyright © 2017 Pearson Education Ltd.
What is Object-Orientation?

It is a technique in which we visualize our programming problems in the form of


objects and their interactions as happens in real life.
Examples:
We have different objects around us in our real life that interact with each other to
perform different operations for example,

1.3 Copyright © 2017 Pearson Education Ltd.


What is Object-Orientation?

These objects interact with each other to perform different operations,

1.4 Copyright © 2017 Pearson Education Ltd.


What is Object-Orientation?

Take another example of a School


the objects in a school are student, teacher, books, pen, school bag, classroom,
parents, playground and so on… ,
Suppose we want to develop a fee collection system for a school for this we will need
to find out related objects and their interactions as happens in real life.

In this way we can say that object orientation makes it


easier for us to solve our real world problems by
thinking solution of the problem in terms of real world
objects.
So we can say that in our daily life everything can be
taken as an object that behaves in a certain way and
has certain attributes.
1.5 Copyright © 2017 Pearson Education Ltd.
What is a Model?

A model is an abstraction of something real or conceptual.


We need models to understand an aspect of reality.
Model Examples
Highway maps
Architectural models
Mechanical models

1.6 Copyright © 2017 Pearson Education Ltd.


OO Models

In the context of programming models are used to understand the problem before
starting developing it.
We make Object Oriented models showing several interacting objects to
understand a system given to us for implementation.

1.7 Copyright © 2017 Pearson Education Ltd.


OO Models
Example 2– Object Oriented Model (A School Model)

1.8 Copyright © 2017 Pearson Education Ltd.


Object-Orientation - Advantages

As Object Oriented Models map directly to reality as we have seen in examples


above therefore,
We can easily develop an object oriented model for a problem.
Everyone can easily understand an object oriented model. We can easily implement
an object oriented model for a problem using any object oriented language like c#
using its features like classes, inheritance, functions and so on…

1.9 Copyright © 2017 Pearson Education Ltd.


What is an Object?

An object is,
1.Something tangible (Ali, School, House, Car).
2.Something conceptual (that can be understand intellectually for example time, date
and so on…).
An object has,
1.State (attributes)
2.Well-defined behavior (operations)
3.Unique identity

1.10 Copyright © 2017 Pearson Education Ltd.


Tangible and Intangible Objects

Examples of Tangible Objects:


Ali is a tangible object, having some characteristics (attributes) and behavior as given below,

We will identify Ali using his name


Car is also a tangible object having some characteristics (attributes) and behavior given
below,

We can identify Car using its registration number


1.11 Copyright © 2017 Pearson Education Ltd.
Tangible and Intangible Objects

Examples of Intangible Objects (also called as conceptual objects):


Time is an intangible (conceptual) object

We will assign our own generated unique ID in the model for Time object
Date is also an intangible (conceptual) object

We will assign our own generated unique ID in the model for Date object
1.12 Copyright © 2017 Pearson Education Ltd.
Object Oriented Programming in C#

Most programming languages provide the following basic building blocks to build
object-oriented applications:
Classes: A Class define the structure using methods and properties/fields that look
like real-world entity.
Methods: A method represents a particular behavior. It performs some action and
might return information about an object, or update an object’s data.
Properties: Properties hold the data temporarily during the execution of an
application.
Objects: Objects are instances of the class that holds different data in
properties/fields and can interact with other objects.
Interfaces: An interface is a contract that defines the set of rules for a particular
functionality. They are used effectively with classes using OOP principles like
inheritance and polymorphism to make applications more flexible.
1.13 Copyright © 2017 Pearson Education Ltd.
Object-oriented Design Principles

There are various object-oriented principles and techniques using which you can
develop applications that are maintainable and extendable.
The followings are four main principles of object-oriented programming:
1.Abstraction
2.Encapsulation
3.Inheritance
4.Polymorphism
You will learn the above principles in detail in the next few chapters.

1.14 Copyright © 2017 Pearson Education Ltd.


Steps for Developing Object-oriented Applications

Developing an object-oriented application starts with the business requirement document.


Typically, a business analyst provides you with a business requirement document after
understanding and analyzing the requirement from the customer. So, the business
requirement is the starting point.
The followings are overall steps to develop an object-oriented application:
1. Abstraction: First, identify essential entities and their characteristic from the business
requirement for a high-level view.
 Find nouns from the business requirement (the noun is the person, place, thing, or
process).
 Identify potential classes and their members from the nouns.
1.15 Copyright © 2017 Pearson Education Ltd.
Steps for Developing Object-oriented Applications

2. Encapsulation: An implementation of abstraction in code. Create classes and


their members with appropriate access modifiers to show functionalities and hide
details and complexity.
3. Define relationship: Establish relationships between classes using inheritance
and polymorphism.
 Inheritance
 Polymorphism

1.16 Copyright © 2017 Pearson Education Ltd.


OOP II

CHAPTER One
END!!!

1.17 Copyright © 2017 Pearson Education Ltd.

You might also like