Live data from Hacker News

Why is BIND 10 written in C++ and Python?

isc.org

121–130 of 136 posts

Re: Why is BIND 10 written in C++ and Python?

#121

Earlier quoted context omitted.

>Why doesn't it look good for python? Because it directly contradicts the "only 20% of your code is performance sensitive and the other 80% can be scripting language X" nonsense that scripting language apologists constantly parrot with no evidence. This is a good example of how scripting languages are in fact not well suited to application development, and should instead be used for scripting.

The question isn't how much Python there is relative to C++, the question is how much C++ there would be if there were no Python. To put it more concisely: "only 20% of your logic is performance sensitive and the other 80% can be encoded in scripting language X leading to a significant reduction of your total code."

It doesn't lead to a significant reduction though, it is hardly any reduction at all. Look at their code, the python could be replaced with C++ at an almost 1:1 ratio.

Re: Why is BIND 10 written in C++ and Python?

#122
Sad. They didn't do their homework. They basically had the exact same requirements of the commercial video game industry which uses C/C++ and Lua to solve this problem. Lua had already long asserted its dominance by 2006 so it wasn't a secret. And they should have done a lot better than only 17% of the code in Python.

Re: Why is BIND 10 written in C++ and Python?

#124
post #72

Earlier quoted context omitted.

C++ allows to you to - use safe arrays with bound checking if you feel like to - use automatic memory management - pass arguments by reference and being sure they point to valid data - use proper strings without caring if the null character is missing C++ is only dangerous thanks to the C compatibility legacy. Don't use C'isms and the application will be a lot safer than doing pure C coding.

C allows those things too, that's the point. Saying "I choose to code unsafely in C, and safely in C++, therefore C++ is safe and C is dangerous" is dishonest. And C++ has plenty of its own dangerous aspects, not just C compatibility.

> And C++ has plenty of its own dangerous aspects, not just C compatibility.

All of them would go away if C++ wasn't made to be C compatible.

Re: Why is BIND 10 written in C++ and Python?

#125
post #85
post #72

Earlier quoted context omitted.

C++ allows to you to - use safe arrays with bound checking if you feel like to - use automatic memory management - pass arguments by reference and being sure they point to valid data - use proper strings without caring if the null character is missing C++ is only dangerous thanks to the C compatibility legacy. Don't use C'isms and the application will be a lot safer than doing pure C coding.

I am not sure about the reference passing, but the rest you can do in pure C, too. You can bound-check your arrays at run-time, by wrapping them in a struct and only accessing them with functions. There's even a proper (although conservative) garbage collector for C, while C++ usually boils down to reference counting. Even in C you are not restricted to the standard library to handle strings. C doesn't have to mean n…

> You can bound-check your arrays at run-time, by wrapping them in a struct and only accessing them with functions.

This is no longer a data type seen as a language type, but an Abstract Data Type as known in Computer Science.

You are no longer using arrays, but a data structure made by yourself.

> There's even a proper (although conservative) garbage collector for C, while C++ usually boils down to reference counting.

If you are referering to Boehm-Demers-Weiser GC, it also works in C++.

C++11 also has a GC API.

> Even in C you are not restricted to the standard library to handle strings. C doesn't have to mean null-terminated strings.

The moment you do this, you are the strange kind in town as all libraries expect C style strings as input. So it is conversion party any time you need to call those functions.

> (And in C++, too, string literals give you the old-time bad strings.)

Yeah, this is a consequence of C's compatibility that infected C++.

Re: Why is BIND 10 written in C++ and Python?

#126
post #89
post #76

Earlier quoted context omitted.

What about missile radar systems? http://www.militaryaerospace.com/articles/2009/03/thales-cho...

Very cool, but not really related to core internet functionality. The truth is, Java is viewed as "not Unix friendly" by many people, whether deserved or not. I suspect the ISC folks fall squarely into this camp. My personal and thus purely anecdotal experience is near-universal hostility from network admins. Despite this, there is a fair amount of network management software written in Java. OpenNMS and Cisco Prime…

Yeah, cultural issues are very hard to fight and usually require a generation change.

I convinced unless a big OS vendor forces changes for their default system programming language, nothing will change.

This is why I like Microsoft's decision to drop C on Windows.

What I would like is to have a proper systems programming language in the lines of Modula-3/Active Oberon/C#/D/Rust or similar, being used.

Time will tell when this happens, but it will require a few generations of developers for the mentality change to take place.

Re: Why is BIND 10 written in C++ and Python?

#127
post #36

Earlier quoted context omitted.

Those implementations have quite weak garbage collection implementations (boehm conservative, but I'm not sure), which would just kill the performance. Hotspot JVM has a very sofisticated Incremental Generational garbage collector, which does have a _very_ good performance. I'm pretty sure they had their reasons for not using Java (I actually do have mine too), but, garbage collection is not one of those.

Indeed. I was arguing against the 'you need the JVM as a dependency'. But then Go is all the hype these days, and people also use Go for network applications, which also has a weak GC ;).

Go does generate a _LOT_ less garbage then Java, you can control the layout of your structures. That why its gc has less impact on performance then the JVM´s one.

Re: Why is BIND 10 written in C++ and Python?

#128
post #123
post #86

Earlier quoted context omitted.

You haven't used PHP much? Or MUMPS?

PHP is not a compiled language for systems programming. As for MUMPS I know it is something used only in US it seems.

Oh, I wasn't aware that you only talked about those. MUMPS is also not for systems programming, as far as I know.

To nitpick a bit, compiled or not is more a property of the implementation than of the language itself. Of course, some languages are more commonly compiled than others. But, don't Facebook have a PHP compiler?

Re: Why is BIND 10 written in C++ and Python?

#129
post #125
post #85

Earlier quoted context omitted.

I am not sure about the reference passing, but the rest you can do in pure C, too. You can bound-check your arrays at run-time, by wrapping them in a struct and only accessing them with functions. There's even a proper (although conservative) garbage collector for C, while C++ usually boils down to reference counting. Even in C you are not restricted to the standard library to handle strings. C doesn't have to mean n…

> You can bound-check your arrays at run-time, by wrapping them in a struct and only accessing them with functions. This is no longer a data type seen as a language type, but an Abstract Data Type as known in Computer Science. You are no longer using arrays, but a data structure made by yourself. > There's even a proper (although conservative) garbage collector for C, while C++ usually boils down to reference countin…

> This is no longer a data type seen as a language type, but an Abstract Data Type as known in Computer Science.

Yes, it's no longer a built-in data type. But non-builtin-types are perfectly fine, too. By the way, how do you get bounds checking in C++? I guess you use the same technique, but C++'s overloading makes it syntactically easier to hide that you are not using a built-in?

Re: Why is BIND 10 written in C++ and Python?

#130
post #129
post #125

Earlier quoted context omitted.

> You can bound-check your arrays at run-time, by wrapping them in a struct and only accessing them with functions. This is no longer a data type seen as a language type, but an Abstract Data Type as known in Computer Science. You are no longer using arrays, but a data structure made by yourself. > There's even a proper (although conservative) garbage collector for C, while C++ usually boils down to reference countin…

> This is no longer a data type seen as a language type, but an Abstract Data Type as known in Computer Science. Yes, it's no longer a built-in data type. But non-builtin-types are perfectly fine, too. By the way, how do you get bounds checking in C++? I guess you use the same technique, but C++'s overloading makes it syntactically easier to hide that you are not using a built-in?

Yes, but that minor difference makes a huge difference in usability.

Thankfully C++ is powerful enough that user types have the same rights as built-in ones.

Post reply on HN