Python classes and object oriented programming (OOP) have been some of the hardest concepts thus far to fully understand. Just when I feel like I am getting closer to understanding, I learn more about OOP and have to rethink everything I know. That being said, what Matt said today combined with Nick’s help from yesterday are starting to come together into a more refined concept of classes and the strengths of OOP.
Today’s comparison in my brain is that using OOP is similar to being a project manager. One of my goals as a leader (when planning large events or guiding a team through an entrepreneurial challenge weekend) is to best utilize the people on my team. It seems there is a correlation to assigning team member tasks and creating classes.
When planning for a large event (Youth Science Summit), there are hundreds of things to be done. This one, large event is similar to the full python program/ repository. One way to accomplish all of these tasks is for me to make a list of all tasks and complete them myself. Aside from that taking a very long time, it would also be difficult for someone in the future to repeat this method. It would also be difficult to add to, change, or update such a long, unorganized list. The To Do list would be redundant (contact person 1, contact person 2,…). Python coding without classes seems similar to one large To Do list without organization; it gets the job done, but not well.
The first solution for events is to form event committees. This takes the large task of creating an entire event and subdivides it into categories. For an event, these categories may be: student recruiting, volunteer recruiting, theme, event day logistics, and event program. This is equivalent to creating classes. Each committee has a specific set of tasks it needs to accomplish, descriptions of their committee goals, deadlines, and resources. Similarly, classes have attributes (deadlines, resources, goals) and methods or functions (tasks to do).
After creating committees (classes) for an event, these classes need to be further divided. Each committee will divide tasks amongst the members of the committee. This is similar to creating inheritance classes. The sub-committees still retain the overall goal of the original committee, but have more specified tasks. A new attribute of each sub-class may be the person assigned to that class. Taking the student recruiting committee as a class example, sub-classes may include a class to create recruiting materials, a class to distribute flyers, a class to recruit at other events or libraries, and additional classes to recruit in each county (class Scott, class Fayette, class Madison). Sub-classes could have further sub-classes to recruit by middle or high school.
In this event planning, committees will execute most of the work and retain most of the information, but the project manager still needs to bring everything together. This project manager could equate to series of starting functions or be its own class. In either scenario, the project manager is where all of the various committees (classes) combine their efforts to create the final project. May I be a good project manager for my future Object Oriented Programs and well designate attributes and functions to each class.