Live data from Hacker News

C++ in Coders at Work

gigamonkeys.com

151–160 of 174 posts

Re: C++ in Coders at Work

#151
post #5

Part of how C++ is successful is that it retains C compatibility, and C accurately models how the computer actually works (at least computers of the 70s and 80s, which is all we know how to program well). Lovely languages like lisp, python, haskell may be nicer to work with, but they do not model the underlying machine properly, and for so many problem domains that is just not acceptable. It's not just a performance…

I think C models how the computer works a lot more closely than C++ (and no one would argue that C isn't carrying water out in the engineering world even today). IMO C++'s issue is precisely that it layers all of these leaky abstractions on top of the strict procedural model of C. For my money, developers are better off knowing two tools (c + some very high level language) rather than the spork which is C++.

assembly more closely models how the computer works than anything...

Re: C++ in Coders at Work

#152

Earlier quoted context omitted.

You missed my point. Most users each probably have a different subset of Word.

No, I got it all right, that's what I meant. Each user subsets word for themselves in to what they need/can handle.

No, that's still not my point. Each user has a different subset of Word. Hence, the only set that contains all of the features that all users use is Word itself. If everyone uses a different subset, it's not accurate to call it bloated, too large, or complain it has unnecessary features. All features are necessary for someone.

Re: C++ in Coders at Work

#153
post #85

Earlier quoted context omitted.

But I can safely say that it is a machine that the C language models fairly precisely and that python, lisp etc will use in ways that will make it harder to predict how their constructs will interact with the machine. That's exactly the point, if your machine is anywhere near 'standard' (as in not a SIMD or something exotic) then C is as close as you can get to it without going to assembler.

I characterize C as a portable assembly language.

Sure, portable assembly language. With, you know, named variables, type abstraction, recursive function decomposition, infix expression grammar, heirarchical flow control constructs... just a bunch of silly tricks. :)

Modern developers have gotten so used to the fact that C is "low level" that they tend to forget how low really low level coding is. There's a ton of "high level" language features in every 3GL, and that includes C. The abstractive distance from machine code to a language like C or Pascal is far, far higher than it is between C and Python.

Re: C++ in Coders at Work

#154
the point about everyone making their own sub-language is exactly right. In fact, I've heard programmers say that's exactly what they love about it.

Problem is, every shop is inventing their own subculture. When programmers who haven't worked together look at each other's C++, they're basically learning a new language.

I do think this has changed a bit in the last few years. The whole 'design pattern' meme exists primarily to create nexuses of style that programmers can gravitate to. It just seems like such a slow way home, especially in comparison to a language like Python, which goes out of its way to restrict the number of ways you can skin the cat.

Has any serious programmer ever looked at a Python file and said "wtf?" for more than a minute or two? And, has any experienced programmer not had the experience of looking at a new batch of C++ (say at a new job) and thought to him/herself, jeez, this is going to be a lot of work just to understand the basics of what they're doing?

Re: C++ in Coders at Work

#155
How could people complain on c++ when so many daily useful tools were written in it? Even their beloved JVM is a mere C++ program. Consider very successful and really cross-platform Webkit, V8, Mozilla's Geeko and so on. And there are thousands successful proprietary projects like Informix and even this popular MySQL.

If Google, Mozilla and many others can productively use C++ why other people can't? They even published guidelines how to use stable and portable subsets of language.

Re: C++ in Coders at Work

#156
post #117

Earlier quoted context omitted.

Strong typing plus full OO = Bondage and Discipline language, where the size of the code itself starts to really drag your development and debugging time down You're missing a crucial part of the equation: type inference. OCaml does what you want :-)

Sure, I just meant in the languages I've been using recently. I someone is coming up with a type-infering variant of Ruby called Juby which could do the trick once it is work. Now, has anyone coded a GUI with Ocaml?

Not personally (still use Tcl/Tk) , but: http://coherentpdf.com/blog/?p=38

Re: C++ in Coders at Work

#157

Earlier quoted context omitted.

I remember 'cfront', when it first came out, and to this day I haven't really changed my mind on how I felt about it, it's a much too bloated language compared to the elegance of C. If 'C' would have had a decent native string type I think C++ might not have happened ;)

Are you suggesting that std::string, or as my not-so-friendly c++ compiler likes to call it std::basic_string ::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits , _Alloc = std::allocator ] is an improvement? :-)

That's not what your compiler calls the string class. That's what it calls one particular constructor of the string class.

This constructor lets you customize the way the string class allocates memory. Now I would like to see the equivalent constructor in your favorite language :)

Re: C++ in Coders at Work

#158

Earlier quoted context omitted.

In general, hardware optimized for high-level languages have been a failure, usually the extra baggage for handling things as machine-level interpreter slow things down nearly as much as a software interpreter. Nothing has been a real commercial success and it isnt for want of trying. Off the top of my head I can think of the Burroughs B5500 which had hardware support for typed data, the Lisp Machine, and the Intel 4…

IBM has plug-in hardware JVMs for its mainframe big iron. They are ungodly expensive.

According to Wikipedia, "zAAPs are not specifically optimized to run Java faster or better". Apparently they're just normal IBM mainframe processors crippled to only run Java and XML.

Re: C++ in Coders at Work

#159
post #26

Earlier quoted context omitted.

> C accurately models how the computer actually works i don't even know on what kind of hardware my java or python programs run. neither google (appengine) nor our IT apartment tell me. so for most app developers "a computer" is not really something they work with. of course someone must write those abstractions (python, etc), and they do it in C/C++ :)

But I can safely say that it is a machine that the C language models fairly precisely and that python, lisp etc will use in ways that will make it harder to predict how their constructs will interact with the machine. That's exactly the point, if your machine is anywhere near 'standard' (as in not a SIMD or something exotic) then C is as close as you can get to it without going to assembler.

But I can safely say that it is a machine that the C language models fairly precisely

Not any longer. I don't know how C models the kind of massive parallelism that is becoming mainstream right now.

Re: C++ in Coders at Work

#160

Earlier quoted context omitted.

Recently, I went from Ruby on Rails web programming to C++ w/Qt GUI programming. Using the C++ features that I choose, C++ is actually pretty fast to develop on... (I did MFC years ago and that was nasty but Rails internal code is also awful, with fifty-million separate classes just for exceptions). Aside from C compatibility, C++ also allows one to create simple structures and procedures when such simple beasts are…

At least C# doesn't require you to allocate a file for your class, and a simple two-field class should consume no more than 5 lines of code. And if you're willing to use a generic tuple type, you don't need to declare a class at all; just use Tuple as needed.

Or just use an anonymous type:

  var simple = new { Field1 = "foo", Field2 = "bar" };
Post reply on HN