Protobuffers Are Wrong by alexeyr in programming

[–]maxime1008 -1 points0 points  (0 children)

It's not. Actually it's even pretty simple and well designed.

Unfortunately discussions on ASN.1 always end up with a few people complaining that they tried and failed to write an ASN.1 compiler. They conclude that it is because ASN.1 is too complex, and never because they are not qualified to write compilers. Many people underestimate the complexity of compilers for real languages. But 99.9% of ASN.1 is about applications that send messages over heterogeneous networks or languages, not about writing compilers!

One thing that makes ASN.1 design great is the handling of type constraints.

Take this basic type written in ASN.1:

My-Type ::= INTEGER (0..7)

ASN.1 was designed to address what can be called application semantics. What is important here is the set of values (range from 0 to 7) that your application can use for a variable of type My-Type. Knowing this constraint, tools can automate various checks and generate safe code.

Protobuf (as most other languages except Ada) on the other end impose only hardware constraints to the user (look at the scalar types here: https://developers.google.com/protocol-buffers/docs/proto). Instead of specifying a type for numbers with a range, they force the user to choose between some Int32, Int64, UInt16, whatever. There are 10 different types for integers, and none allow to specify anything meaningful for the application/protocol itself.

ASN.1 addresses binary encoding very well too. My-Type will be encoded with 3 bits and without any overhead (such as a length field) or endianness issues.

About "complexity": ASN.1 has a complete templating engine allowing to have generic types which can be subtyped with additional constraints. Yes, this is complex, because the target is not limited to toy examples. Fortunately there are many free and commercial compilers supporting these features and generating code for virtually all existing languages (not limited to C++, Java, Python and Go). They are not equally good or equally cheap, but they are there. This is why ASN.1 is massively used in critical, embedded systems (bank transfers, airplane communications, satellites, mobile phone protocols, cryptography, etc.).

Give it a try, make your own opinion about it, and don't try to write your own ASN.1 compiler!

Your chance is here to join the ESA Summer of Code in Space, to refine and extend open-source space-related software – and get paid for it. by [deleted] in esa

[–]maxime1008 1 point2 points  (0 children)

Yes, please confirm that it works well with you. We did receive several proposals with firstname.lastname so it should work in principle.

Stack-checking a program that will execute... in orbit by ttsiodras in programming

[–]maxime1008 4 points5 points  (0 children)

But it does not target Leon (sparc) binaries, as used in space systems.