.NET Software Development Tutorials and Videos: C#, ASP, SQL Server, Linq, Visual Basic, Silverlight, Azure
Dynamic code

Dynamic code

This in depth session will penetrate the advantage of using dynamically created code in your applications. Yesterday we coded the creation of object instances our selves in each location that we needed them with strong references between our code modules. Maintenance in this code base was a nightmare and modular and distributed development was difficult if not impossible. Today the use of object factories is very widespread in our business. By implementing the Factory Pattern we delegate creation of instances to Object Factories. Modularity is enabled and Dependency Injection and other modern techniques empower us and set us free. The lingering problem is that a general solution of any algorithm may cause repetitive code paths to execute unnecessarily and excessive memory to be consumed. An application that creates optimized code dynamically using System.Reflection.Emit is possible. One such solution is the Unity project from Patterns & Practices which will help to exemplify the greatness of this approach. In fact dynamic code is the way code will be created for us tomorrow. To paraphrase C3PO: “Code creating other code! How perverse!”