Posted in

Introduction to OOPS using Salesforce

Table of Contents

Introduction to Salesforce Apex

    • What is Salesforce apex?
      • Salesforce Apex is a programming language used to develop custom functionalities and business logic in the Salesforce platform. Think of it as a tool that allows developers to create custom solutions that are specific to a particular business’s needs within the Salesforce environment.
    • Use of Salesforce apex
      • With Salesforce Apex, developers can create custom objects, automate business processes, create custom user interfaces, and integrate Salesforce with other systems. In simple terms, Apex is a way to extend the capabilities of the Salesforce platform to meet the unique needs of a business.

OOPs Concept

    • Object
    • Class
    • Abstraction
    • Inheritance
    • Polymorphism
    • Encapsulation

What is an Object?

  • Any real-world entity that has a state and behavior is known as an object. For example, a chair, pen, table, keyboard, bike, etc.
  • It can be physical or logical.
  • A Cat is an Object because it has color, height, and weight as state and speaks, walks, and sleeps as behavior
  • A table or chair is also an object because it has color, height, width &, etc.






What is a Class

→ A-Class is a Collection of Objects is a class. For Example, Vehicles, Tree, Animal
→ Class can also be defined as a blueprint from which we can create multiple individual objects.


Abstraction (What the object does)

Hiding internal (implementation) details and exposing/showcasing only the functionality is known as abstraction.
For example tv, We do not what happens behind the scene


Inheritance

When a child object acquires all the properties (variables/methods) from a parent object then it is known as inheritance.


Polymorphism

When the same task is done in a different way then it is known as Polymorphism. For Example, speaking, walking, convincing customers, playing football, youtube sessions, teaching


Encapsulation (How the Object does)

Wrapping hiding/code (Putting together) and data together into a single unit is known as encapsulation.
For example, a capsule is wrapped with different medicines.
In Salesforce, class is a perfect example of encapsulation.


  • DRY Principle
    • Do not repeat yourself
  • SOLID Principle (Intro)
    • S – Single Responsibility Principle (SRP)
    • O – Open-Closed Principle
    • L – Liskov’s Substitution Principle
    • I – Interface Segregation Principle
    • D – Dependency Inversion Principle

Complete Video

Resources

Amit Singh aka @sfdcpanther/pantherschools, a Salesforce Technical Architect, Consultant with over 8+ years of experience in Salesforce technology. 21x Certified. Blogger, Speaker, and Instructor. DevSecOps Champion

Discover more from Panther Schools

Subscribe now to keep reading and get access to the full archive.

Continue reading