the difference between front-end and back-end in programming :)

Think of a program like a car. What the dashboard looks like, what each button does, in broad terms, is the front end. The user knows that when they turn this knob, the temperature of the car is adjusted. When they push this button, the music turns on. The back end is how exactly those things are implemented.

For the temperature, turning that knob could make a physical change that makes a fan spin faster, or it could make an electrical change that makes it spin faster. It could also open vents elsewhere, so that not all of the air is directed to you.

The knob could make a motor turn faster, causing the fan to spin faster (electronic), or it could shift gears in a gear box, making the same spinning of the motor translate into less spinning of the fan (physical). It could even change where it got the air from–does it go through a refrigeration unit (like an AC), or does it come from outside? The user may have control over these options, but sometimes all they have is a dial that controls the temperature.

For the music, think of a setup where button A turns on jazz, button B turns on classical, button C turns on rap, and button D turns on the news. When the user pushes a button, the expectation is that the music will change, but the user doesn’t know how it has changed.

Whether that change comes from changing from AM radio to FM radio, from changing stations on the same receiver, or from connecting wirelessly to their phone and searching for an appropriate track to play may be irrelevant to the user, all they know is which button maps to which genre.

Obviously these are a little contrived examples. In most cases you’d be able to dictate whether you want to listen to AM or FM, your iPod, or Spotify, but getting into more realistic examples pushes it out of the realm of “ELI5” and more like “ELI10.” A more realistic example might be looking at the list of music on your phone. Then front end is how it’s laid out, where the buttons are, which parts you can tap, which parts you can drag, etc. The user knows that if they tap here, the songs will get organized by artist name, but if they tap somewhere else, they’ll be organized by song name. The back end would be deciding if these lists are precomputed, or if they are sorted on the fly when the user taps. In the latter case, more “back end”ness would be deciding which algorithm to use to sort. The user doesn’t care, and probably doesn’t understand, anyway. All they know is “click here to sort by song name, click here to sort by artist name,” and that’s that.

www.reddit.com

Leave a Comment