Salesforce TDD (Test-Driven Development)

Disclaimer: The following is written on the basis of what has worked for me in the past. This is not intended to be a formal or exhaustive description. Use it as you see fit, I do not take any responsibility if you screw it up! 🙂

Hi, I’m Diego and I have several years (I prefer not to say how many, but let’s say “enough”) working in Salesforce. I am also an Agile enthusiast and lover of applying related techniques throughout my work.

I’ve found test-driven development (TDD) can be a great technique for building robust software, but when we work in Salesforce, I find some constraints or restrictions can make it frustrating. In this post, I’m going to show when and how I use TDD while coding in Salesforce.

Let’s start at the beginning:

What is TDD?

TDD is an Agile development technique that requires you to write a failing unit test before writing any “production code.”

How are you supposed to do TDD?

First I’ll describe how TDD is done in general (this is the way to go in languages like Java).

  1. Write a unit test and make it fail (a compilation error is considered a failing test). Write no more lines of code than needed.
  2. Write the least possible production code lines to make the test pass (fixing a compilation error is considered a pass test).
  3. Refactor the code.
  4. Repeat until you are done.

Let’s check out an example in Java so you see how it works. In this example, we wanna create an advanced calculator of integers.

We work in split view when doing TDD


Let’s write a failing unit test:

Oops, MyCalculator is not defined yet, compilation issue…therefore, it is a failing test.

Let’s make the test pass:

Compilation problem fixed! The test is passing again. Woohoo!

No tons of code to refactor. 


Let’s continue with that test to make it fail again.

Mmm…getOpposite is not defined, ergo compilation issue, ergo failing test.

Let’s fix that. Let’s write the minimum code to fix the test:

getOpposite is defined and returns 0 to any parameter (in particular, 0). Test is passing again!!!

Let’s refactor.

We still don’t have much code to refactor, but there are some name changes we could use to make code easier to read ( yup, yup, yup…unit test code is code, too).

Much better now! 😀

Round 3

Let’s add a new minimum test to fail.

Right now, getOpposite returns 0 to any parameter… it’s a fail!

Let’s write the minimum code required to make the test pass.

Yay! It’s green again! Let’s continue.

Round 4

Let’s add a new failing test.

Last test fail (we are return 0 to any value different than 1), so now we need to write the minimum code to fix this test:

Test is passing again… but this solution is not good, let’s refactor.

Tests are still passing and we solve all the cases! We are done! Well, not actually, we still need to document, test more, write more tests and write even more tests…but we’re on the right path.

I expect this silly example gives you a feel for what TDD is and how it is done.

Now, let’s continue with the discussion, focused on Salesforce.

TDD Advantages

  • Code coverage: We get great code coverage without even thinking about it.
  • Testability: The code is designed to be testable by default (we are actually testing every time we change something).
  • Easier to refactor: We should not change or refactor code without having a set of tests we can lean on. As we are constantly writing tests that we know are able to catch bugs (we make it fail at the beginning), we know that we have a set we can rely on.
  • “Better” code: We are constantly refactoring the code, striving for the best possible code.
  • Predictability: After we finish a “round,” we are completely sure the code is working as we designed it to work and we know we didn’t break anything. We can say we have “working software.”
  • Prevents useless work in Salesforce: In Salesforce, aside from Apex, we have plenty of options to make changes like triggers, workflow rules, process builder, etc. Imagine that after we write a test that changes a value on a contact record, it passes. We could discover that there is another moving part that is taking care of that change (or we wrote the test badly).
  • Documentation: Tests are a great tool to communicate with other developers (or the future you) how, for example, a class API should be called and the expected results of each case.

TDD Disadvantages

  • Overtrust: It happens to me that, as we are testing continuously and we are getting test green, I sometimes have a feeling that the code is working perfectly…but it doesn’t mean it is. We may miss, or simply get lazy, and leave a case out of the unit test.
  • Slow in Salesforce: TDD is designed based on the theory that compiling or writing a test is really fast (a jUnit unit test has to run in less than 1ms). In Salesforce, we need several seconds to compile (the code is compiled on the server) and several more seconds to run the test. In my opinion, this is usually 10+ seconds. As we are compiling and running tests constantly, we add several minutes of “waiting for Salesforce.” However, this can be mitigated if you think you will need to write/compile/execute tests later anyway – you might as well do it upfront.

Me when I realize the QA found a case I had not considered when I was doing TDD

I will (probably) use TDD when…

In general, I’ve found that TDD is a great tool in several circumstances and I tend to do it almost always in the below cases.

  • Back-end bug fixes: Doing TDD in this context has two big advantages. First, you make sure you are able to reproduce the bug consistently. Second, and even more important, as you are writing a test specific to the bug, you know you will never introduce that bug again.
  • Back-end work with clear requirements and a clear implementation strategy: In this context, writing tests is going to be easy and implementing the production code will be easy, too, as you know where you are heading when you create the test cases.
  • Back-end work with clear requirements and minor implementation unknowns: In this context, the test is easy to write and the production code may be getting clearer as you move into cases.
  • Back-end work with some requirements discovery: Imagine in our calculator example you write a test to divide by zero and you realize you’ve never discussed that case with the BA. TDD helps you discover opportunities to clarify requirements.

I might do TDD, but it’s unlikely…

  • As part of requirements discovery: You could write unit tests as part of requirements discovery, and discuss it with your stakeholders, BA, or other technical people, but you probably have better techniques to support this process.
  • Front-end work: I’m gonna discuss this briefly later, when we talk about Lightning web components.

I will never do TDD when…

  • I’m doing a prototype: By definition, a prototype or PoC should be discarded after we show it, so I code it as fast as I can, focused on demonstrating the core functionality.
  • I’m experimenting: If I’m trying a new idea, I don’t focus on code quality (again, this is a prototype).
  • I’m evaluating implementation options: There are some cases where you want to compare two implementation options, so focus on having a good-enough-to-decide prototype and throw it away after you decide…then do the stuff well.
  • I don’t care about code quality: I know code quality is not usually negotiable, but in very limited and extreme situations, it may not be the top priority. For example, when everything is screwed up on prod and you need to fix the problem ASAP because the company is losing millions of dollars per minute. In this very extreme circumstance, fix the problem as fast as you can, make your company earn money again, go to sleep (or maybe get a drink) and tomorrow at 10 am (yup, after a stressful night, start working a little later the next day) make the code beautiful with TDD. Make a test that reproduces the bug and then fix and refactor the code properly.

Me again, but on one of THOSE nights.

  • When creating test code is extremely difficult (but not possible): In Salesforce there are a few elements that are very hard to test, like working with CMT. In this scenario, I’d probably split the problem into two parts – one that is TDD-doable using mocking data (@TestVisible is your best friend here) and a second, smaller part that I’d consider how to test later (if I even consider it).

How I do TDD in Salesforce

I really don’t do TDD as I defined at the beginning of this article when I’m working in Salesforce. Why? Mainly because of the slower compile/test flow, but also because in Apex we generally start writing integration tests instead of unit tests. Instead of “regular” TDD, I tweaked the formula a bit to work better under Salesforce circumstances.

  1. Write an entire deployable test that checks the flow or use case. Yup, I said deployable, so if I called a method I haven’t created yet, I will create it, empty, so I can deploy.
  2. Run it and get a failure.
  3. Write the minimum code that makes that test pass.
  4. Refactor.
  5. Continue with the next flow or use case.
  6. When I’m done with all the flows and use cases, I refactor the code again (splitting methods, checking code cleanliness, documentation). I run the unit test continuously, every few changes to check if everything continues to work as expected.

To make everything clear, let’s view an <could-be-real-world> example.

As a user, I want the values stored in any object copied into a number of specified contact fields. The specified “mappings” will be stored in a CustomMetadataType called Contact_Mappings__cmt. The Contact_Mappings_cmt has two fields:

  • Original_Fields__c Text
  • Mapped_Fields__c Text

Round 1
As I said before, I should start writing an Apex test that tests a business case. The first thing I’m thinking of developing is “The contact should not change if there is no mapping defined.” I have to write a deployable test that is going to fail with the minimum amount of code to make it fail:

We work in split view

As expected, the code deploys but the test fails. So, we need to fix it! We can simply return the same object.

Now It passes, but we don’t have a lot of code to refactor (we could extract some constants in the test).

This is a much better test.

Test still passes!

Round 2

Okay, let’s add another case. What if we check that the User.LastName is copied into the contact when I define the Mapping Lastname => Lastname? Great idea, let’s do it!

I start to write the unit test but…. I realize I can’t do an Insert in a CMT. Or, I give seeAllData permission to the test and define it in the project metadata. Or, I have to somehow deploy it. 

Remember that I said that I don’t do TDD when writing the test is extremely hard? Well, it looks like I’m in one of those situations. At this moment, I can quit writing this blog post and go cry…or I can redefine what I am developing with TDD, leaving all the complexities outside of scope. I imagine you would be very annoyed after reading this far to see me just quit, so let’s go with the second option.

I can’t use the CMT right now, so let’s do something different. What if we use a Map<String, String> where the key is the field in the original object and the value is the list of fields names in the Contact Object. It might work, later on we just need to read the CMT and create a Map with that information, but spoiler alert…that won’t be covered in this article.

But okay, great, let’s create a map and write the deployable failing test.

And as it was expected… it fails.

Let’s write the “minimum” code that makes that test pass

Our new test passes, but the other one failed! Let’s fix that.

Let’s do some refactoring, either in test or production code.

I think the put/get part is messy to read (and has its own meaning), so let’s split it into its own method.

Also, as we want that theMap could be injected into test case scenarios, the @TestVisible annotation is useful here.

Round 3

Now we should add a new test that executes a new flow and see it fail. I think you got the idea, so I won’t do it now, but just to specify the cases, I can think:

  • Mapping a field to multiple fields (separated by colon)
  • Does nothing if origin field is wrong
  • Does nothing if destination field is wrong
  • Does nothing if types are not compatible
    …and so on

Can we do TDD in Lightning web components (or front-end)?

The short answer is yes, we can. 
Long answer: As the Jest test can’t see the objects, but they see only the “generated DOM”, it may be harder to do TDD in an efficient way for front-end solutions. Usually, it is better to test visual code by watching the result and THEN write the tests we need to ensure code won’t break in the future.


TDD is a best practice that’s good to master so that you can decide the best moment to apply it (I don’t believe there is One Ring to rule them all, One Ring to find them, One Ring to bring them all, and in the darkness bind them, thank you J.R.R. Tolkien). Applied correctly it will make you produce better, more robust code…and fewer bugs, which means…

Homer is happy

Why Become a Certified MuleSoft Developer

Interested in obtaining your first MuleSoft certification, but still have some questions about it? Ana, a developer in our Ecuador office has some answers:

What is the advantage of learning MuleSoft?

The most important advantage that MuleSoft has against other platforms is that it allows you to easily develop and manage APIs. You can even drag and drop components and integrate systems. With MuleSoft Anypoint™ Exchange you can add your APIs to a marketplace to reach a broader audience. That same marketplace gives you connectors that can make your life easier. For example, MuleSoft gives you the ability to use a Facebook or a Salesforce package, so you can integrate systems more easily.

Do you have to be a programmer?

Knowing how to code, or at least understanding how to do it, is useful because it helps you better understand certain topics in the MuleSoft training. For example, DataWeave, or try-catch blocks for error handling, and other concepts like that are things you will need to know to be successful.

Do I have to know a specific programming language to learn MuleSoft?

You don’t need to know any specific programming language. But you just have to know how to code, that should be all you need.

How does MuleSoft help companies to grow?

When a company needs to integrate systems, MuleSoft gives them an advantage. With pre-built connectors, MuleSoft makes it easier to connect those systems without having to write a large amount of custom code. Also, if a company wants to produce its own APIs and possibly sell them, the MuleSoft Anypoint Platform makes that easier. They can even use MuleSoft Anypoint API Community Manager to create a Salesforce Experience Cloud community for API developers, which can help quickly grow adoption for the APIs.

Are there any prerequisites to have before someone takes the MuleSoft certification? 

It’s important to understand programming and know a bit about APIs, like what they are, how they’re used, and why you’d use them.  MuleSoft certification is not very difficult as long as you know your basics. 

It is possible to achieve the certification by myself?

Of course, it’s possible. And it’s a great opportunity since the course is free. To start, go to the training page and sign up. If you pass the training, then the exam is free.  You should take advantage of this opportunity! Just remember, you need some experience with coding to know the terms and to understand DataWeave. It shouldn’t be too challenging for you.

What is the best API?

Which API is best depends on the project you’re working on. So maybe, if you want to incorporate a map in your system, consuming the Google Maps API would be the best solution for you (if it complies with all the requirements you need to meet).

What is the next step after you earn the MuleSoft developer certification Level I – Mule 4?

After you achieve your certification, your next step could be to go for the  Integration Architect certification. In my case, I want to gain more experience with MuleSoft projects before I become a certified Integration Architect. For that certification, MuleSoft has training that can help you, but it is not free. 

How long does it take to get MuleSoft certified?

That’s a great question, but it really depends on you. You could finish this course in five days if you are 100% committed, but you can also use other kinds of resources. Just to be sure you are ready before you take the exam. So it could take, five days, one week, two weeks, it all depends on you and the time and effort you put into it.

Here are some great resources that helped me: 

In which kind of projects can I use MuleSoft?

You will use MuleSoft only for projects that require integrating systems. For example, if in your project you integrate a database and then you want to use that data in another system, you can use a specific API for that. But it really depends on the project and your requirements.

As a front-end developer, do you think it is useful? or is it only used in the back-end?

I think that as a front-end or a back-end developer it could be very useful to have a full understanding of what MuleSoft can do. So it’s worth getting this certification to give yourself a better understanding. As I said, this is a huge opportunity and the exam is free,  so you must take it!

If you want to know more, watch the webinar about MuleSoft certification and Ana’s experience.

Interested in learning more? Check out some of our latest MuleSoft articles:

Grow your Career as a MuleSoft Developer

Ana A. has been working as a developer on our team in Ecuador for more than six months. In this time she has achieved her Salesforce Platform Developer I and MuleSoft Developer – Level 1 certification. Let’s look at what MuleSoft does and why getting certified is a good career move.

Understanding APIs

To understand MuleSoft, it is important to understand what an API is. API stands for Application Programming Interface. It’s like a user interface but is not built for humans to understand, it is built for software. MuleSoft allows the software to connect with other applications. To sum it up, MuleSoft is an API and integration platform that allows businesses to connect their data, applications, and devices with others. The entire MuleSoft Anypoint Platform™ is designed to make it easier to create, maintain, and share APIs. They’ve created an entire API ecosystem around it, expanding the API ecosystem to include not only software developers but non-developers like Salesforce administrators with MuleSoft Composer for Salesforce.  

Importance of integrations

You’re probably asking yourself, why are these APIs so important? In MuleSoft’s recent survey of global IT leaders, they found that “the average enterprise has its data scattered across as many as 900 different systems, some of which don’t even belong to the organization.”  Combine that with their estimate that enterprises spend $3.5 million USD per year on integration, and you’ll see that there is an incredible opportunity for developers certified on integration ecosystems like MuleSoft.  The first step in getting the certification is to understand all of the MuleSoft capabilities, features, and tools.

Certification MuleSoft Developer – Level 1 (Mule 4)

There are four MuleSoft certification paths you can follow.  We are just going to focus on just the developer path. To start working on your first certification, Ana highly recommends taking the course Anypoint Platform Development: Fundamentals (Mule 4). This course has 13 modules and is composed of videos, walkthroughs, model quizzes, surveys, do-it-yourself exercises, and a self-assessment quiz. For you to complete this course, you must finish every part, then score over 70% of the self-assessment quiz. The best part of this course is that MuleSoft allows you to make two attempts at the certification for free. Ana also complemented her study with these additional resources: 

The easiest thing about MuleSoft for Ana was learning how to design an API with RAML, which is a RESTful API modeling language that is easy to learn. In Anypoint Platform, you will find the design center, the exchange tool, and the API manager. Ana enjoys working with the platform because it is very intuitive. It even lets you design and implement APIs using drag and drop components.

The most difficult part of getting certified for her was the error handling topic and order of execution. Order of execution can vary depending on the flow you’re building or if the calling flow has scope for error handling, but she was able to master the subject with the additional training resources shared above.

Salesforce and MuleSoft

If you’re a developer already working with Salesforce, you’ll be interested to know that MuleSoft has a Salesforce module with many connectors. It allows you to build an API that can manage a Salesforce org, database operations, or metadata operations like creating, updating, inserting, or deleting records and more. An example would be a connector called ‘create a record’ , which allows the API to create a record (or whenever an object is needed) specifying the configuration or a specific organization.

The MuleSoft Anypoint Platform also works with Salesforce Experience Cloud through a managed package called MuleSoft Anypoint API Community Manager. It allows companies to create developer communities around the APIs they are managing with Anypoint Platform. This helps them better manage access to their APIs and it helps their developer communities more easily adopt those APIs, and a great advantage is that the company can brand their APIs.

Training at Oktana 

When Ana was studying for this certification, she heard a lot about the power of MuleSoft, and how this could improve her career, so she wanted to try it. 

“Oktana helped me a lot with all the resources to start my training. I also had a mentor in the company, so he helped me every time I had a question. This was very helpful”.

Ana A.

Our team is constantly growing, in Ecuador and across the Americas. If you want to enhance your career with Salesforce and MuleSoft, apply for one of our open opportunities. Our training team works closely with the developers to help them achieve their certifications, just like Ana did. 

Tips for your first MuleSoft certification

  • Every time you finish a module in the MuleSoft course, play around with Anypoint Studio. Practice creating new flows with different connectors that you learned in the course. That way you can debug them and understand how the order of execution works for each component or connector. 
  • The exam has many questions about the order of execution, so make sure you understand that properly. 
  • Ana encountered problems installing the exam proctor software on Mac, she recommends taking your exam on a Windows system to make things easier. 

If you want to know more about MuleSoft, we recommend reading about our latest MuleSoft projects to get a better understanding of the great things you can achieve. 

Why become a Salesforce Developer in Bolivia

Thinking about a tech career? There are a lot of different directions, but the  Salesforce developer path is one that will enable you to quickly get started and expose you to numerous technologies as you work with companies to integrate and customize Salesforce. While a coding background is definitely helpful, Salesforce is a really good place to start your tech career.

You can explore this career path from the perspective of two of our Salesforce developers, Erwin and Sergio. They’re both new to Salesforce development, having joined Oktana Bolivia in 2020. They deserve an extra round of applause since their team started remotely during the COVID-19 pandemic!

In Bolivia, very few people know about Salesforce which surprises most of our team because they can see it’s a platform with a lot of potential. Because of its size and complexity, with so many different products, learning Salesforce on your own can be intimidating, but Erwin and Sergio have found that the learning materials and coaching provided by their trainer made everything much easier. 

Since childhood, both Erwin and Sergio showed a strong interest in technology, especially video game creation. This passion eventually led them both to software development. Before they joined Oktana, they had never worked with Salesforce, but had gained experience with different languages like Angular, C++, and Java. 

Similarities with common programming languages

Now that they have been working with the platform for several months, they have found some similarities with common programming languages:

  • Salesforce uses Apex, a proprietary language very similar to Java. The syntax is Java, but simpler.
  • The same happens with Lightning Web Components. They have a Java base, making their creation easier for Java developers.
  • The way Salesforce manages data is by storing everything in metadata. You can manipulate it using SOQL, which is similar to SQL.

Benefits of Salesforce

As a Salesforce developer, you help businesses by helping them integrate with a secure and scalable platform that’s easy to customize and upgrade without anything breaking. From the point of view of our Oktana Bolivia, here are some additional benefits of Salesforce:

  • Efficient: With just clicks, you can create a structure very quickly. Comparing it with other programming languages where you have to create the database from scratch, using Salesforce is much easier because the database structure is already created for you. Also, the way Salesforce organizes your information is great. If you have to make a change in Salesforce, and if you setup your metadata correctly, it is simpler to reorganize it, saving a lot of time.
  • Drag & drop page layouts: Salesforce lets you move fast by dragging elements and following defined steps which allows you to focus on other development.
  • Mobile: Salesforce offers a mobile application that lets you work like you would in the browser. When you build functionality for Salesforce, it can be made immediately available on the Salesforce app, so you don’t need to build a separate mobile app. 
  • Platform: The Salesforce platform is very intuitive. Salesforce teaches you to think about the easiest way to solve a problem, so it’s quite easy to follow this trend. For example, if you start working with Lightning Web Components, when you get some practice, you learn to create components one on top of the other and that interact within the same page, understanding how the components communicate with each other.
  • Environments: Salesforce already has everything hosted for you. It’s easier to develop in a sandbox environment, then upload it later to production. You don’t have to deploy, just take it to a sandbox to upload it later to a host and then production.

Salesforce best practices

On the other hand, working with Salesforce forces you to learn good programming practices like:

  • When you develop with Salesforce, it forces you to be more orderly and develop in the most optimal way possible, so your code is not chaotic. It’s really how you should program on any platform in any language.
  • Likewise, all the out-of-the-box tools are very well made and give you ideas of how you should develop if you aren’t working in Salesforce.

“I consider that the creators of Salesforce are THE BEST, they thought it through very well, and you learn from this.”

Erwin M – Developer

Challenges while learning Salesforce

Maybe the toughest thing is the declarative part of the flows. Salesforce has tools to automate data management. One is the Process Builder where you can develop with clicks, also with the Flow Builder, which allows you to create complex solutions all with clicks, too. In the beginning, it can be a bit complicated to select the right tool for each type of request, but with practice, you get to know everything that Salesforce offers and can do.

Plus, at Oktana, with the onboarding training and experience on different practice projects, you have an excellent base to get to know Salesforce much better. 

“There is a lot of information about Salesforce, so it is difficult to know everything, but with practice, you gradually get used to using this platform”  

Sergio Z – Developer

Why should you become a Salesforce Developer?

Erwin and Sergio highly recommend taking this career path, because it allows you to create different types of solutions, learn good practices and it’s a great way to start learning a different form of programming. Also, there is a lot of demand related to this career. 

It’s not necessary to have previous knowledge of Salesforce before starting this career path. If you know the basics of programming, that is enough. But, it does facilitate learning to have prior knowledge of web development, JavaScript, or basic Java (or C#).

What it’s like working with other cultures

Erwin and Sergio think it’s great, and fascinating, to work with people across several countries – every day they learn about the customs, food, culture, and places they would love to visit in Ecuador, Paraguay, Peru, Uruguay, and the United States. They also learn many of the similarities between countries. 

Something funny Erwin found when he started working at Oktana was that he had thought Salesforce was a simple and straightforward CRM tool, but after training and working with it, he was completely surprised by the size and potential of the platform. For Sergio, when he started working at Oktana, it was the first time he had worked with a Mac as a working tool. He thinks it isn’t as bad as some comments he’s heard from those who don’t use Macs, it has quite interesting and useful things.

It has been interesting getting started at a new job, learning new technologies, during COVID. For example, for Erwin, it was interesting several paid events around the world that used to take place in person, are now broadcast over the internet for free, allowing people to know and learn much more about Salesforce and new technologies for developing software. In the case of Sergio, working completely from home has great advantages. The fact of literally getting out of bed and taking a couple of steps to be in your work area, instead of taking a bus to go to the office, is really motivating. It’s also really relaxing too, at the end of the day, simply log your hours and close your Mac to be at home and rest. 

We’re still growing! If you’re interested in becoming a Salesforce developer in Bolivia, check out some of the Salesforce Certification articles we’ve put together and our current open Salesforce developer positions in Bolivia.

Why become an Android Developer?

Android, Inc. was founded in 2003 and, as you may or may not know, acquired by Google in 2005. Android is an operating system and programming platform now developed by Google for smartphones and other mobile devices like tablets. Given this, many developers have chosen to specialize in Android. We talked with Amancaya, one of our Android developers, about why she chose this career path. 

Amancaya was always interested in technology and started her development career in Sucre, Bolivia. At that time, many different tech communities existed,  and one, GDG Sucre, invited her to join. As a participant in their community, Amancaya started to learn and share new technologies she discovered. (Fun Fact: Erwin, another member of the Oktana Bolivia family, is also part of this community.)

Since joining Oktana, Amancaya has contributed to a project involving Android app development for a leading US-based weight-loss program.

Why become an Android developer?

If mobile is what you like, you won’t regret becoming an Android developer. In the case of Amancaya, it was frustrating to learn JavaScript because it isn’t so flexible and she appreciates a very well-established structure. Kotlin, on the other hand, combines object-oriented (a paradigm in which you have to think about objects at the time of development) and functional programming features that are more comfortable to her style. Java is also a good starting point for an Android developer.

When she started to learn about Android development, the only information she found was about other web developers and frameworks. In Sucre, Bolivia not many people do mobile development, everything is more web-oriented, so this further complicated her path at the start. Now there is a much stronger global community of Android developers sharing tricks and tips, so it’s much easier to feel supported and get answers when you need them.

The most important thing in getting started is that you feel comfortable with Kotlin or Java.

Kotlin vs Java

Kotlin was designed with Java interoperability in mind, you can include Kotlin code in your Android app in any way you want. Java can be called from Kotlin in a natural way and vice versa. Both languages ​​are very similar, that’s why both are the favorites of the developers, but there are some differences:

  • Kotlin provides the ability to extend a class with new functionality without having to inherit from the class or use design patterns such as Decorator. This is done via special declarations called extensions.
  • Any chunk of code written in Kotlin is much smaller compared to Java, as it is less verbose.
  • Kotlin compiles the code into a bytecode which can be executed in the JVM. So, all libraries and frameworks made in Java can be moved and run in a Kotlin project.
  • Kotlin is not as popular, so the developer community is sparse compared to other well-established languages ​​like Java. 

You can read more about Kotlin and Java here

Android developers in Bolivia 

In Bolivia, the Android community is gradually growing, and exists in different communities across many cities in Bolivia, including Kotlin User Groups en La Paz, Cochabamba and El Alto, GDG Android Bolivia. These communities host regular talks and workshops to help more people learn about mobile development and Android development, to grow the Android developer community in Bolivia.

Another group of developers exists that is starting to specialize in Flutter, which is a new open-source mobile software development kit that can be used to build native-looking Android and iOS applications from the same code base. 

Also, if you are interested in learning more about mobile development, read about one of our latest projects

At Oktana, our team of mobile developers is growing, check our current open positions. In Amancaya’s words:

“The people who work on my project are very good. I have learned a lot and every day I learn more. My team explains things to me when I need them to, it’s been a great experience.”




Leadership: The best way to manage your team

Team leadership may be a long and challenging path. The good thing is that leaders are made, not born. Every successful leader you see on TV, in your company, at your university, or even in your neighborhood developed their skills over time. If they were able to become strong leaders, so can you. Kevin Kruse, a Forbes contributor, and CEO of LEADx, define leadership as: 

“Leadership is a process of social influence, which maximizes the efforts of others, towards the achievement of a goal.”

We like his approach because it emphasizes the importance of the “others” – our team! Leadership is not about you as the leader, it’s about the people you’re leading and what they will be able to achieve. If this seems overwhelming, relax, it just means you’re facing a new challenge. It may take a little extra effort, but in the end, you’ll gain new skills to help your team (and you) succeed. Here are five recommendations that help us lead our teams here at Oktana and turn our people into high-performers.

1. Leadership is not about you.

We’ve already said it, but it’s important enough to repeat. If you expect to get all the credit as the leader, you’re probably not in the right job. Assuming a leadership role requires a certain amount of expertise in specific areas. You weren’t promoted to leadership with the expectation that you’ll be doing the exact same work you’ve always done. There wouldn’t be any challenge in that. Your role is now to inspire your team and develop their capabilities so they can accomplish more. They might even be working on the same types of achievements you did before you moved into leadership. It’s their time to shine now. Your excellent leadership will shine through their accomplishments.

2. Great leaders connect.

Great leaders connect their teams. And it’s not just about having regular conversations. When we say “connect your team”, we mean “become a real support for them.” They’re challenged by you to become better professionals, but they’re also looking to you for help or instruction. If they don’t have your support, it may become an awful experience for everyone. It’s important to let them be independent in their work, just be sure your other responsibilities don’t take your attention away from their progress and needs.

Mauricio Villamayor, product designer at Oktana Paraguay shares his perspective: 

“I always think of giving more independence to team members, but this pandemic makes me more aware of the need to be supportive and stay connected in a deeper way.”

Mauricio Villamayor – Product designer at Oktana Paraguay

3. The challenges are real.

Are you the kind of person who is always looking for a bigger challenge as soon as you finished the last one? That’s the sign of a great professional. If you see this pattern in your team, congratulations, you’re leading a high-performing team. The challenge for leaders is creating work experiences that take your teams to the next level. Map your expectations for the team and think of innovative and interesting projects to help them experience the professional growth they need. Challenges nourish your team. Feed them.

4. Learning goes both ways in team leadership.

Some people think employees learn from their leaders, but that leaders don’t learn from employees. Leaders provide knowledge and team members execute the tasks. We feel that’s not taking advantage of the full potential of the team. Our team brings expertise from design, development, marketing, administration, sales, and operations, from many countries. It’s taught us that leaders who don’t see their team members as potential sources of knowledge are missing an opportunity to see their business and markets from another perspective. That knowledge is pure gold in a world where everything is constantly changing.

5. Communicate efficiently.

Time is money, whether we’re talking about business or our daily lives. As you decide how to manage your team conversations, make sure those moments are as efficient as possible. Every team meeting needs an agenda so team members can easily understand the focus of the meeting and what they need to bring to the table. Use your channels well and try not to overwhelm your team. Stay strategic. Deliver the right message, through the right channel, at the right time. 

“I believe Tok helps me a lot because it gets fast communication with my team members in real-time. Either I need to have 1:1 conversations or group arrangements, Tok is the platform where I can trust.” 

Mauricio Villamayor – Product designer at Oktana Paraguay

Remember, becoming a great leader is a learning process that never ends. So whether you’re leading your first team or you’re an experienced leader, keep this advice in mind. Also, if you want to go deeper into leadership and team management, take a look at this trail about Empathetic Leadership and Managing the Salesforce Way.

Hope you have enjoyed it so far. We’re constantly striving to improve our leadership, join us. Our team knows what good leadership entails and we do our best to keep growing. We are a great place to work so if you’re interested in joining our team, go over to our available positions. Also, if you want to know more about our work, go check out our latest success stories.


The Simpsons, Legacy Code, and Maintainability for Salesforce Code

As soon as we start to code, we are taught many best practices, tricks, design patterns, and a huge “etc.” But it’s not until our first gray hair that we start to understand why all those best practices exist and why it’s important to apply them. I wanna write about my experience with legacy code and what worked for me with some examples. 

First, let’s discuss what legacy code is, and compare different degrees of code quality with one of the most famous and beloved families ever.

Legacy Code and The Simpsons

When we hear about legacy code, the first thing we think is “old code”. So let’s start our analysis with the oldest member of the family.

 Abraham Simpson (aka “Grandpa”)

Legacy sounds like something “old” that’s with us without us wanting it, just like the Simpsons family and Grandpa. He has aging problems (his memory is gone, he lost a kidney, he’s a little crazy…). He lives in a nursing home and his family tries to avoid him. For sure Grandpa is legacy code and any developer would prefer to resign rather than work on it. Grandpa is probably an old COBOL project the company avoids changing and migrating to newer technologies. The reason? Because it’s going to be really expensive and the entire business depends on it.

Homer J. Simpson

He is middle-aged. For some people he is old, for others, he is not (it depends how close in age the reader is). But he is dumb, he makes a lot of mistakes all the time. He drives under the influence, he is lazy and he has no idea what he’s doing at work and a BIG etc. He had some chapters where he tried to improve himself, but he wasn’t able to do it. If he were code, you wouldn’t be pleased to have to change it. I imagine Homer as a 15-year old Java application that is causing a lot of problems, but we are still trying to maintain it because we love it (because everyone loves Homer).

Bart Simpson

He is really young, 10 years old. He should be a nice kid who helps the elderly cross the street safely, but, he is always instead causing trouble for everyone. Marge needs to keep an eye on him every single second. If Bart is code, he is a React/Node.js/MongoDB application done by a startup with low budget and limited time to develop an MVP to secure an angel investor. He lacks testing, documentation, and has a lot of tech debt.

Lisa Simpson

Nice, smart, behaves well, never gets into trouble…in a few words, the daughter anyone would love. She tries to improve herself every single second. If Lisa were code, she would have a very good architecture, awesome code quality, comprehensive test suite, cool documentation, and good CI/CD. But there aren’t that many Lisas in the real world.

Marge Simpson

Finally, Marge, the mom of the family. She is some years younger than Homer. She tries to be good, support her family, and be a good citizen…but she has been in trouble, too. I would say she is the average project we work on. It has parts with good quality, parts with poor quality. Sometimes we make mistakes because of the coding quality and some tech debt that we have created knowing that we are going to pay a tax on it later.

So, what is legacy code?

In “Working Effectively with Legacy Code” (ISBN-9787111466253) Michael C. Feathers defines it as “code without a unit test.” I agree that code without “unit test” is legacy code, but I don’t consider that only having unit tests translates to your code being a modern “Lisa” program. I prefer to consider legacy code anything in which making any change is hard, costly, and risky because the maintainability is not high enough for different reasons that include: 

  1. Not having a comprehensive test suite
  2. Poor documentation
  3. Low code quality 

I am pretty sure that while you are reading this, more than one of you is writing legacy code because legacy does not mean “old.”


According to IEEE, maintainability is:

“The ease with which a software system or component can be modified to correct faults, improve performance or other attributes, or adapt to a changing environment.” 

So let’s discuss some topics that can make our code more maintainable.

Automated Testing

This is a must. We cannot change anything with any degree of trust without having a good automated test suite to support us. 

Salesforce has a really good API to help developers with “unit testing” (the tests we mostly write in Salesforce are integration as we are interacting with a database instead of mocking it). Also, Salesforce requires us to have 75% of code coverage over all of the org to be able to promote to production, which is great…but is it enough?

For example, imagine you have this code:



This test passes, 100% code coverage. But another developer calls a new AccountCreator().insertNewAccount('') and the user sees an exception. Chances are the developer who created this class was doing test-driven development (TDD) but didn’t take time to think about the business restrictions (account name cannot be null or empty). There is no test checking that the code is doing this validation.

So having high code coverage is not enough, we have to make sure that we have covered all possible scenarios (happy paths, failures paths, border cases…all of them).


We write code that lives for years and once in a while a person has to make a change. This person won’t be the same person as the one who coded it – even if they share the same ID number, phone number, or Instagram username, the programmer from the future probably has forgotten some aspect of the code. So we need some degree of documentation in our classes. 

I wanna discuss the two main types of in-code documentation. First, let me show one example:


Let’s try to fix this with some tools:

*doc documentation (ApexDoc in the case of Apex)

A bunch of tools exists that allows us to put some special comments before classes and method declarations which can be parsed to generate documentation automatically. And the good part, you have the documentation in the same place as the code. In ApexDoc, the comment has to start with the /** instead of the regular /* Apex comment block and we have some tags to indicate what we are writing. Here’s an example: 

  • @description: A high-level human-readable and understandable description of what the method is doing. I prefer to put an easily understandable and quick to read first line about what the method is doing. A really important detail that the developer needs to know about the method like if a web service is being used, I put that in the next line (but not going very deeply into implementation details).
  • @param: For each parameter, the method takes, we have to indicate the type, preconditions, and a description of what it is intended for.
  • @returns: The returning type and description (if the method is not void).
  • @throws: The exception it could throw and when it would do it.

The last topic about this is where the ApexDoc should be present. There are two approaches to this:

  1. Public classes and methods
  2. Every class and method

The main advantage of putting documentation in public classes and methods is that after we shared our code with the world, changing the contract we defined is not so simple (without breaking other people’s code) so we can be quite sure that the ApexDoc does not become obsolete (yes, we need to maintain the ApexDoc, too). 

I prefer to put it everywhere and be sure the comments get updated when there are changes in the methods because private methods are code, too. They deserve respect and we will need to read them anywhere. We need to be kind to the next developer changing this code (especially because the next one could be ourselves of the future and I don’t want to aggravate them).

So now we have all our methods documented and we can skip reading that long and hard method that the piece of code I am working on calls (we go into details if and only if we need it).

Comments on implementation code

When I started to study computer science, a professor told me that comments are very important. 

Well, I completely disagree with that idea in real life. 

Code has to be self-descriptive and if we need to put a comment in it, we must be sure there is nothing else we can do to make the code more understandable without the comment. A comment line in the code is a new code line that needs to be maintained and it took development time to put it there. It also cannot be tested, so the chances are the comment ends up saying something that the code is not doing. Read the code carefully and tell me if you could find any discrepancies. 

We will tackle how to reduce comment quantity shortly, but first check really good code comments here on Stack Overflow: Best Comments in Source Code You Have Ever Encountered

I really loved this one: 

//When I wrote this, only God and I understood what I was doing 

//Now, God only knows

Code Quality

This is the last topic I wanna cover today and I will only scratch the surface. In particular, I want to discuss how we can write our code to communicate with other developers in a way that is easier, faster, and clearer. Code should be self-explanatory and we should hide the implementation details until it is not possible to anymore. Ideally, our public method should be written as a declaration of the developer’s intentions and we leave the implementation details (the imperative part) to private methods (but we should not chain many private methods calls as it forces the developer to go forward and backward and is not optimal).

Let’s start with the method I showed you in the last section:



In this method, we find three different parts:

  1. Collect data from parameters 
  2. Do business logic
  3. Save and return the result (technically a method should do only one thing and do it well…this does two, but it is part of the trade-off we have to make in real life)

So let’s start with the first part:



  1. We see the comment is wrong and useless so we delete it.
  2. SOQL query is already declarative (the query has Salesforce best practices issues, but I do not want to focus on this right now), so we can’t hide any implementation details.
  3. We have some variable declarations:
    • accountScoresToReturn: This variable is self-explanatory: we are going to return this list.
    • accountNames: Ok, they are account names but which account names??
    • accountNameToId: Another good name, we know what we are going to store in it.
  4. We have an iteration: This is a candidate to split into another method. Unfortunately, we can’t do it without impacting the overall performance or quality (we can’t return two values in Apex, so we need two methods with two iterations or a function that returns a string and has side-effects of populating the map). But reading this block we start to figure out what accountNames is for. We concatenate the accountNames with “,” between them, but we find out that the variable accountName is not expressive enough so we are going to look in the code to figure out what it is.

Second block:



This block mainly does two things:

  1. It calls a webservice and parses the result
  2. It gets the higher score accounts

And there are plenty of implementation details.

First, we tackle the invocation of the service. It requires the account name string and returns the parsed JSON object. So, let’s split this other method: 



And our main method changes to: 



Let’s tackle the second part of the business logic. Before we do this, do not forget to run the complete test suite we have. The business logic iterates over the parsedJson object and selects those that score higher than 5. So we are going to split it into another method which takes parsedJson and returns the List of selected accounts: 



And our main method changes to:  



Finally, we have the part of the code that returns data. Most of the time this part just returns a value or insert for the database.


One of the most important attributes of the work we do is the maintainability of the code we write. We must ensure we are using all the tools we have to enable this. There are hundreds more topics and tools to cover regarding how to create maintainable code, but everything starts with the three points I covered here: 

  1. Automated testing
  2. Documentation
  3. Code quality

Don’t forget you are going to spend more time reading the code than actually writing it. So you should take the time necessary to make it easier to read.

Coming back to our friends, we have Maggie:

Maggie is just a baby, she is learning the world. Everything she learns can lead her to become Lisa or Homer, just as the project you are working on right now. So, I hope these recommendations help your project to become Lisa and not Homer (even though we still love him).

If you’ve made it this far, thanks for reading! Also, if want to read more about code, check our latest articles here.

Heroku: Simplify and improve your cloud infrastructure

Data plays an enormous role in the success of any organization. Collecting and quantifying pertinent information builds a stronger roadmap for growth. Because of this, companies are collecting and storing data to forecast future trends and develop action plans. That’s a lot of data to manage and most companies don’t have the right technology in place. This is where the cloud sweeps in to save the day. Cloud platforms enable companies to store large volumes of data to repurpose for business transactions. As a result, cloud infrastructure demand is growing for businesses of all sizes, as they have come to realize the massive benefits and potential of utilizing cloud components. Heroku is a first-class platform that helps developers scale more effectively.

What is Heroku?


Heroku is a platform as a service (PaaS) cloud that supports several programming languages and is part of the Salesforce Platform. Because it supports the most relevant programming languages used in the industry, it has become a popular tool for enhancing cloud infrastructure. Developers, teams, and businesses of all sizes use Heroku to deploy, manage, and scale apps. Using bi-directional synchronization, Heroku unifies the data in your Heroku data with your Salesforce CRM data. Additionally, Salesforce Trailhead was built and launched on Heroku. 

3 ways Heroku enhances cloud infrastructure:


  • Several Programming Languages: Initially, Heroku only supported Ruby on Rails. However, over the years it expanded to include other languages such as, Java, Node.js, Scala, Clojure, Python, PHP, and Go. The benefit here is the ability it provides users to create applications that are robust and versatile.


  • Rapid Delivery:  Developers are able to deploy their code to Heroku with a one-line command in the terminal. Having all the power of Amazon Web Services (AWS) in the background, but without having to take care of setting up its infrastructure. Heroku has it all covered for you!. Access to all of these resources and capabilities massively cuts down project time and allows developers to focus on creativity and higher-level work.


  • Scalable Functionality: Heroku allows developers to construct while not having to sacrifice impressive UI and effective application functionality. Heroku is able to accommodate spikes and dips in traffic without having to purchase more hardware. The system is able to cope with higher loads of users or more traffic reaching the system. 


As you can see, Heroku has many features that simplify and improve cloud infrastructure at a very granular level. By utilizing the Heroku platform, developers are able to build applications that are efficient, visually pleasing, and all at a fraction of the time and cost it would take to develop on other platforms. 

Oktana’s Experience 


Here at Oktana, we are avid users of the platform and always seek out the best technologies to leverage for our customers. We’ve used Heroku to develop a number of outstanding applications across several different industries. Among them, you can find a Leading Investment Firm, a Fintech Company, and MedZed

We’ve seen firsthand the kind of power Heroku brings to drastically improve application development. That’s why we’re extremely proud to announce that we’ve recently received a Specialization Badge for outstanding Heroku development from Salesforce! We’re super excited to be recognized for our expertise and it motivates us to develop even more applications with the platform. We think it’s a great tool and highly recommend it to developers who really want to extend cloud infrastructure to the next level.




Salesforce Certification: MuleSoft Certified Developer

What is MuleSoft?

Acquired by Salesforce in 2018, MuleSoft is a SaaS company with a world-class industry presence. MuleSoft provides integration software to connect applications, data, and devices. At its core, it allows you to:

  • Efficiently build APIs
  • Manage your API users
  • Easily connect existing systems, regardless of the technologies used

From a developer perspective, MuleSoft streamlines the process of integrating various systems, whether that includes new APIs, Salesforce, ERP, or legacy applications. It is a unique technology in that you can program from a graphical abstraction and create flows with simple tools – a very different environment when it comes to software development.  

For the customer, MuleSoft means you can connect all corners of your system, including Salesforce, and also reduce development time when building new APIs. 

As the platform grows, MuleSoft is only becoming more powerful. 

  • With MuleSoft’s Anypoint Security, security and threat protection can be automated at every layer for ISO 27001, SOC 2, PCI DSS, and GDPR compliance. 
  • The MuleSoft Anypoint Platform™ allows themes to launch applications 3x faster and increase productivity by 300%.
  • API Community Manager enables MuleSoft customers to manage their API users in a community, leveraging Salesforce Community Cloud technology.

Over the years, our focus has been helping customers integrate their systems with Salesforce, whether through custom methods or integration with third-party services. We have encouraged our developers to achieve the MuleSoft certification. This has allowed us to partner with multiple companies that needed help integrating with MuleSoft. 

How one of our partners uses MuleSoft

We recently completed a MuleSoft integration that allowed new data to be entered into a field within a mobile app, then copied and inserted into Salesforce as a new record. To complement this, we also built new automated email workflows to save Sales time when communicating with customers. 

The first step of this project was a synchronization between Mulesoft, Web Services and a REST API. Using AWS and Python, we batched normalization of data. To automate this process, they used Salesforce Process Builder.

MuleSoft Certification

Isidro and Isaias, two developers who have become certified as part of their growth plan at Oktana, agreed that a month of full-time studying is required to pass the exam for the MuleSoft Certified Developer Level 1 exam. For those not dedicating this amount of time, they suggest you allocate two months to study. 

Even though there are no prerequisites for this certification, they recommend having a background knowledge of REST API services, the basics of web concepts, HTTP requests and that you know how these work from a server perspective. 

Isaias found the hardest topic was error handling, given that MuleSoft has its own logic to solve these issues and it is not easily related to other programming languages. The solution he found was to put the theory into practice by creating a fairly simple app and run flows, this way you understand the behavior of the app and what needs to be done for the app to behave differently. He mentioned that MuleSoft is highly versatile and offers multiple tools to use without the necessity of learning every existing tool.

Isidro thought the most interesting thing about this certification is that it allows developers to develop what can typically take several weeks in only a few days. 

Here are some study materials as you prepare to become a MuleSoft Certified Developer:

The developers on our team who have worked on MuleSoft projects agree certification is fundamental to working with the technology. The material covered ensures you have the necessary knowledge of APIs and architecture required to work efficiently and to integrate other services. MuleSoft is widely used and growing within the market.

Equipment requirements for the exam:

  • Webcam
  • Microphone
  • Minimum operating system: Windows Vista / Mac OS x10.5 
  • Compatible browser: Google Chrome or Mozilla Firefox. 
  • Minimum RAM: 1024 MB

If you are part of our team, Oktana will provide you with some extra resources such as mock tests to help you successfully pass the exam and continue to develop your career. If you’re interested in joining our team, check out our job offers at Oktana Careers.

Mulesoft Certification