Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Paradigms

Similar presentations


Presentation on theme: "Programming Paradigms"— Presentation transcript:

1 Programming Paradigms
Procedural programming Task based Revolves around writing functions (procedures) to accomplish an overall goal Supported by early programming languages C, Cobol, Fortram, Basic, … Object Oriented programming Information (data) based “Objects” represent both data and its manipulation Supported by many modern programming languages C++, Java, Python, JavaScript, …

2 Procedural programming
Task-based approach to programming Problem is broken down into a series of (sub)tasks Procedures are written to accomplish each task Data (information) manipulated by the procedures Procedures are assembled and run to accomplish overall goal Like a recipe Advantages Intuitive, can lead to fast development Disadvantages Large/evolving projects can result in code that is difficult to maintain/modify Simple changes can affect many sections of code

3 Object Oriented Programming
Object-based approach Focus is on defining data types And procedures for manipulating the data Advantages Objects are self-contained Insulated from changes to other objects Leads to better-organized, more easily supported code Disadvantages Less intuitive, requires more planning

4 Features of OOP - Encapsulation
Data stored in modular blocks called classes Data accessible via procedures also contained in the classes Internal data not directly accessible (only through procedures) Advantage: changes can be localized in an object Will not affect other parts of a program

5 Features of OOP - Inheritance
Objects can be based on another object “group” properties are inherited Existing properties can be modified New properties can be added Hierarchical Example: Animals -> Mammals -> Dogs

6 Features of OOP - Polymorphism
Behavior depends on usage Functions can be “overloaded” Different behavior for different argument lists Different behavior for different argument types or sub-types Functions can be made type-independent Via “templates”


Download ppt "Programming Paradigms"

Similar presentations


Ads by Google