It appears that there is a new emphasis on declarative programming in ASP.NET with the release of v2.0. This approach has two serious benefits. The first is that it saves a great deal of time because you don't need to write as much code yourself to perform routine tasks. The second is that declarative programming, when implemented right, can be used by less experienced coders to perform complex tasks.
It's also worth noting that the forthcoming version of Windows, code-named "Longhorn," will make use of XAML, Extensible Application Markup Language. XAML is to Windows applications much as HTML is to Web applications. It's a declarative language that will enable Windows developers to declare controls on a form, such as a button, in much the same way that we declare controls on a Web form. A simple Windows form using XAML might contain the following: <?xml version="1.0" standalone="yes"?> <Window> <Button>Hello World</Button> </Window> For more information about XAML, check out http://www.xaml.net. |
For example, the RequiredFieldValidator control saves time because you don't need to write a block of code to do the work that it can do by itself. That code, while not complex by most people's standards, isn't something a beginner would need to understand in terms of checking the length of the input of a control and displaying an error message (not to mention wiring into the Page object's IsValid property).
Declarative controls aren't just something you'll find in the .NET Framework; you can build your own as well. The DataSourceControl abstract class acts as the base for other classes like SqlDataSource, which acts as a UI element on your page but does the work of binding data to a data control for you without having to create the typical connection and command objects. You can derive your own controls from DataSourceControl that grab specific data for binding to other controls.