This week's assigned topic is object-oriented programming, a term that comes up a lot in regards to programming. But what is it?
Well at first I had no idea, because I was a bit on the late side with starting this class. But I now have caught up and understand the concept.Object-oriented programming, or OOP, is the programming paradigm used in python. It is focused on creating objects, which have data and a behaviour. OOP allows programmers to represent abstract things in the real-world as objects in programs. OOP also allows objects to build on each other, by having classes, sub-classes and so on.
Now what exactly does all of that mean? Since that is basically a summary of what was in the readings assigned in the first week.
Well the way I found made understanding it easier is to put in terms of a real-world example. So let's say a biologist wanted to virtually represent the classification of organisms. He may make a class to represent the three domains of life, which would each have attributes that describe the domain. For example, the domain eukarya would all have more than one cell with a nucleus. Then, there would be further classifications represented in subclasses. One sub-class would be animals, which would then be broken down further into classes such as mammals. Each sub-class would inherit attributes or characteristics from its mother class, which would in turn inherit from its mother class. By using objects that can hold data and code, it gives programmers the ability to make large, complex software in an organized way.
Overall, object-oriented programming makes programmer's lives a lot easier. It organizes code and puts it into a clear-cut hierarchy, which allows for the re-use of code that would otherwise be redundant. It allows a huge, complex program to be divided up into smaller, organized pieces which remain connected to each other. I can't imagine writing code in a different way, since this is the only way I've learned, but I imagine it would be difficult without the structure that OOP provides.