
All things internet contain code. Some of that you may even have written yourself before, but all of it is required in order to be interpreted correctly by clients and servers. Code also lives in different places: some of it lives with the client, and some of it can live with the server. This essentially is the discussion for this blog post, how server and client side code are different.
On the Server Side
Server side code or scripting is what we would think of as the “back end” of our websites. It is the code that is behind the scenes doing the work that our client may not have the ability or permission to do. One of the best examples of this is querying a database. This code will receive a user input and then make an appropriate query in order to return the data a user wants. Common login systems work like this, but passwords are never stored in plain text. They are always hashed! The system will hash the password given to match the one in the database and that is how it knows you are correct.
If there is a file that a user wants to interact with, then that is something that is handled server side. Of course, the user won’t already have the file, so the server will retrieve it for them and either make the edits for them, or allow them to download it for themselves. Server side languages include PHP, Python, SQL, Java, and Ruby when it comes to websites.
In a short summary, the server side code is the one that will generate a lot of the web page content that will be displayed back to the user. It is, of course, essential to a full web applications functionality and an efficient set up will make a difference to the user.
On the Client Side
If server side code is the “back end”, then the client side code is our “front end”. The front end code is made up of languages like JavaScript, HTML, and CSS. These languages are executed by the user and can actually run right on your computer with no server involved. Your browser would interpret your page all by itself. The problem, of course, is that there would be nothing to interact with!
Client side code is also there so that a client can send a request to the server. This could be as part of a form or in a text box, it just has to be something that the server is expecting, otherwise you might end up with a 500 error.
Working Together
These two elements work together to make all web applications run smoothly. A poor front end may make your users unhappy with the look, feel and layout of your site. A poor back end will result in server errors, database problems, or even corruption. It is important to maintain these two distinguished pieces keeping in mind of the end game: working together!
Happy hosting