問題描述
今天早上我在查看幾個不同的網絡服務器時遇到了 G-WAN.據我了解,它是一個用 C 編寫的網絡服務器,您必須通過用 C 編寫您的網站/網絡應用程序來使用它.一個明顯的好處是 G-WAN 網站建議的速度.
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 的創建者問為什么不將 C 用于基于 Web 的應用程序,我想不出除了難之外的任何一個原因(對我來說,無論如何,我是新手C).除了易于使用這些語言進行開發之外,我們都使用 PHP、Python、Ruby 等肯定還有更多原因.我不認為這是一個很好的理由.
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.
所以我告訴你:你為什么不在你的網絡應用程序中使用 C?
So I put it to you: Why do you not use C for your web apps?
推薦答案
要使 C 程序正確且安全,需要非常小心.這種關心意味著您需要有非常優秀的人來編寫您的程序.這意味著你支付更多.
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 為中心的平臺)那樣從龐大的單一標準功能庫中提取的好處.因此,您可能不得不購買組件,或執行互操作,或者推出您自己的免費"功能,我們可以說以網絡為中心"的語言,如 PHP 或 C# 或 Ruby 或其他什么.這意味著您要支付更多費用.
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.
將所有這些添加到單線程計算速度在網絡上并不那么重要的事實中.如果您需要更高的可擴展性,大多數組織可以經濟地將更多內核用于解決問題并解決問題.當然,并不是每個人都這樣.我認為 Google 引擎的核心是用 C 或類似語言編寫的,不僅是為了速度,而且是為了節省電力成本.
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.
這篇關于為什么不將 C 用于 Web 應用程序?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!