
Silverlight is used as a development platform, from Nessos Information Systems S.A. since the early beta versions of version 2.0, focusing on Line of Business (LOB) applications. Silverlight was strategically chosen for IT implementations of GIS, Urban Planning, Business Workflows and LoB applications by Nessos S.A. Throughout the development process, numerous supporting functionalities were developed, exploring the full potential of Silverlight development, either by providing new features in cases where the platform lacked support by default or by extending and customizing existing ones for the development of Nessos’ applications. This process led to the development of a complete framework that encompasses solutions to most issues that arise when developing end to end applications. It is essentially a collection of design patterns, good practices and mini-frameworks that reduce development times by trivializing or even eliminating problems like asynchronous programming with Silverlight Web Service clients, integration of Data Transfer Objects with Object Relational Mapper frameworks, asynchronous loading of application parts, configuration, Dependency Injection, as well as UI, presentation and business logic separation and others.
Asynchronous Workflows: Asynchronous Programming with Web Services in Silverlight
In Silverlight, Web Services methods must be invoked only under an asynchronous execution model. Although this limitation makes sense for applications running inside the browser, it greatly reduces productivity. Asynchronous programming relies on passing callbacks to web service method invocations, which will execute when the method returns with a result. This adds tremendous complexity to even the simplest scenarios when web service calls need to be executed one after another, like in a workflow. Each call would need to be coded inside the callback (continuation) of the previous call in the workflow, meaning that the simple imperative - stack based- semantics do not apply any more.
To solve this serious bottleneck in productivity and scalability, we have developed extensions to the Windows Communication Foundation implementation allowing the developer to write workflows of web service calls, simple or complex, in a sequential imperative style as if writing synchronous code through the use of a simple API, and the framework seamlessly executes workflows asynchronously. The API implements full sequential -stack based- semantics including exception handling and SOAP faults.
OR Mapping Integration.
Integration of OR Mapping Frameworks with a Silverlight client application through web services, is a major issue addressed only partially in Silverlight 3. As part of our Nessos.Silverlight framework we have developed a complete end-to-end solution that integrates Business Objects from our own ORM (called Nessos.Framework, or other OR Mappers) with Data Transfer Objects in the Silverlight Applications and Business Object web services. Each Business Object exposes a specialized web service providing the usual methods to retrieve, update and delete business objects, as well as inheritance support for more specialized business methods. Each of these web services is integrated in a security model that authenticates client requests per web service and/or web method, allowing the incorporation of fine grained security privileges configuration.
Separation of Concerns
Separation of concerns between Business Logic, Presentation and UI logic poses a great challenge in software engineering. XAML introduces new challenges and possibilities in tackling this issue. There are several design patterns that can be applied, however, the one delivering the best results is the Presentation Model (or MVVM in WPF / Silverlight terms) for which our framework provides built-in support. The framework promotes the use of the Presentation Model pattern throughout the development lifecycle and provides support with a variety of tools and extensions including custom controls, view management, UI messaging (EventBus), commanding, behaviors and converters. The pattern is well documented and some of its benefits include testability, better designer-developer workflow, easier state management, UI composition and more.
Modularity
Silverlight applications need to be downloaded in their entirety to the client host, before starting to execute, because there is no embedded support for execution, while streaming application components. This issue is solved by splitting an application in parts,(modules), that are downloaded and loaded in the main Silverlight application on the fly, while the application is running. This decreases initial waiting time for the application to start but most importantly improves scalability and reusability. Modules can be added to or removed from the application dynamically, without any need for recompilation. Different modules can be loaded for different user profiles with varying privileges improving security, e.g. forms handling security critical data need not be downloaded to a client of a low security clearance logged in security user. Moreover, frequently used forms and logic can be reused in multiple applications through the use of these modules, like login forms.
Configuration
All parts of our framework are configurable. We rely heavily on Dependency Injection and Inversion of Control design patterns. The framework provides interfaces for all of its services; existing implementations can be extended and even replaced with custom ones. The Dependency Injection framework we use is configurable both statically and dynamically, through explicit code, special XAML extensions and XML files. Configurations can even be modified directly in the .xap file at the deployment site.
L10n (localization)
A major issue in Silverlight development is the localization of applications. Resource files cannot be used in the simple manner of the server side technology ASP.NET and for each language, or localization configuration, a different application needs to be loaded. However, this is unintuitive, since it is almost impossible to combine languages and change the active language at runtime, e.g. by selecting between English and Chinese, with a simple toggle button control. The situation becomes even more complex when integrating localized business logic where the active language on the client side needs to match the active language on the server side.
Nessos.Silverlight provides built in excellent localization support, allowing language change in application runtime and web service integration all the way to the OR Mapper. Nessos.Framework provides specialized localization types which are propagated through our Windows Communication Foundation extensions to the client side. Localization in Silverlight has never been this simple.