system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Object Oriented Design

Hi.

I am currently studying computer science at university. I am a first year in need of some help.

Please could someone explain to me the main principles behind Object Oriented Design. I am finding some of the concepts hard to get my head round. 

Thanks in advance!

**EDIT 18:04: Thanks for the answers. If any of you could explain the concepts of interface and polymorphism then that would be excellent.**
gpt
It's helpful to contrast with other design philosophy. If you want to accomplish a task (especially large ones) there are many different ways of doing it. 

In procedural programming, you would just make a list of all the things that need to happen, and then just do them in order. This can be a mess for a larger project. 

Object oriented design is more structured and abstract. Typically, you break ideas up into 'objects', and then define how objects interact with each other. 

For example, say you're making a video game which has bad guys that can shoot at you. You could define a 'class', which is a template for objects. 

    class BadGuy:
        def __init__(self, damage, health):
          self.weapon_damage = damage
          self.health = health

        def attack(self, other):
          other.health -= self.weapon_damage
        
        def get_attacked(self, other):
          self.health -= other.weapon_damage
          if self.health <= 0:
            self.die()

        def die(self):
          ...

This helps to organize code immensely. Since objects share so many traits (health, damage, etc.), this lets you write the base object that can be extended and specialized from there. The __init__ function creates an object (referred to as self). For example:

    badguy1 = BadGuy(damage = 5, health = 10)
    boss = BadGuy(damage = 40, health = 120)
    badguy1.attack(boss)