{"id":2361,"date":"2010-11-30T10:33:46","date_gmt":"2010-11-30T10:33:46","guid":{"rendered":"http:\/\/www.webdevelopersnotes.com\/blog\/?p=1814"},"modified":"2017-09-13T21:27:59","modified_gmt":"2017-09-13T21:27:59","slug":"client-side-server-side-programming-languages-differences","status":"publish","type":"post","link":"https:\/\/www.webdevelopersnotes.com\/client-side-server-side-programming-languages-differences","title":{"rendered":"Differences between client-side and server-side programming languages"},"content":{"rendered":"<p>Before I explain the differences between client-side and server-side programming languages, let me provide a brief on <strong>clients<\/strong> and <strong>servers<\/strong>. Once you understand what these entities are, it will be easy to grasp how scripts (programs) run on them and, yes, the dissimilarities.<\/p>\n<h2>What are clients and servers?<\/h2>\n<p>The words <em>client<\/em> and <a href=\"\/\/www.webdevelopersnotes.com\/what-is-web-server\" title=\"What is a web server? Definition and a short introduction for the beginner\"><em>server<\/em><\/a> have two meanings. They can  refer either to a computer (<strong>hardware<\/strong>) or a program (<strong>software<\/strong>) &#8211; check the image below.<\/p>\n<p class=\"justimage\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/blog\/blog-images\/clients-servers-difference-hardware-software.png\" alt=\"Difference between clients and servers - hardware and software\" class=\"aligncenter\"\/><\/p>\n<div class=\"clr\"><\/div>\n<div class=\"bottom-ads\">\n<h4>Sponsored Links<\/h4>\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<!-- Inner Page Top - Non Responsive -->\n<ins class=\"adsbygoogle\"\n     style=\"display:inline-block;width:336px;height:280px\"\n     data-ad-client=\"ca-pub-1043128618639037\"\n     data-ad-slot=\"5670477364\"><\/ins>\n<script>\n(adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n<\/div>\n<div class=\"clr\"><\/div>\n<p>For most web users, the client is both the machine (laptop, desktop, tablet, mobile phone etc.) AND the software, typically, the web browser (eg. Internet Explorer, Firefox, Opera, Safari, Chrome etc.). When you open a web site on your computer, your machine is the <strong>Client<\/strong> (note the upper case) because it&#8217;s running <strong>client software<\/strong> (lower case) &#8211; the web browser.  (The case of the first letter doesn&#8217;t matter unless you are a purist.)<\/p>\n<p>Similarly, server can mean both the computer on which the web site resides as well as the software (eg. Apache). <em>The main job of a server is to receive and process requests from clients<\/em>. The best analogy is that of a restaurant or a bar, if you like. The client orders for some food and beverages. The barman (server) takes these requests and serves the client.<\/p>\n<p>The <em>browser program<\/em> (client) on your computer <em>sends a request<\/em> to the machine that hosts the web site. This machine is called a <strong>Web Server<\/strong>. This is typically a high end computer that runs <a href=\"\/\/www.webdevelopersnotes.com\/web-servers-list\" title=\"List of web servers\"><strong>web server software<\/strong><\/a> whose main job is to, well, <em>serve web pages<\/em>.<\/p>\n<p>To know more, please read about <a href=\"\/\/www.webdevelopersnotes.com\/client-server-architecture\" title=\"Client server architecture - a brief for the beginner\">client-server architecture<\/a>.<\/p>\n<h2>What are the differences between client-side and server-side languages?<\/h2>\n<p>Programs written in client-side languages are <em>executed on the client (web browser)<\/em>. The most well-known client-side language is JavaScript. There are others like PerlScript but they are hardly used because not all browsers (clients) support them.<\/p>\n<p>Server-side languages, on the other hand, <em>run on the Web Server machine<\/em>. Two popular examples are Perl (not to be confused with PerlScript, mentioned above) and PHP. Python, Ruby, Java (not JavaScript) are other server-side languages commonly used to build web applications.<\/p>\n<p>Since client-side scripts run only on clients, they are limited in scope. For instance, you cannot employ a database or <a href=\"\/\/www.webdevelopersnotes.com\/javascript-email\" title=\"Can you use JavaScript to send email from your web site? An answer to beginners query\">send email using JavaScript<\/a>! They are, however, useful in <strong>creating interactive web pages<\/strong>&#8230; pages that &#8216;respond&#8217; to visitor actions such as mouse-clicks, mouse movements etc. Client-side scripts also have the advantage of time &#8211; data can be processed and delivered almost instantly to the viewer.<\/p>\n<p>Compared to a client-side script, response from a server-side program is slower. This is because the scripts are processed on the remote computer. To run a server-side script, the user first has to send a request to the server which then executes the program and then, if everything went off well, sends the results back to the client (typically a web page).<\/p>\n<table title=\"Differences between client-side and server-side programming languages\" class=\"smalltext\">\n<tr>\n<th>Clients-side languages<\/th>\n<th>Server-side languages<\/th>\n<\/tr>\n<tr>\n<td>Run on the client (web browser program).<\/td>\n<td>Run on the server.<\/td>\n<\/tr>\n<tr>\n<td>Respond almost instantaneously to user actions and hence used to build interactive web pages.<\/td>\n<td>Responses from server-side scripts are typically slower and depend, among other things, on the speed of the internet connection and server load.<\/td>\n<\/tr>\n<tr>\n<td>Cannot be used to store data; actually, only a few details can be maintained through cookies but these can be deleted by the user.<\/td>\n<td>Can store any amount of data on the server in databases.<\/td>\n<\/tr>\n<tr>\n<td>No support for email.<\/td>\n<td>Emailing visitor inputs from a web site is one of the most common applications of server-side languages.<\/td>\n<\/tr>\n<\/table>\n<h2>Can a computer be both a client and a server?<\/h2>\n<p>A question I get asked very often is: <em>can a single machine be both a client and a server?<\/em>. The answer is, <strong>YES<\/strong>!<\/p>\n<p>For instance you can download and <a href=\"\/\/www.webdevelopersnotes.com\/install-apache-windows-7\" title=\"Instructions on how to install the Apache web server on your Windows 7 computer\">install Apache web server<\/a> on your computer. Additionally you can also <a href=\"\/\/www.webdevelopersnotes.com\/install-php-windows-7\" title=\"Step by step details with screenshots on how to install PHP on your Windows 7 computer\">install PHP<\/a>. If you now develop PHP pages and view them on your computer, the machine becomes <strong>both a client and a server<\/strong>.<br \/>By the way, you don&#8217;t need to put a server on your computer to create simple web site&#8230; just those that involve server-side scripting.<\/p>\n<p>If you enjoyed this article and want to learn more, check out the various <a href=\"\/\/www.webdevelopersnotes.com\/languages-on-the-internet\" title=\"Which are the important programming languages on the web?\">programming languages on the web<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"Before I explain the differences between client-side and server-side programming languages, let me provide a brief on clients and servers. Once you understand what these entities are, it will be easy to grasp how scripts (programs) run on them and, yes, the dissimilarities. What are clients and servers? The words client and server have two [&hellip;]","protected":false},"author":1,"featured_media":17847,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[48],"tags":[],"class_list":["post-2361","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/posts\/2361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/comments?post=2361"}],"version-history":[{"count":0,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/posts\/2361\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/media\/17847"}],"wp:attachment":[{"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/media?parent=2361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/categories?post=2361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/tags?post=2361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}