Skip to main content
  1. Salesforce.com/

Learn Apex the Right Way

·3 mins

I have a love-hate relationship with the process of learning a new programming language.

On one hand, learning a new language is the thing that I want to do most. Or, I like to think that way.

I get those goose bumps when a problem is solved (pathetic, I know), discover something by myself, or even when I say hello to the world for the millionth time.

On the other hand, I fear the dredge that makes up the initial learning. The syntax and language fundamentals take up too much time and I get easily distracted. After a few basic programs and solving a few problems, it is quite easy to get on to the next shiny object.

Deeper learning in the language will take a back seat since I don’t end up using it for my every day work (that has a lot of Powerpoint if you dare ask).

I only get to graduate to the next level when there is a need to employ the programming language for a real-world issue. This is the part I never reach for most of the programming languages that I start learning. And, this is the reason why I yearn for an introductory course/book that can teach to solve a practical issue when learning the language. Doing so enables me to “think in the language” rather than bring my half-baked knowledge/skills of some other language.

I faced the same issue when I started in Apex.

Although I have no qualms about how the Workbook and the Apex Code Developer Guide are structured, they just do not provide the flavour of language like I need it.

Since I don’t actively code for my living anymore, I do not get to explore the language with the same zest of a hard-core developer. I missed the experimentation that allows me to code the right way.

After a few weeks of going through the cookbooks and of course, Trailhead, it was time to look at finding better resources.

It was time for Advanced Apex Programming by Dan Appleman.

advanced apex programming

My problems in learning Apex was not about syntax. It was not about when I should use Apex as against Process Builder or Approval flow. I wanted to quickly understand how the real-programmers did it.

I wanted good answers to-

  • How should I start coding triggers and classes in the right way?
  • How to weave loops and SOQL in a better way?
  • What is the big deal about bulk patterns? When to use them and when not to? (this is a trick question)
  • What exactly do experienced programmers do when they have too many transactions in the logic ( batch it, future calls?)
  • And, of course, what are the gotchas?

Advanced Apex Programming enabled me to get to those answers early. It allowed me to see what real-world best practices are and one-up my skills pretty quickly.

The book starts with the assumption that you know all the syntax and you have read through the developer guide. It does not provide that basic skills. But what it does right is to fast forward the knowledge on how to rightly approach Apex.

I found it easier to follow the book and refer the Apex developer guide when I hit something that I couldn’t figure out. I love this top-down approach to solve things since it gives a better perspective of how you should use the language rather than just say -

system.debug(‘hello world’);

In other words, instead of determining the optimal way after expensive mistakes, Advanced Apex Programming introduced easy shortcuts in my learning journey.

Provided you have some programming background, you will feel yourself at home here. Try this book immediately after Trailhead for best results -

It also helps if you have a basic idea of Apex design patterns  🙂