Maybe you have heard about the mocking technique a lot, but never understood very well how it works or doubted if it is really worthwhile. This article is aimed at those who do not know what the tests with mocks are and what they are for. I’ll focus on telling you about the pillars of such technique, why it is good for unit testing and how apply it in your application without the need of a framework.
Then, in a future post, I’ll show you the steps to progressively transition from integration tests to real unit tests and how to adopt the popular ApexMocks framework. That will really make the difference to your daily work. However, you’ll get better results if you first let the mocking principles to mature in your mind. Really exciting, isn’t it?
When one has been coding for a few years, there is a moment in which we look back and realize that our coding practices have changed dramatically. That turning point can take us to the dark side or the light side.
The dark side is not constructive. Perhaps it is our ego that speaks. We could defend the coding practices we adopted during our years of experience, maybe just because someone else said that was the way to go. Although we could be based on very solid arguments, we would be also missing the core concepts that made such reputed software engineer to define them. A Jedi uses the Force.com for knowledge and defense, never for attack. We could still be writing good enough code though (maybe by mistake :-D).
The light side is constructive. When we do an effort to make your code clean and easier to understand, we are thinking on someone, we still don’t know, that will be reading your code. We demonstrate empathy to the developer of that uncertain future. If you are one with the force, you’ll have taken those lessons, not as a recipe, but as the foundations of your own thinking. Your own style. You’ll be ready to appreciate the details and love the code written by those remarkable developers you support.
The programming tools or techniques help building scalable and maintainable software, but you should better have to take the pillars that made them a standard to follow for everyone. You would then be in the light side. Which one you choose, Jedi?
Custom Settings feature has remained unchanged for a long time now. You’d say ‘why change something that works so good?’. Absolutely! But are you using them correctly?
To me it’s been a long time since last time I visited the Custom Settings documentation. So I dived into it and the truth is that, it took me a couple of reads of the Custom Setting methods docs to get all the details.
At the end Custom Settings are quite easy to use once you play around a bit with them, but have some secrets you must know! I got fun finding them and I hope you do too!
But today, we are going to extend it further by making our batch apex handler able to perform a list of operations. We’ll also be adding more features and introducing some new concepts as we progress. Get ready… Let’s go!
If you have been working with apex some time, you’ll probably know what a Batch Apex is. Even, you probably created more than one batch apex class to support your most demanding processes, right?
But haven’t you being copying and pasting most of the code, to finally amend some bits of it? Don’t they look too similar at the end? Don’t look around, I won’t tell anybody you did it 🙂 It might not be as bad as it seems, because you probably wanted to provide the same user experience and error handling on all your processes. We’ll work on this now. Are you ready?
Recently, Simon Goodyear (Salesforce MVP), during a Salesforce DUG event, said: “Make the version one first“. That’s a good advice, isn’t it? Developers trend to be too perfectionist, indeed. We never feel happy enough with the code we are witting. We would be improving it forever! That sentence inspired me much and that’s because I’m creating this blog.
There are lot of places around the huge internet world were we, developers, can find tutorials, introductions, experiences, experiments, etc, about the Salesforce technology and development in general. Then, why another one?
Because, the three w’s have the information, but finding what you are looking for, and in the desired degree of depth, takes long. This is why I’ll be creating articles, in a level based way. As you have just guessed, there will be a place for the version one, being that the one with less knowledge requirements and followed by a more elaborated ones. Hopefully, some of them will fulfill your needs.
On the other hand, I have been seduced by the irresistible need of express my ideas and findings to the vast world of dev community. Hey mom! Look what I can do! So I’ll do a bit of therapy here 🙂
There will be a place for the other bloggers I admire much. I’ll gather here some of my very favorite blogs in my catablog.
Hope you find useful stuff here. Welcome, and enjoy!