Object oriented vs procedural vs event driven programming

Slides:



Advertisements
Similar presentations
Object Oriented Programming
Advertisements

Software Development Languages and Environments. Programming languages High level languages are problem orientated contain many English words are easier.
Programming Paradigms and languages
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
Visual Basic Introduction IDS 306 from Shelly, Cashman & Repede Microsoft Visual Basic 5: Complete Concepts and Techniques.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
C++ fundamentals.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
Unit Six Assignment 1 Chris Boardley.
Describe the application and limits of procedural, object orientated and event driven programming. 
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Object Oriented Software Development
A First Program Using C#
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Object Oriented Programming Development
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
Welcome to OBJECT ORIENTED PROGRAMMIN Date: 10/09/2014 Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.
School of Computer Science & Information Technology G6DICP - Lecture 22 The Theory of Object Oriented Programming.
Mr C Johnston ICT Teacher BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Applications Development
I Power Higher Computing Software Development Development Languages and Environments.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
1.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Object-Oriented Programming Chapter Chapter
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
1 OOP - An Introduction ISQS 6337 John R. Durrett.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Software Design and Development Languages and Environments Computing Science.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Chapter 6 : User interface design
Introduction to Object-oriented Programming
Visual Basic.NET Windows Programming
Programming paradigms
Object-Orientated Programming
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
Concepts of Object Oriented Programming
Programming Logic and Design Seventh Edition
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
CHAPTER 5 GENERAL OOP CONCEPTS.
Introduction to Visual Basic 2008 Programming
Chapter 11 Object-Oriented Design
Chapter 3: Using Methods, Classes, and Objects
A451 Theory – 7 Programming 7A, B - Algorithms.
About the Presentations
OBJECT ORIENTED PROGRAMMING overview
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Computer Programming.
Lecturer: Mukhtar Mohamed Ali “Hakaale”
VISUAL BASIC.
Learning to Program in Python
Hands-on Introduction to Visual Basic .NET
Procedural Programming
Object oriented vs procedural programming
CS285 Introduction - Visual Basic
IDE’s and Debugging.
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Object-Oriented PHP (1)
Object-Oriented Programming
Presentation transcript:

Object oriented vs procedural vs event driven programming

Procedural programming Although Java is primarily object oriented up until now all we have used it to produce is procedural code. The language C is an example of a strictly procedural language Object Oriented Programming(OOP) languages such as C++, C# and Java improve on this. Procedural programming is a list or set of instructions telling a computer what to do step by step and how to perform from the first code to the second code. (A systematic order of statements, functions and commands)

Procedural programming example code A simple C hello world program Note the complete lack of class It has a main method And other methods could be written but that’s it #include <stdio.h> int main() { printf("Hello, World!"); return 0; }

Object-Oriented Concept Object-oriented programming models the real world in terms of objects. Everything in the world can be modeled as an object. A circle is an object, a person is an object, and a Window icon is an object. Even a loan can be perceived as an object. A Java program is object-oriented because programming in Java is centered on creating objects, manipulating objects, and making objects work together.

Object-oriented Continued Objects hold information about state and behaviour: States are the characteristics of the object, or the words you would use to describe it, and usually take the form of is or has descriptors. A computer is either on or off, a chair has four legs, and you have a name. Behaviours are the things the object can do, or the actions the object can perform, and are usually verbs that end in ing. You are sitting, using a computer, and reading.

Object-oriented Example For Pac-Man, there are three objects: Pac-Man, a ghost, and a pac-dot. The ghost has states of: colour name state (eatable or not) direction speed and behaviours of: moving changing state

OO Programming example: Properties/variables (State) Methods(Behaviour)

Key features of Object Oriented Programming Abstraction Allows for simple things to represent complexity. Such as objects, classes, and variables representing more complex underlying code and data. We all know how to turn the TV on, but we don’t need to know how it works in order to enjoy it. For example in our code we could create a TV object then ask it to turn on. We don’t need to worry about how the TV object works as long as we know it has a on method within. Consider the scanner import – we don’t worry about how it works we just create a scanner object and use it when we want user input. This is important because it lets avoid repeating the same work multiple times.

Key features of Object Oriented Programming Polymorphism Allows us to use the same word to mean different things in different contexts.  The capability of a method to do different things and take on many forms based on the object that it is acting upon. In other words, polymorphism allows you define one interface (or class) and have multiple implementations. 

Key features of Object Oriented Programming Inheritance Inheritance can be defined as the process where one class acquires the properties, methods and fields of another. With the use of inheritance the information is made manageable in a hierarchical order. The class which inherits the properties of the other is known as subclass, derivedclass, childclass and the class whose properties are inherited are known as superclass, baseclass, parentclass.

Key features of Object Oriented Programming Encapsulation Encapsulation in Java is a mechanism of wrapping the data variables and code acting on the data methods together as a single unit. The variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class, therefore it is also known as data hiding. To achieve encapsulation in Java we declare the variables of a class as private. Provide public setter and getter methods to modify and view the variables values. We can re-use objects like code components or variables without allowing open access to the data system-wide.

Object Oriented example code class Cow { String size; String sex; public void moo() { System.out.println("Cow says moo."); } public class OldMacDonald { public static void main( String[] args ) { Cow maudine = new Cow(); An object is an instance of a class.

OOD vs procedural Procedural programming uses a list of instructions to tell the computer what to do step-by-step. Procedural programming relies on what’s known: Procedures: A series of computational steps to be carried out in order. Subroutines(Also know as functions/methods): Again a series of computational steps but this time they return a value. Consider how methods work in Java.

OOD vs procedural continued The design method used in procedural programming is called Top Down Design. Start with a problem (procedure) Systematically break the problem down into sub problems (sub procedures). This is called functional decomposition, which continues until a sub problem is straightforward enough to be solved by the corresponding sub procedure. The difficulties with this type of programming, is that software maintenance can be difficult and time consuming. When changes are made to the main procedure (top), those changes can cascade to the sub procedures of main, and the sub-sub procedures and so on, where the change may impact all procedures in the pyramid.

OOD vs procedural continued Object oriented programming is meant to address the difficulties with procedural programming. In object oriented programming, the main modules in a program are classes, rather than procedures. The object-oriented approach lets you create classes and objects that model real world objects. Procedural code is quicker to implement for simpler code but get’s increasingly complex and difficult to manage as the program get’s larger. OOP allows for easy re-use code enabling faster coding and managing on larger projects

Action listener triggered In Java Event Driven A button is clicked Action listener triggered Uses events as the basis for developing the software. These events can be something the users are doing — clicking on a specific button, picking an option from drop-down, typing text into a field, giving voice commands, or uploading a video — or system- generated events such as a program loading. This is an approach to programming rather than a type of programming language, it can be practiced with any programming language. Particularly beneficial to GUI design This triggers an event Action event run A piece of code runs in response

IDE(Integrated Development Environment) Designed to provide the facilities a programmers needs for software development IDE’s provide a text editor, debugger and compiler all in one application. Sometimes these can have more features than we need but are generally designed to make are coding experience as pleasant, customised and quick as possible.

IDE Examples IDE’s include: Netbeans - C, C++, Python, Perl, PHP, Java, Ruby and more Eclipse - Java, JavaScript, PHP, Python, Ruby, C, C++ and more Komodo - Perl, Python, Tcl, PHP, Ruby, Javascript and more Visual Studio - Visual C++, VB.NET, C#, F# and others Many others!

IDE: Some advantages Look and feel customisation such as themes, fonts, colours etc. Auto compiles and runs code Folder Structure for the project Provide Syntax highlighting Automatic indentation for code blocks Line numbers Auto code completion Auto code for inherited members Provide debugging functionality, identifying syntax and obvious errors Often provide GUI builders(Drag drop systems) for increased speed Plug ins for additional functionality + more

IDE: Some negatives Can create custom IDE code which is generalised and may not be compatible with other development software Can cause incompatibility with other IDE’s May require the IDE installed to run development code Can cause dependence on IDE shortcuts, creating lazy developers Uses greater system memory than text editors Some require purchasing costs or licenses Plug ins while useful don’t always provide full information about how the work

Learning Outcomes and Assessment Criteria Pass Merit Distinction LO2 Explain the characteristics of procedural, object-orientated and event-driven programming, conduct an analysis of a suitable Integrated Development Environment (IDE) P2 Give explanations of what procedural, object- orientated and event- driven paradigms are; their characteristics and the relationship between them. M2 Analyse the common features that a developer has access to in an IDE. D2 Critically evaluate the source code of an application which implements the programming paradigms, in terms of the code structure and characteristics. Assignment 2 Guidance P2 Create a 2000-2500 word report that: Covers findings regarding your research on the characteristics of different programming paradigms – procedural, object-orientated and event-driven programming. Procedural should include discussions on procedures and modularity. Object-orientated should include discussions on inheritance, polymorphism and encapsulation Event-driven programming should include discussion on event handlers. Your report should include an explanation of each paradigm and include comparisons MERIT Criteria - M2 An analysis of suitable IDEs. Consider the advantages and disadvantages of the common features. Why might you use an IDE over a text editor or vice versa. DISTINCTION Criteria - D2 Evaluate Java or other language source code that would be generated for an application using each of the paradigms