I have this small feeling that we have more control on our application when we manually code it instead of using a code generator. Is it true?
If so then how often should we use a code generator and to what extent?
If not so then can someone guide me to a good place where I can learn about writing code generators?!
And what one would do when decide to open designer of such a form? I would guess that they wouold come to you to punch you
I very often edit them but not remove them, so i guess I am not withbout sin. :p
They're not really generated code, they're code which is manually edited using a graphical IDE. That is, every line in a .designer.cs file is there because you set a property or clicked something in the graphical editor.
What about the performance issues?
Will the code generator not weigh down the application?
Oh and is there any difference a code generator and a template (for an application)? Also is there a relation between the two?
All occasions I've seen and used code generation tools, that's been a build-time issue, not run-time. You run the tool to create code, which is included in the compiling and build of the software. As such, there's no performance penalty when running, although it can complicat the build process.
For instance, Microsoft has a tool that takes an XML file and creates an XML schema from it. This schema can then be run through the same tool which can generate C# classes to represent it. This means you don't have to hand code the classes needed to serialise the XML, but have used a code generation tool. Typically, you'd only do this when there's been a change in the XML schema, not every time you build the system.
I'm not entirely clear what you mean by template here? Do you mean the different application and library types you can pick from when creating a new project in Visual C#? Those templates are effectivel recipes used by the code generation tool to create the project and its initial files.
Last Visit: 31-Dec-99 18:00 Last Update: 21-Dec-13 10:43