What is OOP and why is it required?
In the virtual world of programming, the OOP enables us to code the real-world objects as they are. The constructs of OOP allow us to define and organise the code such that they reflect the real-world scenarios.
Wondering what I mean by real-world objects? They are cars, books, chairs, keyboards, water bottles, pens, and so on. Intuitively, one can think of these objects to be common nouns. Often these objects are characterised by specific attributes/ properties and functions that they can perform.
Consider a car, for example. It has attributes like colour, transmission type, number of seats, fuel type, and many others. The functions that a car can perform may be (self) drive, take a turn, drive reverse, lower windows, apply brakes, turn on/off the engine, play audio, and so on.
The OOP paradigm allows us to write a code that mimics the car’s exact behaviour or to say any objects. Hence, the name, object-oriented programming. It enables us to encapsulate the attributes and functions of objects.
This does not mean that other paradigms are not useful; they are, but for different types of applications. Procedural programming might be a preferred choice to create an automation script and not the OOP.
The object-oriented approach enables programmers to write clear and logical code for small and large projects alike with proper organisation.
Some of the popular Python packages that are built using this approach are:
The above list hints that the object-oriented approach enables us to develop large and complex projects with wide-ranging capabilities. At this point, we are sufficiently acquainted with what OOP is and its potential.
Stay tuned for the next installment in which Jay will discuss classes and their objects.
Visit QuantInsti to read more about this research: https://blog.quantinsti.com/object-oriented-programming-python/.
Disclosure: Interactive Brokers
Information posted on IBKR Traders’ Insight that is provided by third-parties and not by Interactive Brokers does NOT constitute a recommendation by Interactive Brokers that you should contract for the services of that third party. Third-party participants who contribute to IBKR Traders’ Insight are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.
This material is from QuantInsti and is being posted with permission from QuantInsti. The views expressed in this material are solely those of the author and/or QuantInsti and IBKR is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.