A commutative algebra approach to linear codes