I have seen lots of companies using multiple languages for web development (google , Facebook, Amazon, WordPress, Yahoo, etc), how is it possible to use different languages on a single web page?
-
2It's the same way that makes it possible to use completely different parts to build one working car. – Sam Varshavchik Aug 08 '20 at 00:22
-
Be aware the difference between data languages (HTML), interpreted languages (JavaScript, Java, Python) and Compiled to Native Code languages (C, C++). Web server hosts generally don't like downloading Native Code executables onto their servers, for security reasons. Thus many web pages contain code that can be interpreted by the web servers. – Thomas Matthews Aug 08 '20 at 01:24
1 Answers
Hi and welcome to the Stack Overflow community!
Your question might get deleted as it doesn't really fit here (it might be better asked on the CS network of Stack Exchange), but I'll answer as best I can so hopefully the next time you're on here, you'll be asking questions about your code :)
how is it possible to use different languages on a single web page?
The real answer is: that's just how it is.
That seems kind of a simplistic answer, I know, but let me explain:
A web client (like your web browser), opens a connection to a web server and "talks" to the web server using protocols to then do the things the web site wishes. The web server is an application that was likely written in C or C++, but that does not mean the web site is written in C/C++. The web site could be written in PHP, ASP, Lua, JavaScript, Java, C#, or just about any other language, to include C and C++.
The web site is not an "application" like the web server is. The web server must be able to "understand" the language the web site is written in (like PHP, ASP, Python, etc.).
The web site does whatever it was written to do, then passes the results to the web server who then passes it to the web client. For traditional sites, the web client will receive HTML that tells it if there is JavaScript, CSS or other elements that need to be downloaded, parsed and run.
There are various differences between the languages and they all serve different purposes (especially where HTML/CSS/JavaScript are concerned), but the gist of it boils down to that's just how the CS ecosystem has evolved.
I hope that can add a little clarity.

- 6,625
- 1
- 30
- 39
-
1Thank you for your advice and for such an in-depth explanation.Respect!! – X caliber Aug 08 '20 at 10:30