Recently we made the decision to clone our Winforms VideoRent real world application and create a new XAF application – the XVideoRental. Wearing my LEGO designer hat I will go through all migration steps as if I were in your shoes.
XVideoRental uses only a small part of XAF tooling –>Native modules + Code Central examples + open sourced project and community resources. All the time invested was for gathering ready to use implementations and putting them in a reusable project agnostic library. In addition since all these ready to use implementations exist already in our community project (eXpand) we created a second open source version of XVideoRental where this project agnostic library does not exist so we consumed even less resources for building it!
As you can read in the overview post the XVideoRental contains almost zero designed time code and everything is described declaratively in XAF’s Application Model xafml file, allowing full customization after distribution.
Real world applications are really demanding. We spend huge times for first release and in most cases is very poor compared to the next ones. The reason is simple, we do not have enough time to prepare a domain-specific language (DSL) that will bridge business requirements with our existing technical tooling/knowledge. Therefore we try to re-invent the wheel in many areas whereas XAF exists as the most comprehensive tooling available. Using application model and the Security System, XAF fully describes and configures the behavior of platform agnostic applications. Both Application Model and Security System are the technology abstraction or in other words the DSL language we need to minimize the time to market cost of a real world application.
We recommend:
1. Watch the BUILDING A PROJECT MANAGER APPPLICATION IN 5 MIN video where we used the same LEGO designer approach as in XVideoRental in a simpler application as our MainDemo.
2. Go for a quick overview of XVideoRental by reading XVideoRental real world application (RWA) – The overview.
3. Go through the next table where from these simple statistics it should be clear the tremendous gain we get when developing with the XAF way.
Number of projects | Classes | Lines of code | |
Legacy VideoRent Location: | Four non reusable projects | 256 | 27965 |
XAF XVideoRental | • 1 project agnostic library • 1 non reusable module • 1 front end application almost unmodified as created from VS templates | - 77 5 | - 806 126 |
Open Sourced XVideoRental | • References open sourced libs (project agnostic lib not exist) • 1 non reusable module • 1 front end application almost unmodified as created from VS templates | - 36 5 | - 807 126 |
In short the legacy app is using 256 classes. The XVideoRental much less 77 and 90% or them are simply concrete implementations from the referenced project agnostic library. However in the 3rd row where this project agnostic library is replaced from a reference to our open source project that number of classes goes further down to only 36!
Legacy app location: %Public%\Documents\DXperience 12.2 Demos\Common\DevExpress.VideoRent.Win\CS\
XAF app location: %Public%\Documents\DXperience 12.2 Demos\eXpressApp Framework\XVideoRental\CS\
Open source XAF app location: http://www.expandframework.com/downloads/download.html–>Demos\XVideoRental\
4. Finally go through the list bellow where we compare the legacy and XAF application side by side.
Legacy VideoRent | XAF XVideoRental |
Data Access | |
• Legacy app uses ORM technology and our XPO to describe the video rent business. However special skills needed and extra efforts to create a clear separation from other layers, so many helper classes exists even for very common tasks such as database connectivity. | • XAF has built-in support for both XPO and MS Entity Framework. We can simply utilize the legacy domain model by simply copy- paste the classes. Helper classes are of no use because XAF can handle all common tasks transparently for us! |
• A real world application requires an importing mechanism for initial data. The legacy app imports data from xml files with structure that fits exactly to the structure of the business objects. Therefore even for a small change in the BO design we need to modify and retest this mechanism. | • XVideoRental plugs-in an abstract domain agnostic importing engine from Fast prototyping requires an initial data import mechanism, allowing us to modify the structure of BO in the minimum time possible. In addition how to Supply Initial Data is well documented sparing our time for making architectural decisions. |
• In a real world application sequential number integration is essential. However special design and knowledge is needed to be able to build something reliable. | • XVideoRental operates under a business application framework therefore a rich click and run SDK provides solutions to such common problems E2829. So the developer only needs to integrate and not to think about the technical difficulties or guess the showstoppers. |
Architecture | |
Legacy app has a design time modularization based on Forms/UserControls/(Bussiness Concept). However it is not possible to extended it without adding new Forms and recompiling the whole application inside VS. In addition because of the lack in documentation determining the best place to write code for a specific behavior can still cause big headaches. | XVideoRental demo is using XAF’s well-documented and simple to use MVC architecture. Also, while the discussed application is a simple fat client app, demanding users looking for something more advanced may also find a ready to use client-server solutions in XAF. |
Data Validation | |
A real world application without strong validation support is unstable and has huge support times. | Creating validation rules does not require you to be a developer, even end-users can create them because it is quite easy and intuitive, not more difficult than creating a filtering rule in your Outlook. We only need to install the build-inValidation module! |
Data Representation | |
The legacy application a large number of components. Therefore the developer requires A huge amount of mundane, repetitive work was invested to: | XAF has native support for a large number of DX components. Automatic UI generation (CRUD detail and list forms, navigation and menu systems - all based on data models). This is a huge time saver because almost every typical business application contains a good percentage of list and detail forms, navigation and menu systems - all linked together without any effort from your side. |
• Create a large number of data entry forms, drag & drop numerous controls on it, arrange their positions and configure data bindings | • We plugged-in a mechanism that allows to control any component at runtime from Dressing up our classes – Date with a model tonight!. |
Application Configuration | |
Although most of the components can persist their state there is no application level integration by default. In addition their serialization is not designed to be human friendly and its hard to edit and support. The legacy developer had to create an integration mechanism deep in application’s infrastructure. This costly. wrap-up was as basic as possible and target only a few major forms producing a non consistent feeling. | XVideoRental is a XAF application which by design is described declaratively in XAF’s Application Model. Using Model Editor at runtime an end user can modify any part of the app. |
Application Security | |
The legacy developer tried to create a basic security implementation. However he soon realized that the efforts needed for something useful and reliable will probably exist the efforts for building the whole application. So, unfortunately due to app budget there is no investment in implementing a security system. | Our time frame here was really loosed since we already have a mature plug n’ play Security module. This flexibility allows us to plugin more goodies such as User Friendly permissions and metadata based permission policies |
Reporting | |
The major goal of business applications is to be able to create and print reports. | XVideoRental uses the built-inReports Module which natively integrates our award winning XtraReports suite and provides a runtime designer. |
Data Printing and Export | |
The legacy developer had to write special code for each control on your forms that he wished to print or export. Although this functionality is very useful in real world again the time frame wouldn’t allow such an investment. | XVideoRental can export data from the grid, pivot, chart, tree view, layout and others to a wide number of formats (PDF, RTF, TXT, CSV, HTML, MNT, XLS, XJSX, PNG, GIF, JPG, BMP, TIFF, WMF, EMF) without spending not even 1 minute to install or configure the system! |
Data Analysis | |
Legacy app has a whole structure to support only a few data analysis views for the 4 major BO which are Customer, Movie, Receipt and Rent. Huge amount of code is located in dedicated forms for each analysis views making the solution not able to survive in real world. The reason of course is that for each new customer request the developer has to change the code inside VS recompile and redistribute the app. A common example is a calculated value where it needs a UI to define these members, special algorithms to create them | XVideoRental uses the build-inPivot Chart Module which as usual shifts development to the runtime allowing business users to modify the analysis display at any time. Uses the extended Pivot from How to rule the Pivot. Empowering the app with the dashboard suite as in Dashboards in the real world – A Scotland strike! was as simple as drag & drop the module from VS toolbox!. Essential for data analysis runtime calculated members as in Domain Components+ Calculated properties + Application Model was in the menu as well. |
Localization | |
There are technics for localizing .NET application via satellite assemblies however they do not localize application specific data and they are very time consuming, so the legacy app does not support any kind of localization | XAF supports all standard localization approaches and also addresses the problems that occur with them. With XAF, it is always possible to localizeany part of your application at runtime (e.g., correct certain values from satellite assemblies). A convenient wizard provides the capability to use online translation services from MS, Google, etc. So, it is possible to leave the localization job to non-programmers who can easily import/export data without leaving the application. |
Customizing Controls Appearance | |
Even for the simplest operation like making bold a grid column or hiding a control from a view developer time is needed as long as recompilation and redistribution of the application | XVideoRental addresses this declaratively using the Conditional appearance module and the technic described in Dressing up our classes – Date with a model tonight! where any component can be serialized and controlled declaratively from XAF’s application model using the runtime Model editor. |
Implementing Custom Business Requirements | |
Lets talk a concrete example here. The legacy app uses tooltips to create a more expressive UI. However even if the developer wrote a decoupled class at the end he has to attach it to various controls and forms. This makes the whole design not flexible since changes require developer presence. | XVideoRental can use the same decoupled class from the legacy application. However it simply attaches the behavior to application model instead of attaching it to controls and forms. This solution is project agnostic and allows later changesfrom a nonprogrammer at runtime! This process is discussed in details in Tooltips to the max - expressive UI. |
Getting Help and Support | |
Application and developer are simply married. If for any reason they divorced then everything becomes very unstable and tricky. It is really hard to find another developer to continue support a legacy app. Even if we manage to do so the cost will be extremely high since there are no docs, support etc. | XVideoRental uses bricks/samples from XAF’s code central and community project. Thus by design there is a large number of developers that can support its code base. Not to forget the unmatched documentation and support we can get from the XAF team. |
Conclusion
Even thought XAF does not contain solutions to each and every business problem in the world, the framework is very strong in providing its own extensibility ( "preventing the lock-in effect"). It is fast and easy to plugin solutions to common business problems, at the end XAF is a Domain Specific Language that that can bridge business requirements with our existing technical tooling/knowledge!
Until next time,
Happy XAF’ing!