Skip to content

Instantly share code, notes, and snippets.

@English3000
Last active December 2, 2017 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save English3000/8fa4dc12cfc3840bbf2f1d6bad6a3051 to your computer and use it in GitHub Desktop.
Save English3000/8fa4dc12cfc3840bbf2f1d6bad6a3051 to your computer and use it in GitHub Desktop.

CLIENT. SERVER. DATABASE.

Client-side: HTML, CSS, plus JavaScript to access the server.

Okay, before I go over MVC (Model-View-Controller)...

JavaScript

They (at App Academy) tell us that all companies use it. They say it's a must-have for the job market. And from my experience searching online, I did not find a source that explains well what it does.

Here's what JavaScript does:

  1. it dynamically modifies HTML/CSS on myriad user events;
  2. it sends asynchronous requests to the server...

Asynchronous: not concurrent/not at the same time.

Let's take another step back.

How to Code

To code, you need a text editor. Microsoft Word counts as a text editor. What makes something code is merely the file extension it is given. Coders use editors like Atom and Visual Studio Code. If you use Atom, you'll also need to access your computer's Terminal/Command Line which you should search for in your applications. The Command Line is a way to do stuff on your computer without moving your mouse along the graphical user interface (aka viewport, aka computer screen). In the Command Line, you type commands, hit enter, and that does stuff to your computer.

Which means you need to know the Command Line, aka Bash. Codecademy covers that.

Why do you need to know the Command Line? Remember those text editor files with the special extensions. You use the Command Line to actually run (or compile) your code. Your code is written in .html, .css, .js, etc.

Your code is compiled.

By a compiler, on your computer... Which then is translated by transpilers until it is in a low-enough level language for the computer's operating system to work with.

Your code is compiled.

Synchronously.

In order.

Not asynchronously.

EXCEPT IN JAVASCRIPT.

So remember our GET request triggered by submitting our URL in order to get to our desired website? That takes time. And if you're getting a lot from the database, it can take a lot of time. In theory, if each page of a website uses info from the database, synchronous requests--which occur one after the other, in order, waiting for the prior one to finish--could get very slow. Or you might need to refresh the page a lot to send a request each time you want to access another page or piece of info.

That's why everyone (all browsers) uses a functionality of JavaScript called Asynchronous Javascript As XML (AJAX). AJAX sends asynchronous requests from the client to the server. That means a compiler reads your AJAX request line of code. Then, while it starts executing that, it moves on and compiles the rest of your code. This means that a line of code that comes after your AJAX request could be finished before your request returns a response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment