Apex Methods & Polymorphism | Chapter 23 | Salesforce Developer Masterclass

  Рет қаралды 868

Salesforce Makes Sense

Salesforce Makes Sense

Күн бұрын

Welcome to another insightful episode of the Salesforce Developer Masterclass, titled "Apex Methods." In this video, we will explore the fundamentals of methods in Apex, Salesforce’s powerful programming language, and how they are used to encapsulate functionality within classes.
What are Apex Methods?:
Methods in Apex are blocks of code that perform a specific task or action. They can accept input parameters, process data, and return a result. Understanding how to define and use methods is essential for building modular and reusable code in Salesforce.
Key Concepts:
Method Declaration: Learn how to declare methods in Apex, including specifying access modifiers (public, private, protected, global), return types, method names, and parameters.
Method Overloading: Explore the concept of method overloading, where you can define multiple methods with the same name but different parameters, allowing for more flexible and expressive code.
Using Apex Methods:
Creating Methods: See examples of how to create methods in Apex classes, including how to define parameters and return values.
Invoking Methods: Learn how to call methods from other parts of your code, passing arguments and handling return values.
Using void Methods: Understand void methods, which do not return a value, and how they are used for actions that do not require a result.
Best Practices:
Single Responsibility Principle: Follow the principle of single responsibility, where each method should have a single, well-defined purpose.
Code Readability: Write methods that are easy to read and understand, with clear names and well-defined inputs and outputs.
Error Handling: Implement proper error handling within methods to gracefully handle exceptions and ensure the stability of your application.
Common Use Cases:
Data Processing: Methods are often used to process data, such as calculating values, transforming data, or validating inputs.
Integration: Methods can be used to encapsulate logic related to integrating with external systems, such as making HTTP requests or processing responses.
By the end of this video, you’ll have a solid understanding of how to define and use methods in Apex, enabling you to write more modular, reusable, and maintainable code in your Salesforce development projects.
Join us and take your Apex programming skills to the next level by mastering the use of methods in Salesforce.
If you want to continue learning Salesforce (for free), Subscribe Salesforce Makes Sense here
/ @salesforcemakessense
To ensure a smooth learning experience,
I have curated playlists that will help you prepare for interviews, train on specific domains and boost your Salesforce journey.
30 Scenario Based Questions:
• 30 Salesforce Scenario...
The Complete Administrator Course
• Learn Salesforce Admin...
Learn Salesforce in Bytes - Short videos on Salesforce features
• Salesforce Bytes
Learn Salesforce With Me - Topic based Explanatory Videos
• Learn Salesforce with Me
65 Salesforce Interview Questions:
• 65 Interview Questions...
100 Salesforce Interview Questions:
• 100 Salesforce Intervi...
If you would like to acknowledge my efforts and want me to continue training and mentoring, you can support me here.
www.buymeacoff...
For any kind of questions, training & mentorship, queries & concerns,
Feel free to drop a mail at
salesforcemakessense@gmail.com
That’s all from this video. See you in the next video. Till then, breathe long and keep learning :)

Пікірлер: 18
@ayeshafathima2728
@ayeshafathima2728 3 ай бұрын
Thank you Himanshu.
@salesforcemakessense
@salesforcemakessense 3 ай бұрын
New video coming up Monday!
@Govindverma-wb4bn
@Govindverma-wb4bn 3 ай бұрын
Great Explanation
@salesforcemakessense
@salesforcemakessense 3 ай бұрын
Thank you 🙏
@SachinM1985
@SachinM1985 4 ай бұрын
Hi Sir, Thank your efforts. Example of Protected: My Debit card is private, no one can withraw cash from it, but If I share pin to my friend or family member they can do it so. The protected access modifier is much more like private than public. In fact, for a class which is not virtual nor abstract, this access modifier would be the same as private (though it's not allowed). However, once you allow extension of the class, you can then see it in overriding implementations.
@salesforcemakessense
@salesforcemakessense 3 ай бұрын
Very well explained and written Sachin! Awesome 👌
@bhawanasharma6966
@bhawanasharma6966 7 күн бұрын
Hey himanshu, will you also create Asynchronous Apex course. It will be really helpful
@salesforcemakessense
@salesforcemakessense 7 күн бұрын
@@bhawanasharma6966 yes, it will be part of this playlist as you continue the lectures
@Dudez_gaming
@Dudez_gaming 4 ай бұрын
Plz explain about instantiation in detail 😢
@salesforcemakessense
@salesforcemakessense 4 ай бұрын
You willl more about it in tomorrow's videos :)
@sowmyagunduboyina5370
@sowmyagunduboyina5370 4 ай бұрын
Hi Himanshu, If there is a full tutorial on the salesforce developer master class on Udemy, please provide the link. I will buy the course. I can't wait for the day-to-day videos to be posted on KZbin. I hope you will provide the full course Thanks for providing the course i have watched all your videos your explanation is soo good . Thank you!
@salesforcemakessense
@salesforcemakessense 4 ай бұрын
Sorry Soumya, this is an ongoing series, meaning its not available already. If it were I would have released it entirely. I am releasing videos as soon as I can based on my bandwidth, but if you are looking for a full course please check other courses as this series will run and complete by June end and only then the entire curriculum will be available Hope you understand 🙂
@salesforcemakessense
@salesforcemakessense 4 ай бұрын
Hi Sowmya, uploading 3 videos instead of one a day tomorrow, hope that helps speed up your learning :)
@ravigrover1923
@ravigrover1923 4 ай бұрын
public with sharing class AgeFinder { public static Integer ageFinderInYears(Date birthDate) { // subtract the date provided from current date and divide by usual number of days in one year i.e. 365 return birthDate.daysBetween(Date.today()) / 365; } }
@salesforcemakessense
@salesforcemakessense 4 ай бұрын
Code looks good. But, I see you have used with sharing keyword. What does that mean?
@ravigrover1923
@ravigrover1923 4 ай бұрын
@@salesforcemakessense Thanks , vscode added it when class was created, not me.
@ravigrover1923
@ravigrover1923 4 ай бұрын
public with sharing class DiscountCalculator { public Decimal sellingPrice; public Decimal costPrice; public Integer discount; // a method which will find the new selling price after the provided discount is applied public static Decimal priceAfterDiscountApplied(Decimal costPrice,Integer discount){ // a validation for costPrice should be greather than 100 otherwise no discount applied // a validation that the discount value cannot be more than 50 Decimal priceAfterDiscount = 0; if(costPrice < 100 || discount >= 50){ priceAfterDiscount = costPrice; return priceAfterDiscount; } else{ Decimal sellingPrice = costPrice - (costPrice * discount / 100); return sellingPrice; } } }
@salesforcemakessense
@salesforcemakessense 4 ай бұрын
Good to see readable useful comments added with the code. Good practice always :)
Constructors in Apex | Chapter 24 |  Salesforce Developer Masterclass
38:02
Salesforce Makes Sense
Рет қаралды 928
Extends Keyword in Apex | Chapter 26 |  Salesforce Developer Masterclass
13:57
Touching Act of Kindness Brings Hope to the Homeless #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 19 МЛН
大家都拉出了什么#小丑 #shorts
00:35
好人小丑
Рет қаралды 94 МЛН
Debug Logs - Explained | Chapter 92 |  Salesforce Developer Masterclass
36:20
Salesforce Makes Sense
Рет қаралды 239
Static vs Non-Static Variables and Methods In Java - Full Simple Tutorial
11:29
Introduction | Chapter 1 | Salesforce Developer Masterclass
18:36
Salesforce Makes Sense
Рет қаралды 3,7 М.