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.
  • Frontend code is usually written in JavaScript, which your browser can interpret.

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 interpret JavaScript; All browsers have built in JavaScript interpreters.
    • Check it out! In Chrome right click on a page and click on the 'inspect'. Then click on the 'console' tab. You are now looking at a JavaScript Interpreter! For fun, write the following: 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:
    1. 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?)
    2. Compile my Python code down to JavaScript before sending it to the client. This is a bit of a hack, though, because technically javaScript is still what would be running on the client side.

Where do HTML and CSS fit in?

  • Often HTML and CSS are considered frontend. The reason being is that, like JavaScript, they are interpreted by your browser.
  • 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!)

Further readings

If you're curious to know a little more, specifically about why / how JavaScript became the only language built into browsers, I recommend reading this thread on reddit. I found it to be well explained and pretty thorough!

Category: Blog Tagged: Web


How the Internet Works

Thu 10 September 2015

What is the internet?

One thing I’d like to clarify right off the bat is that when we connect to the internet we are connecting to other physical computers. Any service accessed through the internet- email, Skype, reading the news online- is the result of obtaining data from one ...

Category: Blog Tagged: Web

Read More

I made my first cookie!

Thu 27 November 2014

Margo and I have been working on our web-framework, Chapeau. To test out its functionality and user-friendliness, we've been using Chapeau to build various web-apps. This week we implimented a buzz-feed-style quiz. To challenge ourselves (and Chapeau) we structured the app to have a separate webpage for each question ...

Category: Blog Tagged: Web

Read More

Adventures with sockets, threads and more!

Tue 11 November 2014

For a while now I've wanted to learn more about the internet, about servers, and about how web apps really work. Last week I finished a small flaks tutorial. I enjoyed the tutorial and I learned some cool things by doing it, yet, I was feeling unsatisfied. The tutorial ...

Category: Blog Tagged: Web Threading

Read More