問題描述
今天早上我在查看幾個(gè)不同的網(wǎng)絡(luò)服務(wù)器時(shí)遇到了 G-WAN.據(jù)我了解,它是一個(gè)用 C 編寫的網(wǎng)絡(luò)服務(wù)器,您必須通過用 C 編寫您的網(wǎng)站/網(wǎng)絡(luò)應(yīng)用程序來使用它.一個(gè)明顯的好處是 G-WAN 網(wǎng)站建議的速度.
I was having a look at a few different web servers this morning when I came across G-WAN. As I understand, its a web server written in C and you have to make use of it by writing your websites/webapps in C. One clear benefit is speed as the G-WAN site suggests.
然而,在論壇上,G-WAN 的創(chuàng)建者問為什么不將 C 用于基于 Web 的應(yīng)用程序,我想不出除了難之外的任何一個(gè)原因(對我來說,無論如何,我是新手C).除了易于使用這些語言進(jìn)行開發(fā)之外,我們都使用 PHP、Python、Ruby 等肯定還有更多原因.我不認(rèn)為這是一個(gè)很好的理由.
However, on the forums, the creator of G-WAN asked why not use C for web based apps and I can not think of a single reason apart from it being difficult (for me anyway, I am newbie when it comes to C). There must be more reasons why we all use PHP, Python, Ruby etc apart from it being easy to develop in these languages. I don't see that as a good reason.
所以我告訴你:你為什么不在你的網(wǎng)絡(luò)應(yīng)用程序中使用 C?
So I put it to you: Why do you not use C for your web apps?
推薦答案
要使 C 程序正確且安全,需要非常小心.這種關(guān)心意味著您需要有非常優(yōu)秀的人來編寫您的程序.這意味著你支付更多.
It takes a great deal of care to get a C program correct and secure. That care means that you need to have really good people writing your programs. That means you pay more.
此外,C 沒有像 .NET(和其他主要的以 Web 為中心的平臺(tái))那樣從龐大的單一標(biāo)準(zhǔn)功能庫中提取的好處.因此,您可能不得不購買組件,或執(zhí)行互操作,或者推出您自己的免費(fèi)"功能,我們可以說以網(wǎng)絡(luò)為中心"的語言,如 PHP 或 C# 或 Ruby 或其他什么.這意味著您要支付更多費(fèi)用.
Also, C doesn't have the benefit of drawing from an enormous single standard library of functionality as .NET (and the other major web-centric platforms) has. So you may have to either buy components, or perform interop, or roll your own functionality which comes "for free" with a more, shall we say "web-centric" language like PHP or C# or Ruby or whatever. That means you pay more.
將所有這些添加到單線程計(jì)算速度在網(wǎng)絡(luò)上并不那么重要的事實(shí)中.如果您需要更高的可擴(kuò)展性,大多數(shù)組織可以經(jīng)濟(jì)地將更多內(nèi)核用于解決問題并解決問題.當(dāng)然,并不是每個(gè)人都這樣.我認(rèn)為 Google 引擎的核心是用 C 或類似語言編寫的,不僅是為了速度,而且是為了節(jié)省電力成本.
Add all of that to the fact that single-threaded computational speed just isn't that important on the web. If you need more scalability, most organizations can economically just throw more cores at the problem and be fine. This is not true for everyone, of course. I'd imagine that the core of Google's engine is written in C or a similar language not only for speed, but to save real money in power costs.
這篇關(guān)于為什么不將 C 用于 Web 應(yīng)用程序?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!