When digital data transmission along wires (Morse code, Baudot telegraph machines for ex. ) had shown its usefulness also serious scientists became interested in it. Old systems based on relays did not gave much room for flashy on math based codings because the limiting factor was the mechanical speed of the parts of the equipment.
As electronics became available, at first along the vacuum tubes, higher transmission speeds became possible. It became gradually obvious, that the well established asynchronous transmission with marks and spaces (it's still popular in slow data rate applications) was far from optimal when one wanted to maximize the data rate through a given line and at the same time to keep the error probability below certain limit.
Mark-space -idea i.e. Voltage =ON for mark (or state 1) and voltage =OFF for space (or state 0) and and sending them sequentially as a fixed length pulses (like UART interfaces still do) do not give to the receiver especially good possibilities to decide was it a mark or space which is between the wires just now and when would it be the best moment to measure the voltage for valid decision. The causes:
- pulses tend to get stretched and rounded through their flight along the wires due the frequency dependent propagation speed and attenuation
- there's noise
- there's no common time reference for the transmitter and receiver, a kind of clock synchronization is needed before the clocks of on time based decisions drift too much apart. The practical timing signal should be a part of the data transmission signal.
The timing in Baudot telegraph wasted at least 20% of the transmission capacity (which already was nothing spectacular) and so it does also in UARTs today.
To lift the available data rate through a given line higher smarter ways than at fixed rate sent DC levels were developed to present the digital states and to carry the timing information at the same time. Different methods were called line codes to separate them from modulations.
Modulations lifted the signal to a higher frequency band and especially radio communication needed it. I have in practice tried a telegraph machine which was based on about 90 years old technology and sent text at HF band. It really was a mechanical device which actually needed a DC mark-space signal, but the radio station had a frequency shift modulator and demodulator interface between the telegraph machine and the radio gear. Morse code was used to ask one to switch the telegraph ON. To do it a tuning fork was used to chek that the motors ran at the right speed.
Line codes occupied a band around 0Hz. Just 0Hz was not so optimal because it was difficult to pass the DC component, so a good line code did not suffer from the removal of the DC component. For original telegraphs DC was as important as some band above it.
ADD due a comment: Term coding has another use in digital domain. We call a math transformation of digital data coding when one stream of discrete states is transformed to another stream of discrete states to achieve something useful, for ex. encryption, data compression, immunity against errors or to fade certain statistical situations which can make the used physical signal transmission method work less than optimally. A typical such situation is a too long continuous chain of zeros or ones which could cause drift in the extraction of the timing in the receiver.
Line coding is not math with numbers nor symbols, it's presenting digital states with physical voltage pulses which also carry the timing information.
The name "line coding" is historical. In communication engineering math one could easily put all line coding schemes to the same box as modulations of digital signals. The historical separating difference is the frequency shifting in modulations, but that's only a property. The common thing of line codings and modulations is that both of them map the stream of discrete states to a continuous time voltage signal which also contains enough information of timing to be used in the symbol stream reconstruction in the receiver.