Live data from Hacker News

Web development in C: Crazy?

medium.com

191–200 of 213 posts

Re: Web development in C: Crazy?

#191
post #103

Earlier quoted context omitted.

> Maybe your problem is CPU-bound. Maybe you have latency limits you need to work within. Unless you have lots and lots of time to spend micro-optimizing everything, you'll get better performance writing in Haskell. > Maybe there are good C libraries that solve your problem Maybe, but most of the original post is about how lacking the library ecosystem is. I can well believe that you might have some useful domain-spe…

> Unless you have lots and lots of time to spend micro-optimizing everything, you'll get better performance writing in Haskell. This is stating the case too strongly. Performance wise, the naive, unoptimized solution in Haskell (ex. using the default String type instead of Data.ByteString, number crunching using lots of iteration\recursion) is going to be much slower than than the naive, unoptimized solution in C or…

ByteStrings are not the alternative to Strings! Text is.

Re: Web development in C: Crazy?

#192

Sure, cool stuff and probably great fun doing it. However what matters in web development is not performance, nor that it is bug free and not even security. All of those things can fixed one way or the other on the server with more hacks. The one thing that matters is speed of development, that is why PHP rules so hard. "Let's argue about whether Haskell or Clojure is better while somebody else ships products using P…

But that comment is such a transparent and absurd red herring that it is an insult to your intelligence to repeat it. People talk about PHP too. That doesn't stop them from shipping products using it. Talking about languages has absolutely no detrimental effects on writing code.

Re: Web development in C: Crazy?

#193

When 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 .

People constantly repeat that, but I never see it actually be true. I frequently see people spend tens or even hundreds of thousands of dollars on hardware and hosting costs just to save $5k of developer salaries. Just because they have internalized this notion that "hardware is cheap, developers are expensive", and don't ever actually look at the numbers.

Re: Web development in C: Crazy?

#194
post #146

Earlier quoted context omitted.

> You may have noticed that C++ is not always deemed universally better than C. What language are all the top web servers implemented in? Apache and nginx => C Tomcat, Jetty => Java IIS => C++/C# > Most OS's actually have a pretty small API footprint (Windows being the obvious outlier). If it were really just about the language bindings, it would not be a real impediment. A language runtime can abstract out the OS (a…

> Apache and nginx => C > Tomcat, Jetty => Java Okay, if you are going to throw in Tomcat & Jetty, you should also throw in the likes of lighttpd, mongrel2, etc., all of which are written in C. Pretty much all the load balancers/reverse proxies are written in C too. Hmm.... is it maybe possible that it isn't always better to use C++ instead of C? > IIS => C++/C# Yup, the one outlier no doubt owes about 0% of its succ…

> > Apache and nginx => C > Tomcat, Jetty => Java > Okay, if you are going to throw in Tomcat & Jetty, you should also throw in the likes of lighttpd, mongrel2, etc., all of which are written in C. Pretty much all the load balancers/reverse proxies are written in C too. Hmm.... is it maybe possible that it isn't always better to use C++ instead of C?

No, they were developed by open source Linux guys that only care about C in what concerns compiled languages.

C++ was always badly received by the Linux community, in contrast with commercial UNIXes.

> IIS => C++/C# > Yup, the one outlier no doubt owes about 0% of its success to its tech stack. In general, if you don't work at Google and want a C++ web server on anything other than Windows, you are looking at a C++ server framework that has an embedded HTTP stack (tntnet, Wt, etc.).

Yes, nothing like contributing to have more insecure servers around.

>> That is my hope, after all we only need a few generations of developers and then the issue is taken care of by itself.

> I think you missed my point. ;-)

I surely got your point, but it is not about Darwin of languages, rather of developers.

Re: Web development in C: Crazy?

#195
post #178

Earlier quoted context omitted.

This made me curious! Why did you do this? To create a database of "signatures" to be used in your contact-list?

No, I signed up for the xe.com daily currency exchange rates email and it occurred to me I could build a database around it. So now I have daily exchange rate data going back a couple years. Thankfully they haven't changed their format. They have a service you can pay for if you want to download this data in bulk but I was being cheap and didn't really have any particular use for the data. Source code: https://bitbuc…

Thank you! I am curious about the trade-market too

Re: Web development in C: Crazy?

#196
post #180
post #168

Earlier quoted context omitted.

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.)

Most consulting projects in Fortune 500 companies end up with outsourcing the whole project department to the consulting company, in the cases where IT is not the main business.

Oh, I didn't know that it's so extreme.. thanks for reporting back, I appreciate it :)

Re: Web development in C: Crazy?

#197
post #195

Earlier quoted context omitted.

No, I signed up for the xe.com daily currency exchange rates email and it occurred to me I could build a database around it. So now I have daily exchange rate data going back a couple years. Thankfully they haven't changed their format. They have a service you can pay for if you want to download this data in bulk but I was being cheap and didn't really have any particular use for the data. Source code: https://bitbuc…

Thank you! I am curious about the trade-market too

If you find a bug, please let me know. My C is probably pretty poor. Thanks! :)

Re: Web development in C: Crazy?

#198
post #194

Earlier quoted context omitted.

> Apache and nginx => C > Tomcat, Jetty => Java Okay, if you are going to throw in Tomcat & Jetty, you should also throw in the likes of lighttpd, mongrel2, etc., all of which are written in C. Pretty much all the load balancers/reverse proxies are written in C too. Hmm.... is it maybe possible that it isn't always better to use C++ instead of C? > IIS => C++/C# Yup, the one outlier no doubt owes about 0% of its succ…

> > Apache and nginx => C > Tomcat, Jetty => Java > Okay, if you are going to throw in Tomcat & Jetty, you should also throw in the likes of lighttpd, mongrel2, etc., all of which are written in C. Pretty much all the load balancers/reverse proxies are written in C too. Hmm.... is it maybe possible that it isn't always better to use C++ instead of C? No, they were developed by open source Linux guys that only care ab…

> No, they were developed by open source Linux guys that only care about C in what concerns compiled languages. > C++ was always badly received by the Linux community, in contrast with commercial UNIXes.

You mean like KDE, Firefox, OpenOffice, OpenCV, VLC, bitcoin... heck even gparted is a C++ app.

The kernel developers obviously have a bias against C++ (and they'd argue that it is a justified bias). User space is a different land.

> Yes, nothing like contributing to have more insecure servers around.

? Not sure your point here...

> I surely got your point, but it is not about Darwin of languages, rather of developers.

> I surely got your point, but it is not about Darwin of languages, rather of developers.

My point was about Darwinian forces applied to language or developers.

I was responding to your point about OS vendors not being left around. It would appear that, for whatever reason, going with something other than C or C++ for your base OS doesn't seem to result in good survival odds.

Re: Web development in C: Crazy?

#199
post #194

Earlier quoted context omitted.

> Apache and nginx => C > Tomcat, Jetty => Java Okay, if you are going to throw in Tomcat & Jetty, you should also throw in the likes of lighttpd, mongrel2, etc., all of which are written in C. Pretty much all the load balancers/reverse proxies are written in C too. Hmm.... is it maybe possible that it isn't always better to use C++ instead of C? > IIS => C++/C# Yup, the one outlier no doubt owes about 0% of its succ…

> > Apache and nginx => C > Tomcat, Jetty => Java > Okay, if you are going to throw in Tomcat & Jetty, you should also throw in the likes of lighttpd, mongrel2, etc., all of which are written in C. Pretty much all the load balancers/reverse proxies are written in C too. Hmm.... is it maybe possible that it isn't always better to use C++ instead of C? No, they were developed by open source Linux guys that only care ab…

[deleted]

Re: Web development in C: Crazy?

#200

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…

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…

The impression that I at least have got of Julia is that it's designed specifically for technical computing (mathematics, science, etc.) rather than general purpose programming as Rust is. I think that would be likely to influence what people use it for significantly? That could be a pity, because Julia does look like quite an interesting language.

Rust's REPL, rusti, is presently broken, but it will be being fixed up later.

I presume Rust's safety will also go beyond Julia's, with its algebraic data types and lack of such things as null, and its rigidly checked type system.

Post reply on HN