Depending on the textbooks looked at, the energy change is described as either Q+W or the signage is changed to Q-W. Which is correct? Is it solely context dependent? Could anyone explain the background?
The difference in sign in the two versions of the first law of thermodynamics is to handle the two ways in which work can be defined.
The work done (assuming only pressure-volume work) can be defined as
This is the definition often used in in scenarios when we care about the fate of the work. This definition is about the surroundings. Thus, when the system expands, it does positive work on the surroundings, which is a good thing. Think about an internal combustion engine. When the reaction occurs in a cylinder, gas is produced causing the volume to expand and move the piston, turning the drive shaft, etc. Since we care about the work after it leaves the cylinder, it is positive because the surroundings are gaining energy.
The work done by a system can also be defined as:
We use this definition often in chemistry and in general when we care more about how much energy is left in the system than we care about what the energy that left the system is doing. This definition is about the system. In the case of the engine above, energy has left the system, so the work done is negative to reflect the fact that the system has less energy than it used to.
The sign convention in the definition of the change in internal energy (and I prefer $\Delta U$ to $\Delta E$) reflects that we can define work done with respect to the system or the surroundings. The sign in front of $w$ guarantees that we always get
$$\Delta U=q-P\Delta V$$
With respect to the surroundings:
$$w=P\Delta V$$ $$\Delta U = q-w=q-P\Delta V$$
With respect to the system:
$$w=-P\Delta V$$ $$\Delta U = q+w=q-P\Delta V$$
A better question might be