AbstractionAbstraction is a process that involves showing only relevant objects and code. In programming/programs we often generalise it without being specific such as when coding, this can save time by only showing the code that is relevant. For example in coding when creating subclasses you won’t create a “person class” but instead you will create subclasses like adults and children classes that are parented to the main class.
Another example would be when you’re logging on to a website it only shows relevant details like your username and password. For program/programmer, you only intend to show the user what you want them to see so like in the example, you only want to show the user space where to insert their username and password to access their account. For a program, it hides all of the calculations and all of the operations, while the pro gamer just has to input details of where they want the user to put their information.EncapsulationIn programming, the idea of encapsulating code of information is to hide and keep the information private which can only be accessed within the same class, for example, it cannot be accessed by the public. When using encapsulation, only the user creating the private data has access to it.
The information that is hidden in the internal properties is hidden within the object itself and wrapping up the data within the object. As a programmer, due to the fact that a private class is private and only the only people who have access to it, meaning it’s easier to see what went wrong and it can reduce the time spent on debugging code.PolymorphismIn coding, it gives programmers the ability to define one interface but has multiple ways to do it, just like the name suggests poly means while morph means form, in the perspective of a programmer being able to create a program in general rather than being specific with a program. As an example for animals, the animal class has a script for moving but, the with the inclusion of polymorph is how they do it, Each animal has the ability to move but they move differently. In regards to the programmer, it reduces the amount of work they have to do as an example creating AI’s to move, there can just be one script rather than coding it multiple times as they have the same attributes and properties.
When referring to polymorphism there are 2 types, static(compile time) and dynamic(runtime).Inheritance In programming, when using inheritance when you have an object and you have an existing object, the new object is able to have the properties of the existing objects. The general rule for inheritance is stating that it “is a” something. For example, In programming this would include different AI’s, while including different AI’s such as flying you are still able to have the same properties that a normal AI would have e.g. hp, shooting and specific movement patterns For a programmer this would help reduce the amount of time as they wouldn’t need to write the code multiple times if they had the same script for the object. Association When using association in programming, like inheritance has an “is a”, an association has a “has a” relationship that is based on using 2 or more objects.
For example, if 2 classes are both in a “has a” relation both the classes can exist and depend on their own and have no owner, for example, a patient and a doctor, the doctor can be seeing multiple patients and the patient is able to see multiple doctors. The 2 objects are able to still work together even though there is no owner and can work with and without. In programming an example, if you’re creating an fps game, you could include using the same type of bullets for a submachine gun and pistols. This would help save time by only needing to create this instance one then using it again for multiple submachine guns or pistols.
AggregationThis is based in the form of an association between 2 or more objects, like association, they have their own way but the main difference is that they have an owner. While the main object is the owner, the child object wouldn’t be destroyed and can still exist even though the other object has been destroyed. For example, a student has an address while, in reverse, an address does not have a student, doesn’t make sense. From the above example, if a programmer was trying to code in for example, if you want to buy a gun with money a wallet can contain money but the money doesn’t have to be in the wallet.
Objects In programming, an object performs an action such as having objects within the same class while being called instances, for example how multiple objects can be from one class even though they don’t have the same name, they have similar properties. In programming this would help out a programmer as, they can use the code again, such as if you have multiple variations of AI, you can reuse the code for walking, shooting and HP loss.ModularityA way of dividing a computer program into separate subprograms, while maintaining a logical structure to be more efficient while making it easier to edit code if necessary. When creating a modular program, it is done by a top-down design model which means that the application that is being made is created with a high level of intelligence description of what each thing is supposed to do. Breaking down each part into smaller parts to easily understand what is going but also until where function or variable has been executed. The top-down programming model is based on the shape of functions or procedures.
The functions that are broken down by the top-down design model, are separated into subsections with a defined code with a function. The set of functions can be reused and accessed easily. It has benefits such as, it can be more efficient, in terms of being able to quickly produce and develop programs, the single modules are corrected and made sure it works. Other benefits would include multiple uses of the subprograms, this means that when the code is written it can be saved and used for another instance where the same would be applied if necessary.