A Women Business Enterprise (WBE) and Minority Business Enterprise
Founded in 2001 with continued growth
Headquartered in Harrisburg, PA
Approved in ITQ
Consistent track record of success in delivering mission critical projects in emerging technologies
Specialized in implementing CMM process and execution at Level 3
Specialized in implementing ITIL and BS799 process
Experienced in engaging quality consulting resource
Services We Provide
Enterprise Migration Services
Application Architecture & Engineering Services
Business Intelligence Reporting
IV&V and Team Mentoring Services
Professional Staffing Services
How to Increase Efficiency and Minimize Errors by code generation on .NET Projects
What is code generation
Benefit on the project
Demo of CODESMITH
To create web services (ASMX)
To create web services (WCF – both REST AND NON-REST style)
How to create/edit
Different tools and Open source tools
CODESMITH – NON CODE generation use
Questions / Answers
Why we need?
Code Generation – CG
Are we Lazy?
Are we SMART?
Why we need code generation?
Are we using it without knowing it?
Let us talk about some examples we know
The two main constants in software engineering are:
Programmers’ time is valuable.
Programmers don’t like repetitive, boring tasks
Code generation takes over the task of writing repetitive infrastructure code, leaving more time for engineers to concentrate on the interesting programming challenges that they do enjoy.
Code generation doesn’t just eliminate grunt work; it provides benefits to the software engineering lifecycle
What is CG any way?
Code generation is any way you create code other than writing it line by line in an editor.
Code generation is about writing programs that write programs
when one can work smarter rather than harder
< template > + < metadata > = < generated code >
Focusing on the big picture, one can build better solutions.
A single point of knowledge
More design time
Design decisions that stand out
APPLICATION CODE GENERATION REVOLUTIONIZES the way one writes program/code
Build a higher quality application faster
Ready for changes during development and throughout the application life cycle.
Provides this level of software agility at the same time it allows you to create massive amounts of code.
Top 10 Code Generation Rules
Give the proper respect to hand-coding
Handwrite the code first
Control the source code
Make a considered decision about the implementation language
Integrate the generator into the development process
Make it friendly
Keep in mind that generation is a cultural issue
Maintain the generator
Principles for CG
5 Principles - non-negotiable for code generation:
Principle #1 :
You have control of the templates that generate your code and can change or replace them as required.
Principle #2 :
You collect metadata as a separate, distinct step with usable output that can independently evolve.
Principle #3 : You, or someone unfamiliar with project, can regenerate
your code precisely as a one-click process—now or at any point in the future.
Principle #4 : You embrace handcrafted code by isolating and protecting it.
Code generation is a supporting player to human programming and doesn’t overwrite files unless they were generated and haven’t been edited.
Principle #5 :
The code-generated application is a high-quality application. It allows more effective testing, has equal or better performance, and is more easily maintained than a similar fully handcrafted application.
Steps in CG
5 steps are as follows:
Build and run templates.
Tie it together with integration and testing.
Several types of handcrafted code:
Base class functionality
Code with insufficient, inconsistent, or interspersed patterns
T4 (Text Template Transformation Toolkit) - the code generation engine used as part of Domain Specific Languages and Software Factories projects. With the T4 toolkit now built directly into Visual Studio 2008, you can easily add code generation to your arsenal
Microsoft Entity Framework - .NET 3.5 SP1
Software Factories – SCSF, WSSF etc.
Class Library project and a class that implements the IDTWizard interface in VS2008
What is CodeSmith Anyway….!
CodeSmith is a software development tool to help you get your job done faster. Technically speaking it is a template driven source code generator that automates the creation of common application source code for any language (C#, Java, VB, PHP, ASP.NET, SQL, etc.).
CodeSmith's syntax is almost identical to ASP.NET. So if you are familiar with ASP.NET then you should be able to quickly learn the template syntax. You can use the C#, VB.NET or JScript.NET languages in your templates and your templates can output any ASCII-based language.
What is CodeSmith Anyway….!
Note from Microsoft Contact:
“ I have several clients that have used CodeSmith in the past with great success. We even have some internal projects here at Microsoft that have utilized it for non-shipping code. Feel free to mention that even Microsoft has used it & you received a note from a contact too on this topic on being used in industry.“