Concepts Flashcards
Interfaces
Within object-oriented design, interfaces provide layers of abstraction that simplify code and create a barrier preventing coupling to dependencies.
A system may become so coupled at multiple levels that it is no longer possible to make a change in one place without necessitating many additional changes.[1] Using an interface or an abstract class can prevent this side effect.
Encapsulation
In object-oriented programming, encapsulation refers to the bundling of data with the methods that operate on that data, or the restricting of direct access to some of an object’s components.
what are the four main theoretical principles of object-oriented programming.
Abstraction, encapsulation, polymorphism, and inheritance are the four main theoretical principles of object-oriented programming.
L
Liskov substitution principle. (srp)
A class that inherits from a base class, should be able to be used as if it was the base class.
C# Abstract Classes/methods
C# Abstraction Abstract class: is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class). Abstract method: can only be used in an abstract class, and it does not have a body. The body is provided by the derived class (inherited from).
delegates
Delegates are, essentially, function containers.
They allow you to store and call a function as if it were a variable.
Events
Events are like a notificaton that are sent out to Listeners/Subscribers who can than act on those event.
Events in Unity are a special kind of multicast delegate and, generally speaking, they work in the same way as regular delegates. However, while delegates can be called by other scripts, event delegates can only be triggered from within their own class.
Asynchronous programming
C# has a language-level asynchronous programming model, which allows for easily writing asynchronous code without having to juggle callbacks or conform to a library that supports asynchrony. It follows what is known as the Task-based Asynchronous Pattern (TAP).