C++ Web Programming?

Started by
9 comments, last by Replicon 17 years, 11 months ago
Anyone know about the "C++ Server Pages" by Micronovae? (http://www.micronovae.com/default_csp.html) They appear to claim that you can write web apps in C++. Could it be true? They don't give a lot of information, and I suspect that it's not all it claims to be.
______________________________Stranger things have happened...The Following Sentence is True. The Above Sentence is False.
Advertisement
You could always write web applications in C++ using the CGI interface. No biggie. I can't think of a single good reason to use C++ over a dynamic language such as python or perl for writing web applications. In my experience the biggest bottleneck has been the database and never the inefficiency of interpreted scripting code. I would much rather just buy another server to balance the load than write my app in C++. I'd save money that way too. And the point about libraries being written in C++ is moot because most scripting languages will enable you to bind to native dynamic libraries anyway.
I know that C++ lets you write web servers, and web servers run on a machine. Can't one write a server, or mod a server, that hands off form submissions to a C++ exe on the server machine which processes the results then generates an html web page that would be sent off to the client machine? Though I can't find a reason to use this over an existing technology like ASP.NET.
Quote:Original post by AcePilot
Though I can't find a reason to use this over an existing technology like ASP.NET.

It's funny that you mention that. You can easily write managed assemblies using CLI/C++ and the .NET framework and use them from C#/ASP.Net pages. You could even brute force it to work as codebehind although that is actually pretty stupid as using C# for the page model and C# or C++ for the business logic assemblies works great.
A company I worked at did just that. Wrote their own webserver, and pages were generated in C++.

Note, however, that they were astute. They defined their own html-like language, from which C++ was generated, which compiled into what were to be the actual page generators. That way, editing pages was easy (no ugly c++ code), and the pages were generated amazingly fast. The only real setback was that after doing a minor UI change, we had to build it and relink.
Quote:Original post by Replicon
A company I worked at did just that. Wrote their own webserver, and pages were generated in C++.

Note, however, that they were astute. They defined their own html-like language, from which C++ was generated, which compiled into what were to be the actual page generators. That way, editing pages was easy (no ugly c++ code), and the pages were generated amazingly fast. The only real setback was that after doing a minor UI change, we had to build it and relink.

Maybe there is a reason for doing this that you didn't mention, or maybe you just didn't explain what you did properly, but quite honestly that seems to me like the absolute stupidest thing I've ever heard of when IIS/Apache with ASP.NET, PHP, CGI, etc is there to use. Talk about reinventing the 1980s wheel.
This is exactly what I am getting at. Now, don't get me wrong, C++ is one of my favorite languages and definitely the one that I use the most, buy why would you want to force C++ to work in a web-based environment?

C++ was meant to be about a step and a half above asm- allow the programmer to get very close to the hardware, but allow them to abstract, and let them choose whatever tools they want to use, whether they make the right decisions or not. It was not designed to be a web language, and besides, there are plenty of other languages that are specifically designed for that task. Are these people just using C++ for the sake of using C++, or do they think it will somehow be better?
______________________________Stranger things have happened...The Following Sentence is True. The Above Sentence is False.
I'm not sure exactly why unmanaged C++ would be a good alternative. In the case of web game development, such as neopets, I would probably want to use C++ since there is a lot of code availible for it and I wouldn't find myself implementing basic algorithms. Also, if a company has C++ programmers and wants to extend it's services to the web, switching to C# may be a costly option. But again, using C++ would be reinventing the wheel and compared with technologies that have evolved over years, it wouldn't make much sense to use it.
Microsoft's ATL Server technology lets you do web pages in C++. It comes complete with its own template language.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
I can't imagine wanting to write SIMPLE dynamic web pages in C++ (give me C#, python or ruby please).

But you could easily want to build a webpage framework in C++. It is really no different than doing so in Java. Starting from scratch in C++ would be really silly, since the encoding functions and such have been written thousands of time. But just like everybody using a library from perl, python or ruby, those common libraries are almost always built in C, or wrapped in a C compatible API and are available to C++ just like the whole SWIG group.

Personally I don't find C++ as easy to use for such things because of idiom differences between the various library writers out there (it is harder to use 3 difference C++ libraries together than 3 different .NET / Java/ ruby / Python libraries because the platform is more low level, has a longer history, has been used to cover more domains, and is just more uncontrolled than the other platform choices).

This topic is closed to new replies.

Advertisement