For the back end, you can use whatever you like, because your code runs on a server, rather than in the end user’s browser. You can install whatever languages you want on the server.
Potentially . . . Web Assembly . . . ?
Anyone’s guess but it keeps C++, C, C# relevant in front end, rather than just the back end.
C isn’t used for writing web pages at all, or for back-end development for that matter either. C is typically used these days to write things like operating systems, device drivers, embedded software, and low-level optimizations for slightly higher-level languages like C++ and Java.
Yeah I kinda wrote the post above in a hurry. It’s possible to write back end in C, but not common (usually other concerns are more important than optimizing performance to that level).
Back ends written in Ruby (Rails), Python (e.g. Django), PHP, Java, etc. are much more common.
Meanwhile, C does still have a use in web development, but usually in the form of specialized utilities that can be run on the server. One common example is ImageMagick, which is often used for reducing image file sizes, among other things.
And don’t forget Microsoft .NET framework, and .NET Core which uses C#
It would be like asking, “Which is better? A hammer or a screwdriver?”
My perception is that C is used for writing things that need speed and maximized memory usage. It’s a very low level language that allows you to write code that complies into very compact, fast code. If you’re writing an operating system, some complex graphics service, etc. - then C is what you want.
But as pointed out, it is not a front end language and you cannot write a web page in it. You could probably write a back end in it, but more likely you’d write the back end in a more common back end language and call the native code written in C for any function needing that level of speed.
And of course, C and C++ are not the same language. C++ is an extension of C and uses a lot of things well beyond standard C.
Those “Written in [insert language here]” indicate the language(s) used to write that company’s core service or application, not their website. Every company’s website is written in HTML/CSS/JS, but not every company will use the same tech stack or language to build their product(s).
When the one for Quora says both Python and C++, I’d be inclined to guess that their service is powered by Python + Django, with some server-side components written in C++ for performance optimization.
So it is only server-side part of the web page written in C++? Did I understand you correctly?
If you follow the footnote in that Quora wiki, the article talks about “Why did Quora choose C++ over C for its high performance services?”
This is what we were talking about. C++ is used for a few performance critical operations - things that need to be super fast and lean - on the back end. They can’t run on the front end, because C++ must be compiled separately for every architecture and operating system. The “code” is the same, but the machine code into which they are compiled will be different.
Every front end has HTML. Anything with all but basic styling will have CSS. Anything with dynamic actions will have JS. That’s pretty much it. There are libraries and frameworks you can layer over it, but it comes back to those. They are the heart of the internet. (Front end, at least)
Do you need a back end? Your server could just serve up those static front end files. For a simple web site, that might work. Anything involving databases and such will need more of a back end. That can be written in many different languages, some working together on different modules. They can then communicate with the front end over a protocol, like http.
C++ is a perfectly cromulent language. But if your goal is web dev, it’s far down the list on things you need to learn. I’d be willing to bet that most web devs never use C++.
So, C++ was used by Quora just to “polish” existing backend technology of the website?
There were some tasks that needed to be done many, many times so optimizing them for speed made sense.
If you have a backend API that needs to serve the sum of two numbers, then any old language will do. If you need to do complex calculations of fluid mechanics, then you need to optimize for speed.
No, you definitely didn’t understand me correctly, and there’s no such thing as the server-side part of a web page, except in cases where PHP is being used (because PHP is a unique language that runs on web servers and comprises the server-side of a web page). As ksjazzguitar mentioned, C++ can be used to write programs that run on the server itself (or on other computers that may not be the server). These programs aren’t part of the web page at all. They’re not used to generate anything for the display of a web page, or to show you anything visible, or anything else along those lines. They run completely behind the scenes, totally separate from the website.
Quora, for example, has a service that’s totally separate from their website. That’s where a C++ program would run. You can think of the abstraction layer where a C++ program might run to be the “back-end” for a back-end—something that’s retrieved and executed in order to quickly build or process something that you won’t ever see directly on Quora’s website, but will end up helping their service to be able to keep up with all of the questions and answers being posted.
I guess you could argue that this is true in a sense, in that the server-side code doesn’t get sent to the client, but very often the client-side markup/code is generated by server-side code.
This is fundamentally mistaken. There isn’t anything intrinsically special about PHP. It’s true that many web servers come with it installed by default, but that’s just a configuration thing, nothing to do with it being “unique”.
“They aren’t used to generate anything” — there’s no reason to assume that this is true. The example I mentioned above, ImageMagick, can be used to generate user-viewable content (C not C++, but the point stands).
Equally, there’s no reason in principle that you can’t generate all client-side content in C++ or some other relatively low-level language. It just wouldn’t be a good idea in most cases.
Man you guys make me feel old and I’m not even a web developer. Doesn’t anyone remember CGI? Of course any language can be used there and it wasn’t uncommon to use C or C++, though I suspect perl dominated in that period. My host still supports it, but I doubt it’s seeing much use anywhere.
No reason why you cant write stuff that generates web pages in C++, its just generally an awful idea because of how low level the language is (PHP I think was originally just a high-level DSL written in C, just some thin wrappers over common C libraries/functionality to avoid having to write C).
Yea, I can remember that being a thing, though actually writing web stuff in C/C++ was just before my time, Perl was on it’s last legs.
As an FCC participant you should not bother with C or C++ at all.
They are statically typed compiled languages and have quickly been abandoned in favor of dynamic interpreted languages like Perl, Php, Python for web development.
There are many Php extensions, Python modules written in C, but a typical Php/Python programmer does not bother with C, their functionality is available like typical Php/Python classes or functions. The same with ImageMagick, which is a set of commandline tools and library written in C++ with many language bindings.
You can split the difference between the ‘web page’ as it appears on the client and the ‘web site’ which includes the server-side as well, but it’s all semantics really.
Because someone has the necessary knowledge to be able to do it, that is the reasoning.