Admins / Developers

Can Einstein for Developers Teach You to Code?

By Andrew Cook

Generative AI tools such as Einstein for Developers have changed how Salesforce professionals develop Apex code. These tools analyze existing Apex code and help generate new snippets or functions quickly, understanding Apex rules and suggesting code or finding errors. This can be really helpful for admins looking to improve their efficiency and productivity when building or customizing features in Salesforce.

But what if you’re brand new to Apex? Is Einstein for Developers something that can help you understand and write Apex code adhering to best practices? This article explores just that…

What Is Einstein for Developers?

Einstein for Developers is an AI-powered developer tool provided by Salesforce, designed to significantly enhance developer productivity. It’s available as a convenient Visual Studio Code or Code Builder extension that can be easily installed. Built on Salesforce’s CodeGen, a secure and custom AI model, this tool offers generative AI capabilities without relying on customer data for training its models​.

Key features and capabilities include code generation from natural language descriptions, allowing developers to simply describe code logic or objectives in plain English to generate executable code. This tool is specially tailored for Salesforce-specific coding languages, turning natural language prompts into code, thereby eliminating the need for manual coding. Below are some of the benefits of using Einstein for Developers:

Inline Code Completions

Use Al-based autocomplete to accept suggestions for code as you write it, right inside your editor. These Al-generated code suggestions are context-aware and are based on the metadata in your connected org.

Inline autocompletion can be triggered in Apex and LWC (Javascript and CSS) files.

Test Case Generation

You can use Einstein for Developers to quickly generate unit tests for your Apex classes. All you need to do is let the Al know which methods to consider when generating tests. Einstein then uses the context of tests that you choose to create new tests that do not duplicate the code that you already have.

Einstein Sidebar

Use the Einstein sidebar to generate Apex Code from the natural language prompt. Simply write a question or an instruction that describes the task for which you’d like to receive an Apex code suggestion and press Ask.

History Panel

You can open the history panel to view a running history of your prompts and associated responses. This aims to boost coding efficiency by recalling past interactions with Einstein, reducing the need for repetitive tasks and saving time.

Users can also learn from past prompts, refining future instructions for better results. In debugging, the ability to refer back to original prompts helps troubleshoot issues efficiently. Additionally, collaboration is enhanced through easy sharing of interactions, fostering better teamwork and project outcomes.

Einstein for Developers Isn’t a Learning Tool

Einstein for Developers is positioned as a sophisticated tool that bridges the gap between natural language processing and software development, specifically for those working within the Salesforce ecosystem using Apex. While it presents significant advantages for code generation and streamlining the development process, it’s crucial to understand its applications and limitations, especially for those new to the field or considering it as a learning resource. The following outlines some of these limitations:

Code Generation and Completion

Einstein for Developers shines in its ability to convert natural language descriptions into functional Apex code. This feature is incredibly valuable for developers looking to speed up the coding process or overcome moments of creative block. 

However, this utility leans heavily on the users existing knowledge of Apex syntax and the Salesforce platform’s intricacies. A beginner might find the generated code challenging to understand without a solid foundation, as the tool assumes familiarity with basic programming concepts and Apex’s unique characteristics.

Limited Instructional Content

Unlike platforms designed with education in mind, Einstein for Developers doesn’t prioritize teaching programming fundamentals or the nuances of Apex development. The absence of guided tutorials or detailed explanations about the logic behind code snippets means that users are expected to have a baseline understanding of the subject matter. 

This setup can create a steep learning curve for those new to Apex, as they may struggle to contextualize the code generated by Einstein in the broader scope of their projects.

Lack of Feedback

Following on from the above point, feedback is a pretty big drawback when it comes to Einstein for Developers. In short, it doesn’t give you any. If you ask Einstein for Developers to help you create an Apex Trigger or a Test Class, it will compile the code for you to the best of its ability.

Unlike tools like ChatGPT and Google Gemini, Einstein for Developers doesn’t give any feedback beyond this. One of the great things about these tools I’ve mentioned is the feedback they provide, giving explanations on why certain things need to be written in a certain way. Although the code that is written using Einstein for Developers will be better than that generated by any other Generative AI tool, if you are learning to write code without feedback to help you understand the code, it’s almost irrelevant.

Einstein for Developers Offers Indirect Learning Opportunities

Despite these challenges for beginners, Einstein for Developers can still serve as a valuable auxiliary tool for learning Apex, albeit in a less structured manner. Einstein for Developers can assist your Apex learning journey in several ways, including:

Analyzing Generated Code

One of the most effective ways to learn programming is through code examination and reverse engineering. By studying the Apex code produced by Einstein in response to specific prompts, learners can begin to piece together how particular functions are implemented and how different aspects of the language interconnect. This method can help solidify understanding of programming concepts and encourage analytical thinking, though it works best when supplemented with formal education or mentoring.

Imagine you’re learning about triggers in Apex. You could prompt Einstein to “Write a trigger that updates the Account Name whenever the Billing Address changes”. You can then analyze the generated code, see how it identifies the updated event, accesses the new Billing Address, and updates the Account Name accordingly. This can help reinforce your understanding of trigger syntax and logic.

Experimental Learning

Einstein for Developers allows users to experiment freely with different programming constructs, offering a safe sandbox environment to test ideas without the overhead of setting up development environments or the fear of breaking existing code. This exploratory approach can be incredibly beneficial for understanding the practical implications of theoretical concepts.

By tweaking prompts and observing the variations in generated code, learners can gain insights into best practices, coding efficiency, and more sophisticated aspects of Apex programming.

What Other Ways Can I Learn to Code?

If learning to write and understand Apex is your aim, Einstein for Developers alone won’t be the best way to go. There are plenty of other resources available if this is your mission, such as Trailhead, Camp Apex, or our Introduction to Salesforce Apex Course to name a few.

You could also use Einstein for Developers in conjunction with another Generative AI tool. Einstein for Developers could generate an Apex Class or Trigger, and you could then use the other Generative AI tools such as ChatGPT or Google Gemini to explain to you what the code does. This would ensure the code is written according to Salesforce best practices, and you still get the feedback that’s missing from Einstein for Developers alone.

One thing to bear in mind is it is generally not recommended to input any proprietary code or sensitive information into generative AI tools. While these tools are designed to generate text based on the input provided, there’s always a risk that the information could be inadvertently shared or used inappropriately. It’s best to keep proprietary code and sensitive information secure and within trusted environments.


Einstein for Developers is a powerful tool for those already versed in Apex, offering significant advantages in terms of productivity and code optimization. However, its value as a standalone learning resource for beginners is limited due to its assumption of prior knowledge and lack of educational content.

Nonetheless, when used in conjunction with traditional learning methods or as a means to explore and understand complex coding principles, it can enrich a developer’s understanding of Apex and enhance their problem-solving skills. It’s a testament to the evolving landscape of software development tools, where the integration of AI can complement human expertise, making the process more intuitive and efficient.

The Author

Andrew Cook

Andrew is a Salesforce Technical Instructor at Salesforce Ben. He is 14x certified and has worked in the ecosystem for 12 years.

Leave a Reply