3 ms·
What is an example of: 1. files that you had to delete? 2. code generation in a function call? 3. better abstraction?
by tjchear 6y ago
What is an example of:
1. files that you had to delete?
2. code generation in a function call?
3. better abstraction?
- gitgud 6y agoWell the [1] "@angular/cli" package is one example of code generation I don't like. For example you can create a new page with: ng generate route 'about-page' This creates a folder called "about-page" with a blank component. Then it modify's the app.routing module. Then it adds the component declaration to the app.module. The reason it's terrible is that it makes various assumptions about the naming of your files and project structure, which inevitably break things if they're don't match. A good example of a better abstraction (a.k.a function call) is the [2] "nuxt" package. In this framework you don't need to generate a route, you just add a file to the '/pages' directory and the framework maps it to a route for you. It's a pleasant and simpler experience. [1] https://cli.angular.io/ https://cli.angular.io/ [2] https://nuxtjs.org/ https://nuxtjs.org/
- tjchear 6y agoAh I see what you mean. I was confused when you said encapsulating code generation in function calls, but what you're saying is better abstraction that saves you from writing boilerplate code and also does not force you to do things a certain way beyond what is necessary. I've had the pleasure of using next.js myself and it's the sort of thing that lowers my cognitive load when working on a project.