We can break the universe into two parts, the system and the surroundings. The part we are looking at is the system, and everything else is the surroundings.

There are a number of ways in which these two interact.

An open system is one where both matter and energy can freely cross from the system to the surroundings and back. eg an open test tube.
closed system is one where energy can cross the boundary, but matter cannot. eg a sealed test tube
An isolated system is one where neither matter nor energy can cross between the system and the surroundings. The universe itself is an isolated system (as there are no surroundings to exchange matter or energy with).

Another important thermodynamic concept is work. Work is done when something is moved against an opposing force. The units of work are joules, the same units as energy. This implies a link between the two quantities. Consider lifting an object – work is done during the process as the object is moved upwards against the opposing force of its own weight. Energy is required to carry out the process (we must expend energy to raise the object, as its potential energy is increased). We can see that the more energy a system has, the more work it can do.

The energy of a system is a measure of the amount of work it can do.

From this it follows that when an isolated system does some work, its energy is reduced (it can now do less work than it could to start with). Conversely, when work is done to a system, it can do more work than it could originally, so its energy has increased.

Work is an ordered transfer of energy. It may also be transferred by a disordered or chaotic motion, when it is known as heat. Heat is transferred to or from a system when there is a temperature difference between the system and the surroundings. (Temperature determines the direction of that heat flow, from hot to cold.) Again resulting in an energy change of the system, heat is measured in joules.

Barriers that allow heat transfer are called diathermic, and those that don’t are called adiabatic:

If, for example, an exothermic reaction takes place in an isolated system (which must necessarily have adiabatic walls), the temperature of the system will rise. An endothermic reaction taking place in a diathermic container will result in the temperature of the system remaining the same as that of the surroundings (both should lower).