Reputation: 12849
First broader view : I got assignment for school project that states "Design and implement tool for rapid development of IS by code generation of core of business and data layer. (paraphrased). Its specific for .NET and C#, but anything is fine in this case.
I dont have that extensive knowledge of code generation or development of information systems. I was looking around some code generation framewroks and tools. More specificaly T4 and CodeSmith Generator. One thing that hit my eye is .netTiers set of templates, that have some interesting ones, that can be used in software development. But I dont know how much usefull in actual development they can be.
Well my question : Is there a way to develop an information system based mostly on code-generation? Or some way to make bigger use of code generation tools and templates in general? If I have this, I can work on more specific things.
I also tried to look at some questions here, that concert code-generation, but most of them are about if it is good or bad, or general experience with them. What I want is specific experience with specific tools and templates and how much profit in development they have.
Thanks a lot for answers.
Upvotes: -1
Views: 507
Reputation: 10579
For ASP.NET, you can use ASP.NET Dynamic Data Scaffolding.
Scaffolding refers to the Dynamic Data elements that automatically generate Web pages for each table in a database. These auto-generated Web pages provide create, read, update and delete (CRUD) operations for each table. Scaffolding consists of page templates, entity page templates, field page templates, and filter templates. These templates enable you to quickly build a functional data-driven Web site.
For desktop applications, you can use Visual Studio LightSwitch
Most business applications are forms-over-data applications, that is, a user interface for viewing, entering and editing data. With most development tools, much your time is spent doing the same task repeatedly. You write code to interact with a database, you write code for the user interface, and you write code for business logic. By using LightSwitch , much of the work is already done for you. In fact, it is possible to create a LightSwitch application without writing a single line of code. For most applications, the only code you have to write is the code that only you can write: the business logic.
Upvotes: 1
Reputation: 15232
Yes it is.
I think that one of the Biggest things you could look at is Naked Objects.
Java: Naked Objects.org
.NET: Naked Objects MVC
These two basically generate an entire program just from the domain model. Very interesting. Scott Hanselman did a Hanselminutes on it here: Hanselminutes w/ Richard Pawson. Also has some links to some very interesting things on it.
If you watch Hanselmans talk from PDC PDC he does a lot of stuff using code generation.
My company Generates the entire DAL and BO layer (without out custom functions) from a data model, using the CSLA .NET templates and CodeSmith.
So yes you can do quite a bit using generation and I haven't even really touched the surface of what you could really do.
Upvotes: 3
Reputation: 3642
Code generation has its place, and its cost.
The C Preprocessor is a form of code generation. Most large C projects eventually develop into their own dialect of C, based on preproccessor macros.
And macros in assembly language are incredibly useful.
It's perfectly common to have parts of a project be generated, perhaps a Perl script creating a fast Sin/Cos lookup table expressed as an initialized C array, for an embedded system. Or some measured performance data file gets "built in" to the application to help estimate some cost or another.
In Java, it's common to use JAXB and such to generate classes based on an XML schema. (I suspect this is the closest to your question's intent, @Euphoric...)
Also various mechanisms to save the trouble of implementing a zillion getters and setters. (Poor, poor, Java.)
The cost is complexity. You have to manage the difference between "source code" and "generated code". If you see someone checking "generated code" into the "source code control system"... think hard if that's really the right thing!
Hopefully your Make or build system knows how to build the appropriate generated files & use them.
And certainly, some server systems even write and compile code on-the-fly, as they run. Me: I am scared of that! But I've never had to use it.
Upvotes: 0