37. Solo Review December 2019


solo review

Main Points On Solo Review 12.2019


Outro Music

『夜曲』 悪魔城ドラキュラX~月下の夜想曲~


Contact Me

If you enjoy this podcast, please reach me out to let me know your thoughts or simply say Hello. My (Xi’s) contact info:

Take care, until next time :)!

Transcript

AI-generated, unedited.

[00:15] Hi, this is Xi Xiao. This is yet another episode of Salesforce Way podcast. This is a solo episode, and I decided to make a solo episode each month by end of the month. So that I can spend this time to summarize the things I have learned during the past month, and also it's a way for me to document my learning journey and also share the important points that I consider worth sharing to everybody. So let's get it started for this episode. Firstly, I want to really thanks to Jay Holt twenty three who has left reviews and comments in iTunes. So he gave a really good feedback over there. He said the content of this podcast is much needed, and thanks for spending the time to prepare the content and compiling the knowledge from the experts. This is the message from Jay Holt twenty three in iTunes. I really appreciate your help. You know, leave the comments and help me to get more people to discover this podcast. And after that, I also want to share my number one challenge in 2020 year 2020 is that how to invite more guests and get more interesting topics into this podcast. So because of that, I really need help from you, my dear listeners.

[01:46] Please let me know who are the good guests and what are the good topics that you consider interesting to listen to. So please reach me out. Through my Twitter, LinkedIn, and the website, and the email, you have all the channels that you can reach me. And also in this show notes, and at the end of the show notes, you can find all this contact information. Because I really want to get the good guests and the interesting topics into this podcast, and then you want to listen to you know that's the number one most important thing. That's why I so eagerly need the help from you. So please let me know if you have any good guests or topics in your mind and you want to listen to. Please reach me out for that. Okay, that's enough. Now let's get back to the main part—the knowledge sharing. What I have learned during the past month in December 2019. So the first thing I want to share with everybody is the book. It's the Andy Fawcett's book. It's called the Salesforce Lightning Platform Enterprise Architect. I think a lot of people have heard about it now, and just three weeks ago, the third edition was published. So I purchased this book on the moment it was published, and the book is already on my bookshelf. So I skimmed through.

[03:16] So I see like twenty to thirty percent of the content updates. Now it covered not only how to write the good code. It has the new technologies from Salesforce like SF DX. Like second generation packaging information, all this good and cool stuff are also part of this book, and usually each edition of this book. Has two to three years lifecycle, right? That's a lifespan for one edition. If you now buy a book like this, then you have two to three years to to really read it through. And the good thing about this book is that it's really a well thought and. Software engineering focused, the quality focused, the book. So it's based on the financial force FF Lab library, and Andy Foster has done excellent coaching inside the book. It's a really thick book, but. You know each chapter is really worth reading, and even each page contains a lot of knowledge. So I don't recommend that you quickly digest everything because you can't understand everything at one go. So just spend your time, get the book. And read a chapter a month, and then practice a lot. So, because this book has helped me so much, it helped me to understand when you have a large scale,

[04:47] complex solution, you need to code a lot. How to really put everything in shape, and how to make sure your solution scalable and flexible. All these software engineering, you know, those golden features. It's it's well written book as well. And also, Andy Faucet was on the fifteenth episode of this podcast. So he talked about the core principle of this book, separation of concerns. So if you are interested in that topic and you want to listen to what Andy mentioned, go back to episode fifteen, listen to what he shared on that episode. Okay, that's about the book. In addition to that, I have other three messages I want to deliver. The first two are, are the Stack Overflow threads. Let me quickly go through. The first thread is about Apex. Does the DML actions? Let's say in Apex, you prepare a list of accounts, let's say, and then you want to insert these accounts or update these accounts, right? That's a really common scenario in our Apex writing, so. Typically, what I did in the past is that before doing the DML, I do a if condition check if the list is empty or not. If it's empty, I don't do the DML,

[06:17] right? Which is quite intuitive.

[06:21] If it contains records in the list, then I will do the insert or updates. Basically, that's the if condition before my insert or update. And actually, from this stack flow thread, you realize that even if it's an empty list, your code Can still so use this insert or update. So let's say you remove the if condition. No matter it's empty or it contains records, you can always use the same line of code, which is insert the list or update the list. So Apex actually it can intelligently decide whether it does the DML or not. So which means if the list is empty. Then there is no DML actions at all. So Apex was smartly decide what to do. It play fair in in a sense. So this is something I didn't know. So from now on, when I write Apex code, when I do a list of records, when I need to do insert or updates, I will not put that if conditions anymore. Really good tip, and I will put this Stack Overflow thread in the show notes if you want to check how people are discussing about this thread. And then another thing is a question I had, and I also asked in Stack Overflow. I got a good conversations over there. Is that Let's say we write Apex testing right, and

[07:52] we need to set up the data before we really execute the test. The condition. Let's assume that we need to create account records, case records. Opportunity records. That's the data setup step, and after that, we will execute our test code. The question here is that in the data setup, should we stop the trigger logic, and then? Prepare the data, so that the trigger logic is not interfering with your data preparation, or we let the trigger as it is in the platform, and then we just create the the record and let the trigger you know to to do whatever logic it does. So these two different kind of ways of doing the data setup. So there are people give comments that because the trigger is part of the Salesforce platform, it's a really like a built-in feature. So they say you should create the data with the trigger on. So the trigger should be on enabled, and when you prepare the data, the trigger should be part of your data preparation process. And there are also other people, including me, have the opinion that you could stop the trigger context when you preparing the

[09:22] data. The main argument is that you, when you do that, you don't need to think about the things outside of the the the test the scope. Let's assume you are testing something, but then you don't need to care about the account trigger context. You don't care about the case, the opportunity context, because those things basically when you it's outside of the scope of your testing. You don't need them. But those things would interfere with your code, and if you don't stop the trigger when you prepare with the data, unexpected actions would happen. Some trigger logic might change that count field, and you don't know that, and you didn't expect for that, and your test would fail all of a sudden, right? So that's the main argument. There are some other arguments on that thread. So I will put that thread in our show notes as well. So go there to check check the the discussion there. I think people have really put good comments there. So in my opinion, that if you are using a good trigger framework and the trigger framework supports to disable certain trigger contexts, like disable accounts. Disable the case or opportunity triggers. Then, by all means, you could disable them in your test data, and you just prepare the data with the test factory or data factory, something

[10:52] like that. And the last point I want to mention is that the importance of code review. So here is that I just joined the company, my current company, two months ago. And when I do my code implementation, or either, or even the technical design for implementation, I always drag somebody else around me to do the code review and the implementation review. The thing is that I really get good comments out of that each time when I ask the people. They really tell me, okay, this is a thing that you could improve. So code review, implementation review is definitely a very important things. So you don't want to rely on like the project has get has pull request. Those things things are just the tools to help you to do the review. But you have you should be like more willing to do that by yourself. You don't rely on the tools, right? And you, I definitely have seen the benefit of doing those stuff, and we keep doing in the future. It also gain the trust. It also shows that you. Want to write better code, so you. I think it's just win-win-win-win-win multiple wins by doing the reviews. So I hope this is everything I want to share in this episode. It's a shorter solo episode, and let me know how it

[12:22] goes. And in the future, I plan by end of each month I will make one solo episode just to summarize and documenting my learning journey. And hopefully, you also can learn a little bit things from here. And don't forget to check the show notes. All those links I mentioned in this episode will be in the show notes. That's it. See you next time.

[13:00] 願 望 永 遠 の

[13:05] 幸 せの 中 で

[13:10] 嘆 き 続

[13:15] 願望永遠の幸せの中で。

[13:24] 嘆き続けてた歌うの唄。愛は終わる命も尽きるセレナーラ。同じ時に。

[13:34] 糸を切って。

Leave a Reply