Successful Object-Oriented Programming (OOP) in Rust: Mastering Five Critical Concepts From Python
In object-oriented programming, the definition of OOP remains a contentious topic, with numerous computer languages vying for acceptance.
I was dishearted when I read, from several prestigious sources, that Rust was not object-oriented.
Luckily, I found the object-oriented behaviors I used in Python; I could get almost all of them in Rust. The one I could not get, inheritance, I get close enough in Rust.
Python is an object-oriented programming language, which means it supports a variety of object-oriented behaviors — five of which I detail for Python and then Rust.
Python allows you to define classes, which are user-defined types that can have attributes and methods. Objects are instances of classes that can hold specific values of their attributes.
Here is an example of an Object-Oriented Programming (OOP) “stubby” pattern for a 3D Vector in linear coordinates implemented in Python:
0 Comments