31
Introduction to Object-Oriented Programming

Week 001.pptx

Embed Size (px)

Citation preview

Page 1: Week 001.pptx

Introduction to Object-Oriented Programming

Page 2: Week 001.pptx

History

The terms "objects" and "oriented" in something like the modern sense of object-oriented programming seem to make their first appearance at MIT in the late 1950s and early 1960s. In the environment of the artificial intelligence group, as early as 1960, "object" could refer to identified items (LISP atoms) with properties (attributes). Alan Kay was later to cite a detailed understanding of LISP internals as a strong influence on his thinking in 1966.

Page 3: Week 001.pptx

History

Another early MIT example was Sketchpad created by Ivan Sutherland in 1960-61; in the glossary of the 1963 technical report based on his dissertation about Sketchpad, Sutherland defined notions of "object" and "instance" (with the class concept covered by "master" or "definition"), although specialized to graphical interaction.

Page 4: Week 001.pptx

History

Also, an MIT ALGOL version, AED-0, linked data structures ("plexes", in that dialect) directly with procedures, anticipating what were later termed "messages", "methods" and "member functions".

Page 5: Week 001.pptx

History

Objects as a formal concept in programming were introduced in the 1960s in Simula 67, a major revision of Simula I, a programming language designed for discrete event simulation, created by Ole-Johan Dahl and Kristen Nygaard of the Norwegian Computing Center in Oslo.

Page 6: Week 001.pptx

History

Simula 67 was influenced by SIMSCRIPT and Charles Antony Richard (CAR) "Tony" Hoare's proposed "record classes". Simula introduced the notion of classes and instances or objects (as well as subclasses, virtual methods, coroutines, and discrete event simulation) as part of an explicit programming paradigm. The language also used automatic garbage collection that had been invented earlier for the functional programming language Lisp.

Page 7: Week 001.pptx

History

Simula was used for physical modeling, such as models to study and improve the movement of ships and their content through cargo ports. The ideas of Simula 67 influenced many later languages, including Smalltalk, derivatives of LISP (Common LISP Object System CLOS), Object Pascal, and C++.

Page 8: Week 001.pptx

History

The Smalltalk language, which was developed at Xerox PARC (by Alan Kay and others) in the 1970s, introduced the term object-oriented programming to represent the pervasive use of objects and messages as the basis for computation.

Page 9: Week 001.pptx

History

Smalltalk creators were influenced by the ideas introduced in Simula 67, but Smalltalk was designed to be a fully dynamic system in which classes could be created and modified dynamically rather than statically as in Simula 67.

Page 10: Week 001.pptx

History

In the mid-80s there was a resurgence of interest in object-oriented methodologies. Specifically, OOP languages such as C++ and Eifle became popular with mainstream computer programmers.

Page 11: Week 001.pptx

History

• Object-oriented programming developed as the dominant programming methodology in the early and mid 1990s when programming languages supporting the techniques became widely available.

Page 12: Week 001.pptx

History

OOP continued to grow in popularity in the 90s, most notably with the advent of Java and the huge following it attracted. And in 2002, in conjunction with the release of the .NET Framework, Microsoft introduced a new OOP language, C# (pronounced C-sharp) and revamped Visual Basic so that it is truly an OOP language.

Page 13: Week 001.pptx

What is OOP?

Object-Oriented Programming (OOP)– It is a programming paradigm that uses "objects“,

data structures consisting of data fields and methods together with their interactions.

– Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance.

Page 14: Week 001.pptx

The Characteristics of OOP

Data AbstractionEncapsulationMessagingModularityPolymorphismInheritanceGarbage Collection

Page 15: Week 001.pptx

Data Abstraction

It is the process by which data and programs are defined with a representation similar in form to its meaning (semantics), while hiding away the implementation details.

It tries to reduce and factor out details so that the programmer can focus on a few concepts at a time.

Page 16: Week 001.pptx

Encapsulation

A language mechanism for restricting access to some of the object's components.

A language construct that facilitates the bundling of data with the methods (or other functions) operating on that data

Page 17: Week 001.pptx

Messaging

Message PassingIt is a form of communication used object-

oriented programming.Processes or objects can send and receive

messages (comprising zero or more bytes, complex data structures, or even segments of code) to other processes.

Page 18: Week 001.pptx

Modularity

Modular programmingIt is a software design technique that

increases the extent to which software is composed of separate, interchangeable components called modules by breaking down program functions into modules, each of which accomplishes one function and contains everything necessary to accomplish this.

Page 19: Week 001.pptx

Polymorphism

It is the ability to create a variable, a function, or an object that has more than one form.

Page 20: Week 001.pptx

Inheritance

It is a way to reuse code of existing objects, or to establish a subtype from an existing object, or both, depending upon programming language support.

Page 21: Week 001.pptx

Garbage Collection

It is a form of automatic memory management.

It attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program.

It was invented by John McCarthy around 1959 to solve problems in Lisp.

Page 22: Week 001.pptx

Parts of OOP Program

The Program Architecture of C#

Page 23: Week 001.pptx

The Program Architecture of C#

• A C# program may contain one or more files. Any file can contain any of the following elements– Directives– Namespaces – Classes– Structs (structures)– Interfaces– Delegates– Enums (enumerations)– Function members (such as methods, properties, indexers,

and so forth)

Page 24: Week 001.pptx

Programming Fundamentals of C#

Page 25: Week 001.pptx

Data Types

• Two (2) Types of Data Types in C#:– Value types• Variables that store data values on the stack

– Reference types• Variables that store memory addresses of the data

stored on the heap

Page 26: Week 001.pptx

Built-in Data Types

Page 27: Week 001.pptx

Value Types

Page 28: Week 001.pptx

Data Types Range

Page 29: Week 001.pptx

Arithmetic, Assignments, Logical and Relational Operators

Page 30: Week 001.pptx

Operators

• The Basic Arithmetic Operators (+, –, *, /)• The Modulus Operator (%)• The Assignment Operators

Page 31: Week 001.pptx

Operators

• Increment and Decrement Operators (++, --)• Relational Operators( >,<,!=,==,>=,<=)• Logical Operators (&&, ||)• Bitwise Operators (&, |, !, ^)