Property Framework allows you to make your entire presentation logic declarative by composing properties, their loading logic, their interaction with the user and with one another.

A typical description would look as follows:

var property = Reloadable<int>.On()
              .Delayed(TimeSpan.FromMilliseconds(200))
              .Conditional(() => canReact)
              .ValidationInput(o => o < 0 ? 
                  new[] { "Negative values not supported." } 
                : null)
              .Create();

The above property will reload on input (like property.Input = 1;) if canReact is true, when no new input comes after the last one for 200 ms.

Sample applications illustrating how properties work together to solve typical tasks of business application development are shipped with the source code.

The respective projects are included with each platform-specific solution.



On each platform ranging from .Net 4.0 to Windows Phone 8 the abovementioned sample projects solve the following tasks:
  • Showcase.LoadAsYouScroll - Automatically load items to a list when the user scrolls it to the end.
  • Showcase.LoadByWire - Gather data from textboxes, validate input, load data from db + send to textboxes.
  • Showcase.ProgressCounter - Track progress of some activity and display it with a progress bar.
On different platforms the problems are solved a bit differently. They use MVVM or Windows Forms, Reactive Extensions or event subscriptions showcasing different approaches, serving as a source of inspiration or a bank of readymade solutions. You might want to check them out.

There is a number of ways in which Property Framework enhances the experience of creating presentation logic. Here are some of them.

Read It Aloud.

The XML documentation of Property Framework 3.0 has been specifically designed to help you understand the algorithms you put into the properties you describe. Moving a mouse pointer from one word to another and reading the comments that pop up is no different from reciting the algorithm in a real language.



You Don't Use It, You Don't Have It.

The features you didn't mention will not just stay switched off; they won't be there. You don't need complex features of Reactive Extensions plugged in, don't reference Property.Reactive assembly, and forget about them.

Property Framework provides a high level of scalability by keeping universally applicable words in Reactive.Core assembly and all the words of limited applicability grouped by the area of concern in the respective assemblies.
  • Property.Core - Contains the minimal usable subset of Property Framework features,
  • Property.Callbacks - Contains BackgroundWorker-related Property Framework features,
  • Property.Chains - Contains features that enable declarative subscriptions to property events,
  • Property.Reactive - Contains features that allow using Rx features with properties,
  • Property.Windows - Contains features that allow using interfaces introduced in late versions of .Net and Silverlight,
  • Property.Windows.Legacy - Contains features that allow using interfaces introduced in obsolete versions of .Net and Silverlight.
Namespaces span across different assemblies and separate different worlds thus being another axis of scalability.
  • Property - Contains words that are invariant to the world of use,
  • Property.Windows - Contains variants of words applicable to the world of WPF/Silverlight,
  • Property.Windows.Forms - Contains variants of words applicable to the world of Windows Forms,
  • Property.Windows.Legacy - Contains variants of words applicable to the world of legacy interfaces.

Describe Once. Create When Needed.

Lazy instantiation is one of the concepts at the heart of Property Framework. Description is separated from creation, thus, enabling us to reuse property patterns again and again without ever specifying them twice.

var namePattern = Reloadable<string>.On()
              .Delayed(TimeSpan.FromMilliseconds(200))
              .ValidationInput(o => 
                   ValidationService.CheckName(o));
              
var firstName = namePattern.Create();
var middleName = namePattern.Create();
var lastName = namePattern.Create();
var nickName = namePattern.Create();

Remove the Borders.

Property Framework 3.0 supports BackgroungWorker-based asynchronicity and subscription-based chaining of properties on all platforms. Not only that means you can bring the power of declarative presentation logic development to the world of .Net 3.5; that means you can develop applications with any degree of portability you want.

var auth = Reloadable<bool>.On()
              .Worker()
              .Call(_ => 
               AuthService.Authorize(curUser))
              .Create(false);

var organizations = Reloadable<IEnumerable<Organization>>.On()
              .Worker()
              .Call(_ => 
               OrgService.GetOrganizations(curUser))
              .Create(Enumerable.Empty<Organization>());

var authToOrgs = auth.OnChanged(() => organizations);

Harness the Interfaces.

Everything you create with Property Framework is an instance of some interface. That means, everything you create with PF is mockable, which is valuable.

More than that, the hierarchy of interfaces used in Property Framework gives you control over the accessibility of properties you create.
  • IProperty<T> - Read-only access to the property's value, loading status and side-effects-free debug value.
  • ICallProperty<T> -The operation trigger method Go() is accessible.
  • IInputProperty<T> -The property's input is accessible for reading and writing.
  • IValidateProperty<T>/ICheckProperty -The validation features of the property are accessible.

See the detailed picture below.



Testable and Tested.

The components included with Property Framework 3.0 are 100% covered by unit tests. The unit tests serve as an additional form of the library's specification as well as a good proof of the library's compliance with the specified requirements.

If test coverage matters, then testability matters too. This is why Property Framework allows ignoring test-unfriendly words in property descriptions in test scenarios. For instance, the word Worker is considered test-unfriendly because it specifies asynchronous operation and we want all code in our unit tests to be strictly synchronous. All the words that are considered test-unfriendly are equipped with an on/off switch that can be used for creating testable code without preprocessor directives.

var organizations = Reloadable<IEnumerable<Organization>>.On()
              .Worker(testMode)
              .Call(_ => 
               OrgService.GetOrganizations(curUser))
              .Create(Enumerable.Empty<Organization>());

Leave It To the Reloader.

Every property created with Property Framework has a broker called reloader inside of it, which does the loading and setting of the pproperty's state for us. Though we don't see the reloader work we certainly experience it. By not setting the property's state from outside the property and letting just one object deal with it, we eliminate possible race conditions, thus having one problem less to worry about.

And Now on Nuget.

Installing Property Framework has never been easier.

Just open Package Manager Console ...



... enter 'Install-Package PropertyFramework' ...



... and you're done! The right version of Property Framework will be automatically downloaded and added to your project.

Explore the code; leave your feedback;
write me an e-mail; or reach me via Skype.

l'm always thrilled to hear from you.

Thanks for your interest in whatever you are interested in.


Last edited Oct 9, 2013 at 8:00 AM by Vitaly_Kamiansky, version 48