Object-Oriented Programming Reviewer PDF

Document Details

UnselfishWisdom3231

Uploaded by UnselfishWisdom3231

STI College

Tags

object-oriented programming programming paradigms OOP concepts java programming

Summary

This document reviews core concepts in object-oriented programming, covering paradigms like procedural and functional programming. It defines classes, objects, methods, and related concepts such as inheritance and polymorphism. It is useful for undergraduate students.

Full Transcript

Object-oriented Programming (OOP) is one of the three (3) programming paradigms, including Procedural and Functional Programming. A programming paradigm refers to structuring and organizing code. the term “paradigm” is synonymous with “pattern”. 1. Procedural Programming (Basoc, C, C++...

Object-oriented Programming (OOP) is one of the three (3) programming paradigms, including Procedural and Functional Programming. A programming paradigm refers to structuring and organizing code. the term “paradigm” is synonymous with “pattern”. 1. Procedural Programming (Basoc, C, C++ and pascal) - operations are executed one after another in a sequence. - Defines with uses variables/ can hold data Procedures are grouped logical units based on individual operations Procedures are also called functions, modules, subroutines, and methods/ java programmers use them. 2. Functional Programming (Erlang, Scala, Haskel, and Elm) - style of programming that builds computer programs - focusing on declarations and expressions rather than the execution of statements - It aims to write code that is clearer to understand - avoiding flow-control statements such as for, while, break, continue, and goto Functions are the basic units of this programming paradigm 3. Object-oriented Programming (OOP) - an extension of procedural programming Objects representing a model of an object in the real world are the main building blocks of OOP. Writing OOP involves the following: Creating classes that are the blueprint for objects Creating objects that are specific instances of those classes Creating applications that manipulate or use those objects Java, Python, VB.NET, and C# support this programming paradigm. OOP Concepts: Class - a group or collection of objects with common properties. - basic unit of programming A class definition describes what attributes its objects will have and what those objects can do. attribute serves as properties of the object. Object - a specific and concrete instance of a class. - is an identifiable entity with some characteristics and behavior, which can be a person, place, or table of data. - features called data members and operations called function members. Method - a self-contained block of program code that carries out actions similar to a procedure in Procedural Programming. Data Abstraction - It is the act of including only essential details of an entity without including the background details. - That information is hidden from the user and is called abstracted data. Data Encapsulation - the process of wrapping up data and functions into a class. - It performs data hiding Inheritance - the ability to create classes that share the attributes and methods of existing classes but with more specific features. The class that inherits the properties of the other class is called a base class, parent class, or superclass. The class that inherits the properties from the other class is called a derived class, child class, or subclass. Polymorphism - Poly means many, while morph means forms. - It describes the feature of languages that allows the same word or symbol to be interpreted correctly Operator Loading - is the process of making an operator perform tasks in different instances. Function Overloading - is the process of two (2) or more functions with the same name but different return types or numbers of arguments. Method - is a program module containing a series of statements that carry out a task, which can be called an unlimited number of times. public – an access modifier that allows any other class to use it static – used when any method can be used without instantiating an object void – a return type used when a method returns no data return type - describes the data type the method sends back to its calling method. Method Name – can be any legal identifier for classes and variables. Parentheses – contains data to be sent to the method. A method body - contains the statements that carry out the work of the method / The body of a method is called its implementation. A complete name that includes the class is a fully qualified identifier. It includes the class name, a dot, and the method name. A class header has three (3) parts: an optional access specifier, the keyword class, and any legal identifier in naming the class, starting with an uppercase letter. Methods that retrieve values are called accessor methods or getters. Methods that set or change field values are called mutator methods or setters that conventionally start with the prefix set. The data components of a class are called data fields that are declared variables within a class but outside any method. A data field is static if it occurs once per class and non-static if it happens once per object. Constructor - is a special type of method that creates and initializes objects.

Use Quizgecko on...
Browser
Browser