Is it possible to write websites in C or C#?

On the Internet, it is often written that it is unrealistic to make sites (server programming) in languages like C, C++, C#, Fortran, TurboPascal, it is necessary to do it in programming languages like PHP, Perl, Python, Ruby, Java.

But why is this so and what is the unreality on the Internet there is still no normal explanation and many beginners do not understand, I would even say do not know, since this issue is not normally considered anywhere else?

So I would like to understand

  1. Is it possible to make websites (hereafter we will talk about server programming, not client programming) in C, C++, C#, Fortran, TurboPascal, or any other languages? Or are there some features that do not allow you to do this or very much complicate the development and what are these features?

  2. Do I understand correctly that for these languages C, C++, C#, Fortran, TurboPascal there should be a compiler on the server and is it there? Or you need to upload it to the server already compiled program, if so it will be able to execute it or not?

  3. What is the main advantage of PHP, Perl, Python, Ruby, Java in terms of server programming against C, C++, C#, Fortran, TurboPascal and any other languages? Does it exist at all or in its own time did good marketing play its part?

Author: Qwertiy, 2017-11-22

5 answers

Make websites in languages like C, C#, Fortran

In fact, absolutely all sites are "made" in HTML. Another thing is that all the html pages that make up the sites are divided into two categories:

  1. Static (immutable) pages
  2. Dynamic (constantly changing) pages.

An example of static pages can be pages containing documents-fixed text that does not change, and if it does, then very rarely.

Dynamic pages are generated "on the fly", at the moment when the user entered the URL of this page. Examples include price lists, news and weather sites, guest books, etc.

The trend is that more and more of the site's content is becoming dynamic. Naturally, the question arises, what means this very generation of html pages is performed. Since the pages themselves are just text documents, then to work with this format data needs tools that work well with text, strings, and characters.

There are two classes of these tools that perform content generation:

  1. Specialized programming languages (Perl, PHP,Rust, Go...)
  2. Whole content generation systems-CMS.

Naturally, the C language is completely unsuitable for processing text documents - the set of functions for this purpose in it is extremely primitive. But if there is a desire, you can also use C write a program that generates an htm page, put it in the cgi-bin directory, and enjoy the result.

 3
Author: Sergey, 2017-11-23 04:04:04

But why is it unreal

Really. At least in assembler, at least in Fortran, at least in bash. The question is labor costs and levels of abstraction.

Is it technically possible to generate an html page on the server in any language?

Yes. But try to process something like multipart/form-data in C/ASM/etc (even with the involvement of third-party libraries), and imagine that this is the most primitive task among those that have to be solved.

P.S. That's why it's stupid to ask "what language to learn" - different languages are suitable for different tasks, and a normal programmer should know at least five of them :)

 4
Author: PinkTux, 2017-11-22 23:22:32

Is it possible to make websites (hereafter we will talk about server programming, not client programming) in C, C++, C#, Fortran, TurboPascal, or any other languages? Or are there some features that do not allow you to do this or very much complicate the development and what are these features?

Can. But all of these languages, except C#, do not have anything out of the box for web development. Here is an article on habr, how to write in assembly language: https://habrahabr.ru/post/318916/.

Do I understand correctly that for these languages C, C++, C#, Fortran, TurboPascal, there should be a compiler on the server and is it there? Or do you need to download an already compiled program to the server, if so it can execute it or not?

Wrong. You need the runtime of the language, if it is required after the program is compiled by your compiler. If you have received an executable file, then you just need to run it.

C# again, it stands out a little, because in .net core something was done wrong, as it was in classic C#, where the application was compiled into code. I don't know what is needed for its execution on the server, but with classic C#, the compiler is also not needed.

What is the fundamental advantage of PHP, Perl, Python, Ruby, Java in terms of server programming against C, C++, C#, Fortran, TurboPascal and any other languages? Does it exist at all, or did a good man play his part at the time? marketing?

Php initially has something that allows you to use it to write a website. This includes a bunch of functions for working with request/response, buffering, etc., and a built-in template engine.

There is a deprecated one in C# asp.net and newer ones asp.net mvc and webapi. The latter two are also included in the cross-platform .net core. It is very convenient to write websites on them.

Node.js provides low-level access to the request and response, and it has long been written for analogues of common ones. solutions for site construction. The most popular is express.

Java used to have jsp, but it's outdated, I don't know what it is now.

There is nothing in c and pluses. There even methods for working with the network are not included in the standard, if I'm not mistaken, so you will have to do everything from scratch and for a specific platform (well, or look for a ready-made one - I think there should be something).

Turbopascal-old stuff with 16-bit programs. First of all, I have no idea on which servers it will be able to run, secondly, there is not enough memory - 64 KB for everything and, probably, the ability to dig up to 2 gigs through distant pointers (this is remembering borland c++), but no one will give a megabyte of stack, as in modern programs.

 4
Author: Qwertiy, 2017-11-27 07:03:15

And you will replace "impossible" with "I'm broke to learn the language". Get the answer. In principle, you can write at least in assembly language.

PHP, Java, Ruby have a low learning threshold, compared to C,C#

 0
Author: Алексей Кременецкий, 2017-11-23 01:21:21

I read kamenty. He laughed a lot. The knowledge of "ixperts" about c and pascal, as well as about the principles of CGI, is simply amazing.

You can do everything in C, but you need to have a brain. And on Pascal, too. These languages have a huge set of libraries for all applications, which allows you to write compact and fast applications. With brains, of course. Only here with the brains in the web industry is very bad.

PS Before the advent of "miracle languages", all web services were written in c.

 0
Author: lps, 2019-08-08 21:35:42