What's frontend, what's backend?
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:
- 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?)
- 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!
How the Internet Works: Domain Names and Routing
This blog post is a continuation of my previous post How the Internet Works. Here, I hope to answer the following questions:
Read More
How the Internet Works
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 ...
Read More
News, Updates and Getting Momentum Again!
Hello again, Internet People! Lets start with some news and updates!
Hacker School is now The Recurse Center
This is kind of 'old' news, but since I went AWOL for a while, I'm only now making the announcement to the world. For now, I am going to leave my ...
Read More
Interviews are oportunities to learn
Over the past month I've had my first experience interviewing for development positions. Its been a somewhat nerve-racking experience but also, at times, enjoyable. I've come to realize that the best way to approach an interview is with an attitude of excitement and an openness to learn.
A ...
Read More
Some things I learned when my computer crashed.
During my last two weeks at Hacker School I encountered some serious troubles with my computer. Despite becoming overly emotional about the state of my computer, I learned some valuable things through this experience. I learned some cool bash commands when Casey helped me try to diagnose the cause of ...
Read More
Scopes got me again!
In a previous blog post I wrote about some of the struggles I encountered with scoping when Margo and I worked on our web framework Chapeau. This week, scopes got me again! This time, while I was working on my Template Engine.
I think that, as a new programmer, its ...
Read More
Regular Expressions in Python - with LOTS of Examples!
Over the past several days I've learned a great deal about regular
expressions. I struggled initially with the subject, but I think things
have finally clicked. So, I'm going to write what I've learned! In this
blog post I am going to:
- Explain what a regular expression ...
Read More
I made my first cookie!
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 ...
Read More
Lisp Interpreter: Episode 3 (The Finally!) ... Continued.
In last week's episode we inspected how my program tokenizes and parses
the user's input. In the spirit of finishing this series of blog posts,
I have decided today to present an overview of how the rest of my
program works. We'll walk through the basic algorithm ...
Read More
Little Lessons 3: URI's, 'urllib', Template engines, and generators.
I've learned so many fun little lessons over the past week, its time for
another post!
What is a URI? Is it the same as a URL?
URI stands for uniform resource identifier. A very common form of a URI
is the URL, which stands for uniform resource locator ...
Read More
Lisp Interpreter: Episode 3 (The Finally!)
Let me start off by apologizing for the delay. I've been hesitant to
write this post for several reasons, including:
- Presenting and explaining my entire lisp interpreter is a BIG (and
therefore daunting) task.
- There are parts of my code that I'm not entirely satisfied with and
I ...
Read More
Adventures with sockets, threads and more!
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 ...
Read More
Little Lessons: Episode 2
Seeing as there are a whole bunch of "little lessons" that I'd like
to write down and keep track of, I've decided to extend my previous blog
post "Little Lessons" into a whole series! Get ready!
Mutating Iterables:
Suppose we have a list and we'd like to ...
Read More
Interpreting the Interpreter: Episode 2
Confession: I am not yet ready to present my final, finished, Lisp
Interpreter. It will be coming soon, but not today. Today I will
describe the rollercoaster ride of an experience taking on this project
has been for me. Then I'll focus in on a couple things I've ...
Read More
Little Lessons
This blog post will be dedicated to some of the little (but important!)
lessons I've learned over the past week. Enjoy!
The list method "extend" returns None.
Before I explain this lesson, let me just back up for a second and
address the lingo "method". Only recently have I ...
Read More
Interpreting the Interpreter: Episode 1
This episode will describe my experience in the initial phases of writing a Lisp interpreter.
I will describe how I started, my thought processes as I progressed,
some of the code I wrote, how it worked, and, why,at day 3, I decided to start from scratch (almost). If you ...
Read More
Interpreting the Interpreter: Episode 0
For a while now, I have been perplexed by the land of compilers and
interpreters. Thinking of these things sparks all sorts of questions in my mind. For instance, if
a compiler compiles my program, but the compiler is itself a program, doesn't something need to compile
the compiler ...
Read More
What I learned from Crista Lopes
The resident at Hacker School during my first week was Crista Lopes. She
has given some great lectures, and she's taught me some cool things!
Different Styles of Writing Code
On Monday night she spoke to us about coding styles, the topic of her
latest book. Crista explained that ...
Read More
The struggles I had setting up this site.
For me, setting up my blog was not easy. I think part of this was that I
was impatient, and part of this was because IT IS HARD! I ran into many weird error
messages and I began to get quite impatient and frustrated. Thankfully I got Allison to help ...
Read More