Skip to content

Frequently Asked Questions

Victor Queiroz edited this page Mar 16, 2019 · 2 revisions

What is MFF?

MFF stands for Message Formatting Framework. It includes a type-language currently called btc and it is developed to help users (as myself) to format general-purpose messages easily providing as many tools as possible and ensuring a type safe and intuitive code to be maintained by a team.

What is a container and a container type?

Container is an entity in MFF that contains any kind of data. The data is separated by name and type independently using what we call of container parameters. When you define a container you have the ability to define what parameters it contains. Each defined parameters must contain a type and a name, this is mandatory for all parameters.

What types a container param can accept?

A container can accept generic types (uint32, int32, uint64, int64, etc), a direct reference to a container / container type or a template.

What templates are available in the language?

We currently have no core or standard to define default templates that are available for the language. But we do have some default templates like Vector<T> (which is a list of any type) and Optional<T> (which makes any type optional).

What is a schema file?

Schema file is the file where you define containers that will help you format your code.

Why should I want to generate code?

It's not the recommended way. But the advantages of using it is that you're going to have type safe TypeScript classes that will not depend on any schema file to work with your data and it'll also include a copy method that will have an immutable behavior, very similar to Kotlin copy method available in data classes.

How does everything work together, the language, the language-dependent implementation (currently in JavaScript) and everything else? What if I want to use it in a different language?

(will be available soon)

What are type classes?

Type classes is the classes that are generated to represent the container type instead of a specific container. Therefore, all the generated container classes of the respective type will inherit it.

What happens when I execute encode/decode methods of a generated TypeScript class?

When you execute encode method it'll transform the data currently available on the current class instance into binary data. On the other hand, the decode method available in type classes (and in container generated classes) is going to read the provided binary data and transform it into the necessary class instance. If something fails during that process, an error will be thrown.