Mocking fundamentals – simple mocks without frameworks

What you have to know before giving up with mocks

hello-i-m-nik-v8pL84kvTTc-unsplash– Photo by Hello I’m Nik 🇬🇧 on Unsplash

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?

Continue reading “Mocking fundamentals – simple mocks without frameworks”

Sponsored Post Learn from the experts: Create a successful blog with our brand new courseThe WordPress.com Blog

Are you new to blogging, and do you want step-by-step guidance on how to publish and grow your blog? Learn more about our new Blogging for Beginners course and get 50% off through December 10th.

WordPress.com is excited to announce our newest offering: a course just for beginning bloggers where you’ll learn everything you need to know about blogging from the most trusted experts in the industry. We have helped millions of blogs get up and running, we know what works, and we want you to to know everything we know. This course provides all the fundamental skills and inspiration you need to get your blog started, an interactive community forum, and content updated annually.

Clarity Driven Development

A new mindset for developers

codey meditandoMay the force.com be with you

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?

Continue reading “Clarity Driven Development”

Mastering Custom Settings

“Let the games begin”

CustomSettingsStart

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!

Continue reading “Mastering Custom Settings”

One Batch Apex to rule them all (Part II)

Program to interfaces, not implementations

Watch Out!! Bulkified zone!!

In the firsts part of this post, we saw how to isolate the batch apex logic from the operations performed. You can find the full code in the versiononefirst repository.

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!

Continue reading “One Batch Apex to rule them all (Part II)”

One Batch Apex to rule them all (Part I)

Don’t repeat yourself

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?

Continue reading “One Batch Apex to rule them all (Part I)”

Welcome to version one first!

A long journey to learning.

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!