Server-Side VS. Client-Side Scripts – The Differences

INTRODUCTION

FRONT-END & BACK-END

Welcome to a quick guide on the differences between server-side and client-side scripts. In modern-day software architecture, scripts that run on the user’s device are called client-side scripts, and scripts that run on the server are called server-side scripts. Generally, client-side scripts deal with the user interface, while server-side scripts deal with transactions and processes.

Yep, the distinction between the 2 is more than just “runs on the user’s device, and runs on the server”. There are various concerns behind each side, and let us explore that a little deeper in this guide – Read on to find out!

 

 

 

SECTION A

THE SERVER AND CLIENT MODEL

Before we explain the differences, this is a small section for the total beginners who do not know what “server” and “client” mean… This is kind of super basic, so please feel free to skip this section if you are already a computer ninja.

 

SERVER AND CLIENTS

A simple illustration of a server/client model (Click to enlarge)

Once upon a time in the Stone Age of Computing, things were a lot simpler. Computers were standalone and not connected to one another. But with the invention of computer networking (and the Internet), things became a little more complicated.

  • The server – Refers to a powerful computer that is set up to provide one or more types of services.
  • The client – All other computers that connect to the server to use the service.

So in today’s context of the Internet, a few examples of services that servers can provide are:

  • Video – Websites like YouTube and DailyMotion provide the platform to upload and watch videos.
  • Audio – Websites like Soundcloud provides the platform to upload and listen to music/podcasts.
  • Text – News websites, blogs, social media platforms, and much more.

But of course, the types of services can go beyond just websites. Another one of such example is multiplayer gaming – Where someone set up their computer as the host/server, and other people join in as the guest/client. Also in today’s mobile applications, one can fire up a weather forecast app (the client), and it will connect to the server to fetch the current weather report.

 

 

SECTION B

SERVER-SIDE SCRIPTS

Now that you have a basic understanding of the server-client model, you should be able to make a better sense of what server-side scripts do.

 

CHARACTERISTICS OF SERVER-SIDE SCRIPTS

Yes, we call them “server-side scripts” simply because the scripts run on the server. But here are a couple of “characteristics” of the server-side scripts to take note of:

  • Transparent – They run on the server, and the actual code itself is obscured from the user. I.E. The user does not know how the code runs exactly, but only knows that something is being processed on the server.
  • Secure – Since users do not know what goes on behind the server, server-side scripts become a “black box”, more suitable for secure transactions and processes.
  • Backend – Generally used to do processing and transactions “behind the scenes”. I.E. Not deal with the user interface.

 

EXAMPLE PROCESSES OF SERVER-SIDE SCRIPTS

Yes, we can say that server-side scripts are used in general for “secure processing and transactions on the server”. But just what exactly? Here are a couple of quick examples:

  • Database – Create, read, update, and delete entries.
  • Monetary transactions – Payment and credit card processes.
  • Fulfilling user queries – Search for information.
  • Cross-server service requests – A good example will be fetching currency exchange rates from another server for an e-commerce website.

 

EXAMPLES OF SERVER-SIDE LANGUAGES

 

 

SECTION C

CLIENT-SIDE SCRIPTS

So what about the client-side scripts? Let us explore that a little more in this section.

 

CHARACTERISTICS OF CLIENT-SIDE SCRIPTS

Yep, you guys should be experts by now, and the characteristics of client-side scripts are kind of the mirror image of the server-side.

  • Not really transparent – Client-side scripts are downloaded onto the user’s device, be it websites or installed apps. In one way or another, users who are better at being “super hackers” can reverse engineer and understand how the code works.
  • Not as secure – Since users have access to the code, we want to avoid using client-side scripts for the direct processing of sensitive transactions and processes.
  • Frontend – Generally used to work with the user interface, collect user input, and send data to the server for secure processing.

 

EXAMPLE PROCESSES OF CLIENT-SIDE SCRIPTS

Before the server-side can do any processing, we will need to first know what the user wants. That is pretty much what the client-side script does in general.

  • User Interface – Forms, buttons, tables, graphics, whatever else.
  • User Input Processing – Accepting user input, process what the user wants.
  • Communications – Communicating with the server, sending data back-and-forth between server and client.

 

EXAMPLES OF CLIENT-SIDE LANGUAGES

 

 

EXTRA

USEFUL BITS & LINKS

That’s it for both of the server-side and client-side scripts, and here is the summary of the differences between the both of them.

 

THE SUMMARY

Client-side Scripting Server-side scripting
Facing Runs on the user’s computer. Runs on the server.
General Purpose Collection of user input, interfacing with the server. Processes the user input, do transactions.
General Processes Deals with user input and interface. Deals with transactions and complex computations.
Code Transparency Scripts are downloaded onto the client computer, which can be accessed by the users. Processes can be easily tampered with. Scripts are not open to users. Processes are transparent or totally invisible to the users.
Security Considered to be generally less secure as users can see and mess with the scripts. Considered to be more secure as users cannot see the source code, and they usually cannot interrupt the process.
Examples HTML, CSS, Javascript. PHP, ASP, Python, JSP, Ruby, C, Java.

 

IS THERE SUCH A THING AS “BOTH SERVER AND CLIENT-SIDE”?

Yes, and Java is a good example of a programming language that can be used to develop applications on both server and client-side – We can use it to develop server-side applications that do transactions, we can also use it to develop mobile applications.

Also, consider the “offline apps” these days, they will have to serve as both the front and backend. For example, a simple “to-do list” app has to deal with the user input, processes, and save the data onto the device itself; It is technically both server and client at the same time.

 

 

LINKS & REFERENCES

 

THE INFOGRAPHIC

Client-side VS Server-side scripts (click to enlarge)

 

CLOSING

WHAT’S NEXT?

Thank you for reading, and we have come to the end of this guide. I hope that it has helped you to better understand, and if you want to share anything with this guide, please feel free to comment below. Good luck and happy coding!

Leave a Comment

Your email address will not be published. Required fields are marked *