A look at abstract interface

Abstraction is about producing generalizations from certain instances. A complete abstraction can be identified by the general nature entirely, because it makes no reference to particular cases. The principle of abstraction is useful for engine developers because by designing the components of the engine to be abstract as opposed to particular so that developers increase their versatility which is proportional to their degree of abstraction.

An example of this is a render manager that may be used for all games as rendering is a vital process for every games. A text renderer manager on the other hand is less abstract and more limited in scope as it’s meant to render only text.

The main principle of abstraction encourages the engine developer to think in the abstract. To encourage them to identify many particular needs of a certain case and then proceed to expand upon it. Thus the purpose of abstraction is to increase versatility of engines.

An interface is not a class. It is an entity that is defined by the word Interface. An interface doesn’t have implementation; it only has the definition of the methods without the body. Similar to the abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn’t support multiple inheritance, interfaces are utilized to implement multiple inheritance.

When we create an interface, we are basically creating a set of methods without any implementation that must be overridden by the implemented classes. They are used to define the peripheral abilities of a class. When it comes to features like multiple inheritance, a class may inherit several interfaces. Default implementation dictates that an interface cannot provide code, only signatures. Similarly they can access modifiers for the functions and properties with access modifiers, as everything is assumed as public.

If various implementations only share method signatures, it is recommended to use Interfaces as they are more efficient in this regard. If a new method is added to an Interface then we have to track down all the implementations of the interface and define implementation for the new method. A drawback is that they require more time to find the actual method and no field can be defined in interfaces.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s