Programming Language Paradigms: summary. Object-oriented programming Objects are the fundamental building blocks of a program. Interaction is structured.

Slides:



Advertisements
Similar presentations
Understand and appreciate Object Oriented Programming (OOP) Objects are self-contained modules or subroutines that contain data as well as the functions.
Advertisements

1 OBJECT-ORIENTED CONCEPTS. 2 What is an object?  An object is a software entity that mirrors the real world in some way.  A software object in OOP.
IMS1805 Systems Analysis Topic 3: Doing Analysis (continued from previous weeks)
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Inheritance Inheritance Reserved word protected Reserved word super
Classes & Objects Computer Science I Last updated 9/30/10.
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
Chapter 1 Object-Oriented System Development
Introduction To System Analysis and Design
Object Oriented System Development with VB .NET
Scripting Languages For Virtual Worlds. Outline Necessary Features Classes, Prototypes, and Mixins Static vs. Dynamic Typing Concurrency Versioning Distribution.
Stéphane Ducasse6.1 Essential Concepts Why OO? What is OO? What are the benefits? What are the KEY concepts? Basis for all the lectures.
Principles of Object-oriented Programming Programming Language Paradigms August 26, 2002.
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
Object-Oriented Databases
Prolog Prolog: Programming in Logic Prolog programs consist of clauses and rules. Declarative programming –Emphasis is on data and relations between objects.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
C++ fundamentals.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
Inheritance. © 2004 Pearson Addison-Wesley. All rights reserved 8-2 Inheritance Inheritance is a fundamental object-oriented design technique used to.
1 CS101 Introduction to Computing Lecture 19 Programming Languages.
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
Introduction To System Analysis and design
Language Evaluation Criteria
Comparison of OO Programming Languages © Jason Voegele, 2003.
Programming Languages and Paradigms Object-Oriented Programming.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Introduction to Object-oriented programming and software development Lecture 1.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
Objects and Components. The adaptive organization The competitive environment of businesses continuously changing, and the pace of that change is increasing.
OBJECT-ORIENTEDNESS KCDCC. WHAT IS OBJECT-ORIENTEDNESS? KCDCC model system as a collection of interacting objects O-O Modelling O-O Programming similar.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
An Object-Oriented Approach to Programming Logic and Design
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
Ceg860 (Prasad)L6MR1 Modularity Extendibility Reusability.
1 Chapter 10: Data Abstraction and Object Orientation Aaron Bloomfield CS 415 Fall 2005.
CS101 Introduction to Computing Lecture Programming Languages.
Introduction To System Analysis and Design
CSE 425: Object-Oriented Programming I Object-Oriented Programming A design method as well as a programming paradigm –For example, CRC cards, noun-verb.
 OOPLs  Help companies reduce complexity  Increase competition in open markets  Speeds up development  Improves maintenance, resusability, modifiability.
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
Systems Analysis and Design in a Changing World, 3rd Edition
Chapter 12 Support for Object oriented Programming.
CS 345: Programming Language Paradigms Chris Brooks HR 510 MWF 11:00-12:05.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Learners Support Publications Object Oriented Programming.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
9-Dec Dec-15  INTRODUCTION.  FEATURES OF OOP.  ORGANIZATION OF DATA & FUNCTION IN OOP.  OOP’S DESIGN.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Software testing techniques Software testing techniques Object-oriented software testing Presentation on the seminar Kaunas University of Technology.
(1) ICS 313: Programming Language Theory Chapter 12: Object Oriented Programming.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Principles of programming languages 10: Object oriented languages Isao Sasano Department of Information Science and Engineering.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Chapter 2 Principles of Programming and Software Engineering.
A Survey of Object-Oriented Concept Oscar Nierstrasz.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (2/2)
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
ISBN Chapter 12 Support for Object-Oriented Programming.
Language Paradigms CS655.
Types of Programming Languages
Presentation transcript:

Programming Language Paradigms: summary

Object-oriented programming Objects are the fundamental building blocks of a program. Interaction is structured as messages send to receivers. Receivers implement methods in response to messages.

Smalltalk Smalltalk is a pure OO language –Everything is an object. –All objects have a uniform communication structure. Method invocation is done at runtime –Dynamic binding Language, object system and development environment tightly integrated.

Inheritance One of the most popular OO features is inheritance. –Can define new classes in terms of existing classes. –This creates a class hierarchy in which subclasses take on the behavior of their parent classes. A subclass can generate new behaviors by –Defining new methods –Overriding a parent method.

Polymorphism Polymorphism is the idea that an object or method can perform the same operation on different data types. –Addition is polymorphic in most languages. Allows a programmer to write code without knowing the types of the data involved. [listOfStuff sort] <- don’t need to know what this is a list of.

Encapsulation Encapsulation provides a way of packing all the structure and behavior of an object into a single module. –Interface: the public face of an object –Implementation: How methods are carried out. Prevents users from misusing internal structure. Implementation can be changed without affecting external programs. Promotes information hiding.

Objects and Messages Everything in Smalltalk is an object. You communicate with objects via messages. The receiver of a message responds via the execution of a method. : arg1 : arg2 … myList at: 1 put: someObject

Program design Program design consists of constructing a set of objects and determining how they relate to each other. –is-A relationship –has-A relationship Suitable for complex, decomposable applications. –GUIs –Distributed systems

Smalltalk vs. Java Similarities –Integrated object system –Garbage collection –Single inheritance Differences –Smalltalk has no non-object datatypes –Smalltalk methods are weakly typed.

Smalltalk vs. C++ Similarities –Polymorphism Differences –Multiple inheritance in C++ –No Object class in C++ No typeof/getClass methods in C++ –Garbage collection –C++ is strongly typed – most binding happens at compile time. –No integrated IDE/Object system

Functional Programming Functions are the basic building blocks. A function takes zero or more inputs and returns an output –Inputs are unchanged Bottom-up programming is the dominant style. More complex functions are constructed from simpler functions. Leads to the construction of libraries and modules.

Lisp Read-eval-print loop –Arguments are evaluated at runtime. Weakly typed. Symbolic programming – able to work with either lists or symbols. Large number of built-in functions

Recursion Functional languages tend to use recursion. Divide problem into: –Base case –Recursive case. Tail recursion: recursive functions that return the final value in the base case with no other processing are tail recursive. –Can be rewritten as iteration

Lists Lists are the primary data structure –Car/first: data –Cdr/rest – pointer to the next element in the list. a b c

Applicative Programming Applicative programming is the idea of applying a function to a list of objects. Functions are first-class objects. Serves the same function as iteration –More terse and generalizable Mapcar, apply

OOP in Lisp CLOS – Common Lisp Object System Provides classes, methods –Multiple inheritance, polymorphism Implemented as generic functions –Methods are not associated specifically with a class, as in Smalltalk.

Declarative Programming Clauses are the fundamental building block. Emphasis on relations between data. Built-in inference engine handles procedural control. Implication used to direct search.

Declarative Programming Best suited for domains where relations between data members are the important factor. –Expert systems –Databases –Natural Language Goal: abstract away from procedural knowledge; focus on data.

Knowledge Representation in Prolog Facts (unit clauses): –likes(homer, beer). Constants are lower case. Names of relations are lower case. Conjunctions: –likes(homer,beer). –likes(homer,food). Statement is represented as separate Prolog clauses. <- ends with a period

Knowledge Representation in Prolog Rules –does(lisa,homework) :- likes(lisa,school). –Equivalent to: likes(lisa,school) ->does(lisa,homework) –Read as: “Lisa does homework if she likes school.” or … –“To prove that Lisa does homework, prove that she likes school.”

Overall themes: Programs as Data In both Lisp and Prolog, we saw programs that had the ability to dynamically generate new code. This allows an application an incredible amount of flexibility. Requirement: the structure of a program must be accessible and easily modifiable.

Overall themes: Abstraction Abstraction is the key to large-scale software development. Components are developed, tested, and then treated as a black box. –Used to build larger components. Key requirement: no side effects!

Overall themes: Functions as objects All of the languages we’ve studied treat functions as first-class objects. This means that functions can be passed into and returned from functions. Allows highly generic methods to be created –Sort, find, priority queue Implementation of a message can be determined at run-time

Overall themes: Language Design Adapt language to fit your problem Reduce the programmer’s cognitive burden Enhance readability/maintainability Allows for short pieces of code with a single well-defined purpose.

Overall Themes: Reuse Code reuse is one of the most important goals of software engineering. One of the primary goals of OOP and functional programming. If you find yourself building the same function more than once, generalize. –Improves readability –Reduces effort