- Read Tutorial
- Watch Guide Video
In this post, we are going to be talking about the difference between scaffolds, generators and manual generation.
Scaffolding is an auto-generator that creates your models, views and controllers in a single operation. It is easy and straightforward to use, and can compile all your code within minutes. The flip side is it can generate a lot of unnecessary code, and this is why some developers prefer to go with generators. For example, let's assume you only want to create a database, and don't want to update or delete it. When you use scaffolds, it will generate code to create, update and delete, though you only want to do one operation. This results in a lot of unwanted code for you.
A middle ground between scaffolds and manual generation is to use something called generators. They allow you to efficiently perform tasks such as creating database tables along with associated model files and helps you to build custom controllers with all the methods built into it. The biggest advantage is that it lets you have explicit control over everything. For example, if you only want a few methods to be built, then the generator allows you to do just that, and you won't have any wasted code.
If both those options don't work for you, then you can build code from scratch, though it's not recommended in all cases.