Friday, November 15, 2019

Programming languages for Web Development

A web application is usually built with 5 types of files corresponding to different programming languages. 

Client side

These files are copied to the users computers via web browser and displayed/run there.

HTML

What's for:
Setting the basic site structure, like what part is text, what's a table, what's a picture, etc...

File extension:
.html

Code looks like:

<html>
  <header>
    <title>This is title</title>
  </header>
  <body>
    Hello world
  </body>
</html>



JavaScript

What's for:
Writing functions that run on the user's side, like get the local time, display alerts, set a timer, etc..

File extension:
.js

Code looks like:

function initCountdown() {
  var oneDay = 24*60*60*1000; // hours*minutes*seconds*milliseconds
  var today = new Date();
  var secondDate = new Date(2017,7,27);
  var diffDays = Math.round(Math.abs((today.getTime() -  secondDate.getTime())/(oneDay)));
  document.getElementById("countdown").text = diffDays;
  alert(document.getElementById("countdown").text);
}


CSS

What's for:
Making the app pretty. Font type, color, size, image borders, alignment, some animations, background, etc...

File extension:
.css

Code looks like:
.on-the-day-section .two-column-holder ul li p {
padding: 0 2%;
font-family: "Lato", sans-serif;
font-size: 12.5px;
font-size: 1.25rem;
color: #828282;
text-align: center;
}


Server side

These files are executed privately on the web server

SQL

What's for:
Read and write from/to a database

File extension
.sql

Code looks like:
select first_name
, last_name
, email
, phone
from customers
where name = 'Homer'


PHP/Python/Java/Go, etc..

What's for:
Middle-man between users and database, depending on language it handles security, authentication, serving files, etc...

File extension:
Various (.php, .py, .java, .go, etc...)

Code looks like:
Various, but similar to the JavaScript example.