Hey Mosska!
An Expertise is an additional thing to the parent Skill, like a special ability that makes the Skill more versatile in narrower circumstances.
1) So, your example is correct, if you are using Coding to hack, you can trade one of the dice for an EDGE. This is specially useful if the Runner is rolling 4 dice against a high level Threat, so that they can still get a good chance of success with 3 dice while being more effective or risking lesser consequences!
2) Correct, if the Expertise is applicable in the given situation they can trade their EDGE for a die to their roll.