Future

From NDjango
Jump to: navigation, search

The purpose of this release was a feature-complete implementation of the Django templating language. Aside from a few filters, we're there. Our focus in the coming iterations will be stability and performance. We will be turning our attention to

  • More precomputation. The current implementation mirrors the python version in the separation of duties between parsing and rendering. We will attempt to shift the load more towards the one-time parsing phase, and less towards the rendering phase.
  • Precompilation. We will investigate the merits of compiling django templates into F# or C# code.

... and much more.

What's coming: V0.9.1.0

Changes in V0.9.1.0 are concentrated mainly in 2 areas: simplification of the library interface and features necessary for both Bistro designer and NDjango designer integration.

Library Interface

Library interface is no longer based on static methods. Instead a new class TemplateManagerProvider is introduced. This class has a parameterless constructor which allows for easy integration with Dependency Injection frameworks (Microsoft MEF and the like) as well as methods WithTag(s), WithFilter(s) etc. giving a way to change the default configuration provided by the parameterless constructor.

Keep in mind that these methods do not modify the provider instance they are called on, but rather (F# style) create a new clean instance of the provider. This provider will have configuration of the original modified by applying changes introduced by the method call. The new provider does not inherit any templates from the old one. When rendering requests are processed through the new provider, parsing of every requested template will be repeated in the context of the new configuration. The original provider as well as any of the template managers it spawned remain unaffected and will keep working in the context of the old configuration.

Template rendering is still performed by template managers. The GetTemplateManager() method of the provider is the only way to acquire a template manager. Every template manager keeps a dictionary of the templates it ever rendered and uses this dictionary to render old templates without any locking. The price for this is that template managers are not thread safe. It is recommended that every thread involved in the template rendering acquire its own template manager and use it every time it needs to render a template.

When a template manager encounters a template it never rendered before, it asks the provider to parse the necessary template. When requested by a template manager the provider parses the requested template and returns it to the manager. It also stores a reference to the template in its own template dictionary so that if another manager requests the same template it does not have to repeat parsing. Apart from template managers, template manager providers are thread safe.

All these changes should only concern you if you use or plan to use the library level integration. Those of you who are using the existing MVC.NET integration or Bistro integration should not see any changes - the appropriate integration projects will be updated and the interface with MVC.NET and Bistro will remain unchanged.

This version will also include base classes simplifying writing custom ndjango tags in C#.

Designer Interfaces

NDjango template editor being built for Visual Studio 2010 will support syntax coloring, error reporting and intellisense code completion features. In order to support this the NDjango parser will include additional information necessary. If you are curious and want to have a look at the code - you can download the code from the NDjango subversion: http://ndjango.googlecode.com/svn/NDjango/branches/VS2010Designer. This is current development branch and the code in there is far from being complete, so do not expect it to work. Also keep in mind that the project there is for Visual Studio 2010 Beta 1. You will also need to download the Visual Studio SDK Beta 1 and FSharp Power Pack.

Bistro designer being built will provide diagnostics on template variables with no values assigned by Bistro controllers (see Bistro web site for more info on bistro controllers). V0.9.1.0 will provide information on the variables used in the template.

These changes will have no effect on the users of the NDjango.