What is Umbraco's ModelsBuilder and why should you care?
First off, what is ModelsBuilder?
ModelsBuilder is a tool that is built into the Umbraco platform since version 7.4. What it does is allow the development team to use the Umbraco back office to define the necessary document types for a feature. Then the tool will generate the files necessary for the developer to begin interacting with the document types in the code. As changes are made to the document types in the Umbraco back office. The generated files are updated accordingly as well. When a user begins interacting with the site, the generated files from ModelsBuilder have all the information to pull the correct content out of the Umbraco content tree and display it to the user.
There are several benefits to using ModelsBuilder. As document types are created, the development team no longer has to go through a similar process to create the corresponding files in code. This is a tedious and error prone step, making sure the data types for each filed is correct. Then adding the appropriate meta data to the code to map the document type fields to the correct fields in the code. As existing document types are updated with new properties, or removing unnecessary properties. A similar process is followed when creating, however, it is easy to overlook removing a field that is no longer on the document type and it remain in the code. If the development team is using ModelsBuilder all of the generated code files will match exactly in seconds, rather than minutes to hours.
At Layer One, we believe that there are very few situations where ModelsBuilder does not help in decreasing the feedback loop to the customer. We choose to enable ModelsBuilder on every Umbraco project. Knowing that at some point in the projects implementation or maintenance, there will be a time when a new document type is created. Where the customer will want the power to modify the content on the page.
Enabling ModelsBuilder is quite trivial. For the default ModelsBuilder configuration, one would update the Umbraco application website configuration key Umbraco.ModelsBuilder.Enable from a value of false to true. While, the default configuration solves the issue with model generation. It may not be desirable for the development workflow. Expect a more in depth technical article on ModelsBuilder configuration options in the near future.
As you consider your existing Umbraco implementation or a new Umbraco implementation. Think about how ModelsBuilder could decrease the development life cycle providing value to you and your customers. All while simplifying the development process.