A language like Python or Ruby gets you ease of coding and a moderate level of safety; a language like C gets you speed but at a high safety risk. Haskell could get you often similar speed benefits, and there are even a couple of rather interesting frameworks for it (with even things like compile-time template checking), but the barrier for entry is unfortunately high. Thus a language like Rust really comes into its…
Web development in C: Crazy?
171–180 of 213 posts
Re: Web development in C: Crazy?
#172So, people can't hardly write safe web apps in PHP without spraying XSS and auth bypasses and arbitrary shell executions and arbitrary SQL injections everywhere, and you also want to hand the attackers the ability to segfault your server or possibly even straight-up run arbitrary code? Anyone smart enough to truly safely code a website in C is smart enough to learn a language to create that website which doesn't get…
Re: Web development in C: Crazy?
#173Earlier quoted context omitted.
There exists a form of survivalist mindset in some programmers. It goes roughly like this: if you can't boot it, it's fluff programming. The attraction of C to this mindset is that it can be transliterated (vs translated) into machine code. This transliteration is so straight forward that if you know C and are familiar with the basics of the instruction set you can do it by hand. The survivalist mindset fears depende…
On the next episode of "Doomsday Coders" Programmer writes an entire operating system from scratch in case all the copies of Linux in the world are deleted. A web developer writes his entire application in x86 assembly to prepare for an event in which all the world's compilers and interpreters disappear. And more...
Re: Web development in C: Crazy?
#174Earlier quoted context omitted.
I do mostly JVM and .NET based development nowadays, in consulting projects. Sometimes I wish to be part of a C or C++ based project, then I try to imagine how the quality of our offshore guys would map to those languages and realize how lucky I am not to be part of such projects.
Don't you do something wrong, when you consult the company to use (more) offshore guys? I thought that a company is best led, when developers share their knowledge cooperatively and ask their managers to outsource unimportant time-consuming things like api-/file-/conversions, legacy code support, CSVs … (Disclaimer: Don't get my tone wrong please, I'm asking not suggesting, thus I respect your experience.)
Re: Web development in C: Crazy?
#175Earlier quoted context omitted.
> If you aren't smart enough [to safely code a website in C...] the first clue that you aren't is that you think that you are Gee, isn't that epistemology at its finest. Personally I've never met anyone who programmed in C because they were too dumb to learn anything else, but who knows. You may however be aware that, before an HTTP packet even makes it to your shiny, scripty web page, it's often processed by a succe…
I've never met anyone who programmed in C because they were too dumb to learn anything else I have. They were too dumb to understand that they were writing unsafe C code because they weren't skilled enough to write safe C code. So it never occurred to them that they had a problem that would be solved by writing part of their system in Python or Ruby or Java. it's often processed by a succession of "segfault-y" and "a…
"Too dumb to catch vulnerabilities in their code" is a much wider category than "too dumb to learn anything else [besides C]". You're not really providing an example of the second.
>The vast majority of C programmers are much less skilled than Apache and Linux developers
So we agree that at least some C developers can write consistently safe code. So a person is not necessarily "not smart" just because of this language choice.
Re: Web development in C: Crazy?
#176Earlier quoted context omitted.
> If you aren't smart enough [to safely code a website in C...] the first clue that you aren't is that you think that you are Gee, isn't that epistemology at its finest. Personally I've never met anyone who programmed in C because they were too dumb to learn anything else, but who knows. You may however be aware that, before an HTTP packet even makes it to your shiny, scripty web page, it's often processed by a succe…
> it's often processed by a succession of "segfault-y" and "arbitrary-code-running" software such as Apache and Linux. If your web code has ~20 years of security audits and fixes it's probably perfectly safe to use it. If you're adding large new features under tight deadlines I don't recommend it.
Re: Web development in C: Crazy?
#177A language like Python or Ruby gets you ease of coding and a moderate level of safety; a language like C gets you speed but at a high safety risk. Haskell could get you often similar speed benefits, and there are even a couple of rather interesting frameworks for it (with even things like compile-time template checking), but the barrier for entry is unfortunately high. Thus a language like Rust really comes into its…
I think Julia has the potential to be a contender in this space as well. The advantage over Rust or Go is that you get a dynamic language (with a REPL and everything), and still can have C-like performance. You also get metaprogramming and optional typing (so its there if you want safety but you can ignore it if you just need to crank something out). To me it really feels like a blend of the best of Python/Ruby and s…
Personally I use Julia+C for my backends. Haven't decided which language to use for the front-end though, but probably just javascript, python or php.
Re: Web development in C: Crazy?
#178I wrote a small (~300 line) C program to scrape an email and insert the part I wanted into a Postgres database. I used PCRE for the extraction and ECPG for the Postgres part. ECPG stands for embedded SQL in C for Postgres, and it looks like this: // Open the storage subsystem. void open_storage() { EXEC SQL BEGIN DECLARE SECTION; const char* database = DATABASE_NAME; const char* username = USERNAME; const char* schem…
Re: Web development in C: Crazy?
#179When you get 90x the performance using C rather than PHP, the only thing stopping its use is human resources. To put it into perspective, you would need 90 PHP servers to do the same work in the same time as a single C server. Any more debate?
Yes, the cost equation of X PHP developers + 90 servers might be cheaper than the cost equation for Y C programmers + 1 server . Y is almost certainly greater than X .
Re: Web development in C: Crazy?
#180Earlier quoted context omitted.
I do mostly JVM and .NET based development nowadays, in consulting projects. Sometimes I wish to be part of a C or C++ based project, then I try to imagine how the quality of our offshore guys would map to those languages and realize how lucky I am not to be part of such projects.
Don't you do something wrong, when you consult the company to use (more) offshore guys? I thought that a company is best led, when developers share their knowledge cooperatively and ask their managers to outsource unimportant time-consuming things like api-/file-/conversions, legacy code support, CSVs … (Disclaimer: Don't get my tone wrong please, I'm asking not suggesting, thus I respect your experience.)