Unleashing Dynamics 365 Excellence: Your Source for Pro Tips and Snippets at D365Snippets.com

Our blog provides a curated collection of tips, tricks, and code snippets that streamline your workflow and enhance your proficiency.

OOPS Concept in D365

0

OOPS Concept in  D365

Object Oriented Programming is a programming concept that works on the principle that objects are the most important part of your program. It allows users to create the objects that they want and then create methods to handle those objects. Manipulating these objects to get results is the goal of Object Oriented Programming. Object Oriented Programming popularly known as OOP, is used in a modern programming language.

If you are a beginner or new to dynamics 365 Finance & Operations, you can use Microsoft Free Virtual Machine. Learn How to Set Up a Free Virtual Machine for Dynamics 365 Development

All modern programming languages like X++, Java, C#, etc are working based on the OOP Concept. So to work as a D365 developer must learn what are the Core concepts of OOPs.

Core OOPS concepts are


Class

Class is the most important concept of oops. A class is a group of similar entities. It is only a logical component and not a physical entity. For example, if you had a class called “Expensive Cars” it could have objects like Mercedes, BMW,, etc. Its properties(data) can be the price or speed of these cars. While the methods that may be performed with these cars are driving, reverse, braking, etc.

Wherever you want to use the properties of the class you can call the instance of the class and can reuse it. This helps the reliability of codes and reduces the length of coding.

Object
An object can be defined as an instance of a class, and there can be multiple instances of a class in a program. An Object contains both the data and the function, which operates on the data. For example - chairs, bikes, markers, tables, cars, etc.
Inheritance
Inheritance is an OOPS concept in which one object acquires the properties and behaviors of the parent object. It’s creating a parent-child relationship between two classes. It offers a robust and natural mechanism for organizing and structuring of any software.
Polymorphism
Polymorphism refers to the ability of a variable, object, or function to take on multiple forms. For example, in English, the verb “run” has a different meaning if you use it with “a laptop,” “a foot race, and ”business. Here, we understand the meaning of “run” based on the other words used along with it. The same also applied to Polymorphism.
Abstraction
An abstraction is an act of representing essential features without including background details. It is a technique of creating a new data type that is suited for a specific application. For example, while driving a car, you do not have to be concerned with its internal working. Here you just need to concern about parts like the steering wheel, Gears, etc.
Encapsulation
Encapsulation is an OOP technique for wrapping the data and code. In this OOPS concept, the variables of a class are always hidden from other classes. It can only be accessed using the methods of their current class. For example - in school, a student cannot exist without a class.
Association
The association is a relationship between two objects. It defines the diversity between objects. In this OOP concept, all object have their separate lifecycle, and there is no owner. For example, many students can associate with one teacher while one student can also associate with multiple teachers.
Aggregation
In this technique, all objects have their separate lifecycle. However, there is ownership such that the child object can’t belong to another parent object. For example, consider the class/objects department and teacher. Here, a single teacher can’t belong to multiple departments, but even if we delete the department, the teacher object will never be destroyed.
Composition
A composition is a specialized form of Aggregation. It is also called a "death" relationship. Child objects do not have their lifecycle so when a parent object deletes all child objects will also delete automatically. For that, let’s take an example of House and rooms. Any house can have several rooms. One room can’t become part of two different houses. So, if you delete the house room will also be deleted.

Advantages of OOPS:

  • OOP offers easy to-understand and clear modular structure for programs.
  • Objects created for Object-Oriented Programs can be reused in other programs. Thus it saves significant development costs.
  • Large programs are difficult to write, but if the development and designing team follow the OOPS concept then they can better design with minimum flaws.
  • It also enhances program modularity because every object exists independently.

Post a Comment

0Comments
Post a Comment (0)