Stats: 3,187,683 members, 7,932,927 topics. Date: Tuesday, 27 August 2024 at 03:24 PM |
Nairaland Forum / Science/Technology / Programming / Object Oriented Programming (OOP) Tutorial (1335 Views)
Tutorial: Object Oriented Programming Paradigm For Beginners in Python / I Need Help In Object Oriented Programming / Learn Object Oriented Programming (OOP) AT SANDCROFT SOFTWARE (2) (3) (4)
Object Oriented Programming (OOP) Tutorial by Nobody: 3:50pm On Oct 29, 2019 |
Let me use this space to answer OOP related questions and also an interactive tutorial for beginners. In this tutorial, I will use PHP as case study. You can start dropping your questions.... |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 4:10pm On Oct 29, 2019 |
Did you know most software libraries are documented in OOP? so if you must work with such libraries you need to learn and understand the concept of OOP and how it can help you manage large projects. What is OOP? Object-oriented Programming is a programming language that uses classes and objects to create models based on the real world environment. An Object-oriented Programming application may use a collection of objects which will pass messages when called upon to request a specific service or information. Objects are able to pass, receive messages or process information in the form of data. One reason to use Object-oriented Programming is because it makes it easy to maintain and modify existing code as new objects are created inheriting characteristics from existing ones. This cuts down the development time considerably and makes adjusting the program much simpler. Another reason to use Object-oriented Programming is the ease of development and ability for other developers to understand the program after development. Well commented objects and classes can tell a developer the process that the developer of the program was trying to follow. It can also make additions to the program much easier for the new developer. The last reason to use Object-oriented Programming that I will mention here is the efficiency of the language. Many programming languages using Object-oriented Programming will dump or destroy unused objects or classes freeing up system memory. By doing this the system can run the program faster and more effectively. |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 4:17pm On Oct 29, 2019 |
Before we go in detail, lets define important terms related to Object Oriented Programming. Class − This is a programmer-defined data type, which includes local functions as well as local data. You can think of a class as a template for making many instances of the same kind (or class) of object. Object − An individual instance of the data structure defined by a class. You define a class once and then make many objects that belong to it. Objects are also known as instance. Member Variable − These are the variables defined inside a class. This data will be invisible to the outside of the class and can be accessed via member functions. These variables are called attribute of the object once an object is created. Member function − These are the function defined inside a class and are used to access object data. Inheritance − When a class is defined by inheriting existing function of a parent class then it is called inheritance. Here child class will inherit all or few member functions and variables of a parent class. Parent class − A class that is inherited from by another class. This is also called a base class or super class. Child Class − A class that inherits from another class. This is also called a subclass or derived class. Polymorphism − This is an object oriented concept where same function can be used for different purposes. For example function name will remain same but it take different number of arguments and can do different task. Overloading − a type of polymorphism in which some or all of operators have different implementations depending on the types of their arguments. Similarly functions can also be overloaded with different implementation. Data Abstraction − Any representation of data in which the implementation details are hidden (abstracted). Encapsulation − refers to a concept where we encapsulate all the data and member functions together to form an object. Constructor − refers to a special type of function which will be called automatically whenever there is an object formation from a class. Destructor − refers to a special type of function which will be called automatically whenever an object is deleted or goes out of scope. |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 4:54pm On Oct 29, 2019 |
zclass:In c++ destructors are not called automatically it is only in garbage collection languages that automatic destructors are implemented. C# for example |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 5:54pm On Oct 29, 2019 |
Ausrichie:hm.. OK. It is PHP we're using as case study, we all know its a garbage programming language but who cares? so long as it pays the bills |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 8:22am On Oct 30, 2019 |
zclass:I swear |
Re: Object Oriented Programming (OOP) Tutorial by bularuz(m): 9:10am On Oct 30, 2019 |
Does this have anything to do with config files |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 4:29pm On Oct 30, 2019 |
bularuz:I would say it depends. Although, in real life applications classes are not usually declared in the config file. In my next post you will learn how to declare classes. |
Re: Object Oriented Programming (OOP) Tutorial by GeoAfrikana(m): 4:36pm On Oct 30, 2019 |
Ausrichie: I hope Python isn't included ![]() |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 1:42am On May 11, 2020 |
Ausrichie:So Java is garbage? |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 10:36am On May 11, 2020 |
Cakephp:No ![]() |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 10:37am On May 11, 2020 |
GeoAfrikana:Python uses garbage collection of course to get rid of Pointers that aren't being used anymore. |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 10:52am On May 11, 2020 |
Ausrichie:OK, I get your point now. Java automatically collects unused variables (garbage) to free up the memory. I don't know about C but I no C-sharp (C#) is very similar to Java. |
Re: Object Oriented Programming (OOP) Tutorial by Nobody: 10:56am On May 11, 2020 |
Cakephp:Yah. I just said C because you use pointers in C and you get to understand the penalty of not freeing pointers before they pass out of scope. But man I love C# just wish C++ could stick their foolishness up their ass and adopt some of C's syntax. |
(1) (Reply)
Help / Programming Contest! / I Need 2 Know If My Php Mail Is Working.
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 28 |