What's frontend, what's backend?
Sun 06 November 2016
Last week a co-worker of mine asked me to clarify for him what the difference was between backend and frontend web development. I had been asked this quesiton before, but this was the first time I felt I provided a clear explanation and was able to instill knowledge.
So, here, I'd like jot down a lof of the key points which I think helped to clarify the meaning of and the difference between 'frontend' and 'backend' development:
- Backend code is run on the server computer while frontend code is run on the client computer.
- Being a fullstack developer means that you write (or can write) both backend and frontend code.
- The backend takes care of any logic that the server needs to run before a response can be sent to the client. This includes things like retreiving data from a database, authenticating a user or making some calculations.
- The frontend code takes care of any logic that needs to run locally - on the clients computer - in response to user interactions. This includes any subsequent network calls for updated data.
Why can't I write frontend in Python (or can I)?
- Just like all browsers know how to turn HTML and CSS into pretty pages, all browsers know how to
alert('Leta is cool').
- Python interpreters aren't currently built into browsers. It's not that they couldn't be it's just that they aren't. If I wanted to write frontend logic in Python I'd have two choices:
- Write a browser plugin to be able to interpret Python, and prompt users to install it to view my web app. (This type of thing has been done in order to run Java on the frontend! Remember those annoying Java plugin installation promps?)
Where do HTML and CSS fit in?
- I consider HTML to be backend only in the context of a template that will be compiled by a template enginge. In this case one is writting an HTML page with added template language logic which will render more HTML depending on the data that is fed into it.
- To me, this falls under the backend umbrella because the templatign engine will turn this template into a finished HTML file on the surver side before sending the final HTML file to the client.
- Some people agree with me on this distinction, others disagree (and that's OK!)