When writing the usual view controller code, can I assume that this will only be called from a single event-loop thread? What kind of classes do I need to make thread-safe? What are the usual situations where multiple threads are involved?


Question: Derivation of relationship between Gibbs free energy and electrochemical cell potential
Answer: I'm surprised your textbook did not derive this equation from the reaction isotherm relationship between $\Delta G$ and the reaction quotient $Q$ and the Nernst equation. The derivation is not hard.

Reaction isotherm equation:

$$\Delta_r G =\Delta_r G^\circ +RT\ln Q$$

Nernst Equation:

$$E_{cell}=E^\circ_{cell} -\frac{RT}{nF}\ln Q$$

If we solve both equations for $RT\ln Q$, we get your equation (almost).

$$RT\ln Q = \Delta_r G -\Delta_r G^\circ$$
$$RT\ln Q = nFE^\circ_{cell} - nFE_{cell}$$
$$\Delta_r G -\Delta_r G^\circ = nFE^\circ_{cell} - nFE_{cell}$$

Why is my equation not as simple as the one you started with? Your equation is at equilibrium, and I assumed that we might not be at equilibrium. At equilibrium, the following are true, which simplify the relationship.

$$Q=K$$
$$\Delta_r G = 0$$
$$E_{cell} = 0$$

At equilibrium, $\Delta_r G = 0$ because the reaction has achieved a minimum energy state - the chemical potential $\mu_i=(\dfrac{\partial G}{\partial N_i})_{T,P}$ is also $0$ because there is no net change of state at equilibrium. Similarly $E_{cell} = 0$ at equilibrium. There is no change of state, and thus the redox reaction has ground to a halt.

At equilibrium, the final relationship is 

$$\Delta_RG^\circ = nFE^\circ_{cell}$$