Priority Manager–Part 1- Laying out the plan

Now that we have shown the EDMX with XPO/XAF and how use SpecFlow and BDD to run EasyTest scripts, let’s put it all together and show the evolution of a project using all the tools combined.

I have a simple project that I use to track my priorities throughout the day.  It uses some of Stephen Covey’s principles from The 7 Habits of Highly Effective People.  The idea is to write down all your priorities the night before and rank them.  This way when you get started tomorrow you will have your list of priorities.  Now it’s not that new things won’t appear tomorrow and reprioritize your list, but at least now you can track them.  My idea is to create a project that will allow you manage your list from your desktop, a web browser or your mobile device.  This way your list is never too far away.  I will layout the data model and the additional concepts as time progresses.

My goal is to show the power of all of these tools combined and I thought the best way would be to build a project in sequence.  I have had this idea for quite some time so let’s get it completed with the outline below.

Here is the outline of the series of post in the near future:

  • Part 2 – Modeling the Business Objects
  • Part 3 – Changing XAF Default Properties
  • Part 4 – Advanced Settings within Liekhus EDMX/XAF Tool
  • Part 5 – Custom Business Rules
  • Part 6 – Unit Testing Our Implementation
  • Part 7 – Behavior Driven Development (BDD) and SpecFlow Tests
  • Part 8 – Using the Windows Application
  • Part 9 – Using the Web Application
  • Part 10 – Exposing OData from our Project
  • Part 11 – Consuming OData with Excel PowerPivot
  • Part 12 – Consuming OData with iOS
  • Part 13 – Consuming OData with Android
  • Part 14 – What’s Next

I hope this helps outline what to expect.  I anticipate that I will have additional topics mixed in there but I plan on getting this outline completed within the next several weeks. 

Thanks

To ORM or Not to ORM. That is the question…

UPDATE:  Thanks for the feedback and comments.  I have adjusted my table below with your recommendations.  I had missed a point or two.

I wanted to do a series on creating an entire project using the EDMX XAF code generation and the SpecFlow BDD Easy Test tools discussed in my earlier posts, but I thought it would be appropriate to start with a simple comparison and reasoning on why I choose to use these tools.

Let’s start by defining the term ORM, or Object-Relational Mapping.  According to Wikipedia it is defined as the following:

Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language.

Why should you care?  Basically it allows you to map your business objects in code to their persistence layer behind them. And better yet, why would you want to do this?  Let me outline it in the following points:

  1. Development speed.  No more need to map repetitive tasks query results to object members.  Once the map is created the code is rendered for you.
  2. Persistence portability.  The ORM knows how to map SQL specific syntax for the persistence engine you choose.  It does not matter if it is SQL Server, Oracle and another database of your choosing.
  3. Standard/Boilerplate code is simplified.  The basic CRUD operations are consistent and case use database metadata for basic operations.

So how does this help?  Well, let’s compare some of the ORM tools that I have used and/or researched.  I have been interested in ORM for some time now.  My ORM of choice for a long time was NHibernate and I still believe it has a strong case in some business situations.  However, you have to take business considerations into account and the law of diminishing returns.  Because of these two factors, my recent activity and experience has been around DevExpress eXpress Persistence Objects (XPO). 

The primary reason for this is because they have the DevExpress eXpress Application Framework (XAF) that sits on top of XPO.  With this added value, the data model can be created (either database first of code first) and the Web and Windows client can be created from these maps.  While out of the box they provide some simple list and detail screens, you can verify easily extend and modify these to your liking.  DevExpress has done a tremendous job of providing enough framework while also staying out of the way when you need to extend it.  This sounds worse than it really is.  What I mean by this is that if you choose to follow DevExpress coding style and recommendations, the hooks and extension points provided allow you to do some pretty heavy lifting while also not worrying about the basics.

I have put together a list of the top features that I have used to compare the limited list of ORM’s that I have exposure with.  Again, the biggest selling point in my opinion is that XPO is just a solid as any of the other ORM’s but with the added layer of XAF they become unstoppable.  And then couple that with the EDMX modeling tools and code generation, it becomes a no brainer.

Designer Features Entity Framework NHibernate Fluent w/
Nhibernate
Telerik OpenAccess DevExpress XPO DevExpress XPO/XAF plus Liekhus Tools
Uses XML to map relationships - Yes - - -  
Visual class designer interface Yes - - - - Yes
Management integrated w/ Visual Studio Yes - - Yes - Yes
Supports schema first approach Yes - - Yes - Yes
Supports model first approach Yes - - Yes Yes Yes
Supports code first approach Yes Yes Yes Yes Yes Yes
Attribute driven coding style Yes - Yes - Yes Yes
             

 

I have a very small team and limited resources with a lot of responsibilities.  In order to keep up with our customers, we must rely on tools like these.  We use the EDMX tool so that we can create a visual representation of the applications with our customers.  Second, we rely on the code generation so that we can focus on the business problems at hand and not whether a field is mapped correctly.  This keeps us from requiring as many junior level developers on our team. 

I have also worked on multiple teams where they believed in writing their own “framework”.  In my experiences and opinion this is not the route to take unless you have a team dedicated to supporting just the framework.  Each time that I have worked on custom frameworks, the framework eventually becomes old, out dated and full of “performance” enhancements specific to one or two requirements.  With an ORM, there are a lot smarter people than me working on the bigger issue of persistence and performance.  Again, my recommendation would be to use an available framework and get to working on your business domain problems. 

If your coding is not making money for you, why are you working on it?  Do you really need to be writing query to object member code again and again?

Thanks

Setup and Use SpecFlow BDD with DevExpress XAF

Let’s get started with using the SpecFlow BDD syntax for writing tests with the DevExpress XAF EasyTest scripting syntax.  In order for this to work you will need to download and install the prerequisites listed below.  Once they are installed follow the steps outlined below and enjoy.

Prerequisites

Install the following items:

  1. DevExpress eXpress Application Framework (XAF) found here
  2. SpecFlow found here
  3. Liekhus BDD/XAF Testing library found here

Assumptions

I am going to assume at this point that you have created your XAF application and have your Module, Win.Module and Win ready for usage.  You should have also set any attributes and/or settings as you see fit.

Setup

So where to start. Create a new testing project within your solution. I typically call this with a similar naming convention as used by XAF, my project name .FunctionalTests (i.e. AlbumManager.FunctionalTests).

image

Add the following references to your project.  It should look like the reference list below.

  1. DevExpress.Data.v11.x
  2. DevExpress.Persistent.Base.v11.x
  3. DevExpress.Persistent.BaseImpl.v11.x
  4. DevExpress.Xpo.v11.2
  5. Liekhus.Testing.BDD.Core
  6. Liekhus.Testing.BDD.DevExpress
  7. TechTalk.SpecFlow
  8. TestExecutor.v11.x (found in %Program Files%\DevExpress 2011.x\eXpressApp Framework\Tools\EasyTest

image

Right click the TestExecutor reference and set the “Copy Local” setting to True.  This forces the TestExecutor executable to be available in the bin directory which is where the EasyTest script will be executed further down in the process.

image

Add an Application Configuration File (app.config) to your test application.  You will need to make a few modifications to have SpecFlow generate Microsoft style unit tests.  First add the section handler for SpecFlow and then set your choice of testing framework.  I prefer MS Tests for my projects.

image

Add the EasyTest configuration file to your project.  Add a new XML file and call it Config.xml.

image

Open the properties window for the Config.xml file and set the “Copy to Ouput Directory” to “Copy Always”.

image

You will setup the Config file according to the specifications of the EasyTest library my mapping to your executable and other settings.  You can find the details for the configuration of EasyTest here.  My file looks like this

image

Create a new folder in your test project called “StepDefinitions”.  Add a new SpecFlow Step Definition file item under the StepDefinitions folder.  I typically call this class StepDefinition.cs.

image

Have your step definition inherit from the Liekhus.Testing.BDD.DevExpress.StepDefinition class.  This will give you the default behaviors for your test in the next section.

image

OK.  Now that we have done this series of steps, we will work on simplifying this.  This is an early preview of this new project and is not fully ready for consumption.  If you would like to experiment with it, please feel free.  Our goals are to make this a installable project on it’s own with it’s own project templates and default settings.  This will be coming in later versions.  Currently this project is in Alpha release.

Let’s write our first test

Remove the basic test that is created for you. We will not use the default test but rather create our own SpecFlow “Feature” files. Add a new item to your project and select the SpecFlow Feature file under C#. Name your feature file as you do your class files after the test they are performing.

image

Writing a feature file uses the Cucumber syntax of Given… When… Then.  Think of it in these terms.  Givens are the pre-conditions for the test.  The Whens are the actual steps for the test being performed.  The Thens are the verification steps that confirm your test either passed or failed.  All of these steps are generated into a an EasyTest format and executed against your XAF project.  You can find more on the Cucumber syntax by using the Secret Ninja Cucumber Scrolls.  This document has several good styles of tests, plus you can get your fill of Chuck Norris vs Ninjas.  Pretty humorous document but full of great content.

My first test is going to test the entry of a new Album into the application and is outlined below.

image

The Feature section at the top is more for your documentation purposes.  Try to be descriptive of the test so that it makes sense to the next person behind you.  The Scenario outline is described in the Ninja Scrolls, but think of it as test template.  You can write one test outline and have multiple datasets (Scenarios) executed against that test.  Here are the steps of my test and their descriptions

Given I am starting a new test – tells our test to create a new EasyTest file
And (Given) the application is open – tells EasyTest to open our application defined in the Config.xml
When I am at the “Albums” screen – tells XAF to navigate to the Albums list view
And (When) I click the “New:Album” button – tells XAF to click the New Album button on the ribbon
And (When) I enter the following information – tells XAF to find the field on the screen and put the value in that field
And (When) I click the “Save and Close” button – tells XAF to click the “Save and Close” button on the detail window
Then I verify results as “user” – tells the testing framework to execute the EasyTest as your configured user

Once you compile and prepare your tests you should see the following in your Test View.  For each of your CreateNewAlbum lines in your scenarios, you will see a new test ready to execute.

image

From here you will use your testing framework of choice to execute the test.  This in turn will execute the EasyTest framework to call back into your XAF application and test your business application.

Again, please remember that this is an early preview and we are still working out the details.  Please let us know if you have any comments/questions/concerns.

Thanks and happy testing.

BDD XAF Project Released

I just published the BDD code for XAF.  You can find it at http://bddxaf.codeplex.com.  I am working on the write up of the steps to setup and use the BDD techniques described in my earlier post, but wanted to get the code out in your hands immediately.

Thanks

Behavior Driven Development (BDD) and DevExpress XAF

So in my previous posts I showed you how I used EDMX to quickly build my business objects within XPO and XAF.  But how do you test whether your business objects are actually doing what you want and verify that your business logic is correct?  Well I was reading my monthly MSDN magazine last last year and came across an article about using SpecFlow and WatiN to build BDD tests.  So why not use these same techniques to write SpecFlow style scripts and have them generate EasyTest scripts for use with XAF.  Let me outline and show a few things below.  I plan on releasing this code in a short while, I just wanted to preview what I was thinking.

Before we begin…

First, if you have not read the article in MSDN, here is the link to the article that I found my inspiration.  It covers the overview of BDD vs. TDD, how to write some of the SpecFlow syntax and how use the “Steps” logic to create your own tests.

image

Second, if you have not heard of EasyTest from DevExpress I strongly recommend you review it here.  It basically takes the power of XAF and the beauty of your application and allows you to create text based files to execute automated commands within your application.

Why would we do this?  Because as you will see below, the cucumber syntax is easier for business analysts to interpret and digest the business rules from.  You can find most of the information you will need on Cucumber syntax within The Secret Ninja Cucumber Scrolls located here.  The basics of the syntax are that Given X When Y Then Z.  For example, Given I am at the login screen When I enter my login credentials Then I expect to see the home screen.  Pretty easy syntax to follow.

Finally, we will need to download and install SpecFlow.  You can find it on their website here.  Once you have this installed then let’s write our first test.

Let’s get started…

So where to start.  Create a new testing project within your solution.  I typically call this with a similar naming convention as used by XAF, my project name .FunctionalTests (i.e.  AlbumManager.FunctionalTests). 

image

Remove the basic test that is created for you.  We will not use the default test but rather create our own SpecFlow “Feature” files.  Add a new item to your project and select the SpecFlow Feature file under C#.  Name your feature file as you do your class files after the test they are performing.

image

Now you can crack open your new feature file and write the actual test.  Make sure to have your Ninja Scrolls from above as it provides valuable resources on how to write your test syntax.  In this test below you can see how I defined the documentation in the Feature section.  This is strictly for our purposes of readability and do not effect the test.  The next section is the Scenario Outline which is considered a test template.  You can see the brackets <> around the fields that will be filled in for each test. 

So in the example below you can see that Given I am starting a new test and the application is open.  This means I want a new EasyTest file and the windows application generated by XAF is open.  Next When I am at the Albums screen tells XAF to navigate to the Albums list view.  And I click the New:Album button, tells XAF to click the new button on the list grid.  And I enter the following information tells XAF which fields to complete with the mapped values.  And I click the Save and Close button causes the record to be saved and the detail form to be closed.  Then I verify results tests the input data against what is visible in the grid to ensure that your record was created.

The Scenarios section gives each test a unique name and then fills in the values for each test.  This way you can use the same test to make multiple passes with different data.

image

Almost there.  Now we must save the feature file and the BDD tests will be written using standard unit test syntax.  This is all handled for you by SpecFlow so just save the file.  What you will see in your Test List Editor is a unit test for each of the above scenarios you just built.

image

You can now use standard unit testing frameworks to execute the test as you desire.  As you would expect then, these BDD SpecFlow tests can be automated into your build process to ensure that your business requirements are satisfied each and every time.

How does it work?

What we have done is to intercept the testing logic at runtime to interpret the SpecFlow syntax into EasyTest syntax.  This is the basic StepDefinitions that we are working on now.  We expect to put these on CodePlex within the next few days.  You can always override and make your own rules as you see fit for your project.  Follow the MSDN magazine above to start your own.  You can see part of our implementation below.

As you can gather from the MSDN article and the code sample below, we have created our own common rules to build the above syntax.

image

The code implementation for these rules basically saves your information from the feature file into an EasyTest file format.  It then executes the EasyTest file and parses the XML results of the test.  If the test succeeds the test is passed.  If the test fails, the EasyTest failure message is logged and the screen shot (as captured by EasyTest) is saved for your review.

Again we are working on getting this code ready for mass consumption, but at this time it is not ready.  We will post another message when it is ready with all details about usage and setup.

Thanks

IASA Kansas City to host discussion on Google Fiber Project in Kansas City

One of the groups that I am currently President of (IASA Kansas City) is hosting an event by Rachel Hack (Google Community Manager) about the Google Fiber Project in Kansas City.  The event will be hosted at Balance Point’s office off 92nd and Ward Parkway on the Missouri side of the state line.  If you are interested, please check out further details here and get registered. 

It is after work hours from 6 to 8 PM on the night of November 29, 2011.  It is free to attend and open to anyone who gets registered.  Come one, come all and bring your friends.

Thanks

Visual Studio Tools and Tricks

I decided it was time to share some of my favorite tools and tricks that I use to make my time in Visual Studio more productive.

Naming Standards

If you do not already know the name and website IDesign.net, then I suggest you explore them and get to know them well.  This is the architecture and design site started by Juval Lowy and now has such .NET architects as Michele Leroux Bustamante, Brian Noyes, Mark Michaelis, Dino Esposito, Miguel A. Castro.  I had the luxury of seeing some of their presentations last week at DevConnections, but I digress. 

The reason I bring them up is that if you do not have any DOCUMENTED (and yes I said documented) naming conventions and standards, then why create them yourself.  IDesign.net has a published list of naming conventions located here.  You can also import all of these naming standards as well as other Visual Studio settings from IDesign.net here as well.

This will get your environment up and running in a common and standard format.

Code Style Enforcer

Now that you have some published rules, how about helping to enforce those rules?  You can use several tools built on DXCore from DevExpress.  The first that I was looking at was StyleCop on CodePlex, but the issue was that it was last worked on back in version 9.3 and has not been maintained.  While it did some things, it needed a lot of work to get current. 

The second one that I looked at was Code Style Enforcer written by Joel F.  This tool will highlight (similar to Word) your code as you write it so that all naming patterns that you violate will be highlighted.   A must have to keep all your developers honest on the project.  It has options to set your own naming conventions but again, refer to the above guideline before proceeding down this route.  You can also set global rules so that all your projects will be in sync or just at the project level so that each one can follow their own standards.

XML Comments

In need to create great XML documentation for your project?  Getting tired of hitting the “back whack” key several times a day?  How about using a shortcut to get all your method parameters and some basic documentation ready for you?

I use a tool called Ghost Doc located here.  By hitting a quick key combination it will start your XML comments for you and make some best guesses and a quick summary of your method name.  Saves a few keystrokes a day/month/year.

Summary

These are my must have tools when getting setup in Visual Studio.  If you have a large team, or a small one man shop, I suggest utilizing some of these tools to make you more efficient and consistent with your work.

Thanks

Setting up the EDMX Model to Generate DevExpress XPO/XAF Objects

So you have started using DevExpress XPO/XAF and now you would like to see how to use the EDMX (Entity Data Model XML) visual designer within Visual Studio to draw your entities and relationships.  First let’s explain the steps we are going to do and what is taking place, then I’ll give you the steps to accomplish this.

The EDMX design surface is what is currently being used to generate Entity Framework code.  What we have done is to intercept the saving of the diagram and use this to generate XPO/XAF code according to DevExpress syntax.  Why?  So that we can more quickly visualize and see our entity model.  My goal was to create a tool that I could sit down with my end users in a planning session and crank out a prototype.  If anyone has users you know that they know what they don’t want as soon as they see it.  Let’s cut that cycle down so that we can more get better software out faster.

Step 1.  Download and install the EDMX Visual Studio Extension for XAF/XPO.

The extension can be found http://efxaf.codeplex.com.  Just download it and install the Liekhus.EntityFramework.XAFExtensions.vsix file.  This is the Visual Studio Extension file.  You can then ensure that it is installed by looking at your installed extensions by going to Tools –> Extension Manager.  You should see something like this below screen shot.

image

The code generator is now installed.  Let’s move to the next step.

Step 2.  Create your XAF project (if necessary)

If you are creating a new project then use the standard XAF Solution project to create a new project.   There are no special tips or tricks here. 

If you are using an existing project then you are set and ready to go.

Step 3.  Add an EDMX (Entity Data Model) to your Module project

Add a “New Item” to your Module project.  Select ADO.NET Entity Data Model under the Data section as shown below.

image

The name of the file does not matter.  Once you start creating your model, the name of the entities will drive the name of the code generated files.  Select the Empty Model option from the next screen.

image

Click the Finish button and the designer surface will be created.

Step 4.  Turn off the Entity Framework default code generation.

This is the most important step.  You must turn off the default action of the EDMX file.  Right click on the designer surface and view the Properties.  Set the Code Generation Strategy to None.  This is what causes the model to create the Entity Framework classes.  By installing the Visual Studio Extension in the above steps, when the model is saved you will now generate XPO/XAF classes based on DevExpress standards.

image

Step 5.  Create your model.

You can either use the toolbox, drag tables from the data explorer or use the wizards to create your model.  This step is using the standard EDMX designer to model the entities and their relationships.  There is no trickery here.  Below is an example model that I have built using the tool.

image

One thing to note is that we have built several of the XPO/XAF properties into the designer.  The properties below are visible when you click on an Entity.

image

You can see these properties when clicking on a property.

image

As you can see, you can set most of the properties just by entering simple property values.  In the above example, simply by putting in the display message in the Rule Required Message the XAF toolset will require the field to be completed and will also throw the above message when needed.

You will also notice all key fields have been removed from the model.  This is because all entities will be generated from the base object DevExpress.Persistent.BaseImpl.BaseObject.  This provides the Oid key based upon the XPO design.  You can change the base object, this is strictly a default and the recommended approach.

Step 6.  Save your model.

Simply save your model.  You should see several things take place here. 

For each of your entities, a concrete and generated source file will be created as partial classes.  For example, the Album class above will look like this below

image

The concrete class is where you should put your custom code (if needed) for things such as OnSave or BeforeSave logic.  This will depend on your implementation and/or solution for your needs.  By default it should look something like this.  This file will only be created the first time.  Once it is saved, your code will not be altered from this point forward.

image

The generated class is following the Windows form designer pattern by including the code generated file directly below the concrete class. DO NOT (I repeat DO NOT) make changes to this code in the designer class.  Each time you save your EDMX file, this file will be overwritten. 

image

What you will see here is that the attributes to support XPO/XAF are generated based upon the properties that were set on the model.  Try exploring with different settings and see how they react in the application.

Step 7.  Build your application according to XAF standards and best practices. 

Set any additional properties and attributes on the XAF Model.  You can run your application and see your entities in action.

That’s it for this tutorial.  What we have done is to use the designer surface of the ADO.NET Entity Data Model and intercept the save to code generate XPO/XAF classes.  Once that is done DevExpress has done a tremendous job on their framework and we let them take over from there. 

If you have any questions/comments/concerns, please feel free to post them below.  And remember, stay tuned as there are more tools and tricks to come.

DevConnections 2011

Just leaving DevConnections and collecting my thoughts.  It has been a long week but very great to finally meet the DevExpress team.  Thanks everyone for everything.  It was a great week to network and learn. 

After seeing how others are using the DevExpress tools and frameworks I now have a lot of work to catch up.  I plan on putting together a series of posts based on the following outline.  Let me know what you think.

DevExpress XPO/XAF Outline

  1. Setting the EDMX Modeling Tool for generating XPO/XAF from a visual designer surface.  Found here.
  2. Other tools that use the DXCore (such as StyleCop. Found here.) that I use to make my life easier. 
  3. Simple customizations to make XAF your own.
  4. BDD (Behavior Driven Development)/Specflow and XAF.  How you can make it use EasyTest.

These are the ones that come to my mind.  And after thinking about it most of the week and trying to explain it to other attendees, here is my new tagline for DevExpress:

“Know them for their controls.  Love them for their solutions.”  Most people know that DevExpress makes great controls, but how can we bring more attention to the frameworks and tools that allow extremely rapid application development for enterprise solutions?  I have been using it for over three years now and have made it an integral part of my everyday activities.

Times have been busy, but IASA Kansas City is off and running

I haven’t been able to keep up with the blog as of late with getting the Kansas City chapter of IASA Global up and running.  We are excited to bring the training and education factors of IASA into the local Kansas City market.  It’s a little selfish on my part as I want the training courses here locally so I don’t have to get travel approved as well.  Due to this, I have put in a lot more effort to make sure this group is set correctly and running as efficiently as possible.

With that, our initial meeting is set for September 8, 2010 from 6-8PM at the Johnson County Library on 87th St.  It is open to anyone with an interest in IT Architecture and will layout our plans over the next couple of years.  We will be discussing training and courses that we plan on hosting as well how you can get involved to help shape this group.  After all, this is a group of IT Architects working to bring the resources and training for IT Architects.

You can find more details about our meeting at http://www.iasakc.org and register for the event at http://iasakc982010.eventbrite.com.

Thanks

I Admit I Misspoke

OK.  I admit it.  The last post I hade mentioned that we moved the XAF DSL to the Entity Framework.  This has caused a lot of confusion.  I meant to say that we have used the ADO.NET Entity Data Model extensions.  This is the design surface that can be tailored to create Entity Framework.

We leveraged the code generation within the ADO.NET Entity Data Model (EDMX) file to generate XAF/XPO classes.  This allows you to visually create the entity model, set a few XAF properties and then generate the business objects from there. 

I am presenting all these topics at the Kansas City Developers Conference on June 19th.  I will post the presentation after the conference.  I have a full presentation that will demonstrate the power of the ADO.NET Entity Data Model extensions, create a small project and then add the OData layer to XAF to connect to the PowerPivot in Excel 2010.

The latest code can be found at http://efxaf.codeplex.com.

More details to come soon.  Sorry for the confusion in the last post.

Thanks again.

XAF DSL Tool Needs a new Team Lead

I have enjoyed my time on this project and have used it in several production projects.  However, with the enhancements in Visual Studio 2010 and the Entity Framework, the DSL tool doesn’t make sense for me to support at this time. 

With that said, I am looking for someone who has interest to continue the project if they so desire. 

I have moved my attention to creating a new project at Entity Framework Extensions for XAF.  We are converting the current DSL tool into the Entity Framework extensions.  The same code generation and everything else work.  However, the visual design surface is so much easier to work with. 

If you have any questions, please let me know.  Also, please take a moment to look at the new project.  This is where all my effort going forward will be focused.

Thanks again for all the support on my vision this far and enjoy.

XAF DSL Tool Finally able to be Installed

I had some hard learning experiences when trying to share this tool.  With this being my first DSL tool I was not aware of the Package Load Key (PLK) because I failed to read all the documentation.

After getting the key and time to complete it, the package is ready to be installed by whoever is still interested. 

Also, I added some new features around the XAF Easy Test.  You can now add actors and easy test cases that will navigate to the components and perform easy form fills. 

Let me know what you think.

Thanks

New Version of XAF DSL Tool Available

It’s been a busy time around here but I finally found time to update the code base for this tool.

Thanks for the great feedback and comments about the tool.  Please keep the suggestions coming and I will try to work on as much as I can when I have time. 

I recently started teaching again and just completed my Microsoft Certified Trainer program as well as attained the Microsoft Certified Professional Developer in Windows .NET 3.5 Applications.

But in the not so busy time here is the list of issues that we have corrected:

  1. Self referencing classes now produce correct code
  2. Ability to add custom attributes. Use the the CustomAttributes field.
  3. Ability to add custom rule messages
  4. Target and source properties can now be named rather than the default object name
  5. Default property of class is now definable
  6. Aggregated attribute has been included
  7. Creatable and Navigational properties are defaulting correctly
  8. Base class is no longer blank

As always, it’s available on codeplex at http://xafdsl.codeplex.com.

Enjoy!

XAF DSL Installer Available

OK.  Now that I have time to look at it, I also added an installer (MSI format) for everyone.  You can download the installer and not have to worry about the source code anymore.  This will allow you to more quickly get up and running with it and use it out of the box.

You can download the latest source code and installer from http://xafdsl.codeplex.com.

Thanks

XAF Code Generator

OK.  So I finally found some time in my schedule to back to this project.  I found and updated the issues with the code generation when I changed out all the namespace.  Feel free to download the next version and let me know what you think.

Now when you create your Object Model and save it, the code files are generated as in the demo.  Let me know if it still doesn’t work for you and I will see what I can do.

Thanks again.

XAF Generator Source Code

OK.  I finally had a little bit of time to get the namespaces changed and get this project published to CodePlex.  It is still in a rough form and needs some more changes to make it fully operational, but it has enough for others to see it.

Let me know what you think.  Please enter features so we can get them prioritized and working.  I have some ideas of where I would like tool to go but want to let everyone see it as well.

You can find the source at http://xafdsl.codeplex.com.

Thanks

XAF Generator Demo

I got a couple of feedback items about seeing the XAF Code Generator in action so I decided to post a quick video of it.

There is not any audio, but this video shows you how we create a new DevExpress project.  It then shows the DSL tool interface and how it generates the code files on save.  It will generate two partial classes.  One for your concrete implementations and one for your code generated components (similar to a form designer).  And finally I showed how you can make a field required and the attribute tag gets generated for you based upon the XAF attributes.

Click here for the video.  Let me know what you think.

Thanks

It’s been a while… Back at it with DevExpress XAF

I have not been very good at keeping up with this blog, but the theme is the same.  I started this blog with a simple theme of being able to sit down with my end users and quickly and easily diagram their requirements to produce a prototype as quickly as possible.

I started on a project I was calling Domain Builder as well as a few other side projects.  But not until the last project at work did I think this had much traction any more.

We have began using a framework from DevExpress call the Application Framework (XAF).  This is a complete windows and web UI framework wrapped around their Persistent Object (XPO) framework.  If you have not had a chance to explore it, I suggest you do.  If you are familiar with NHibernate, this has a similar ORM component to it, but the XAF makes the UI generation just as easy.

The major modification we made to it was to utilize Domain Specific Languages (DSL) to include a designer interface similar to the class diagram tool within Visual Studio.  This allows us to quickly sit with the end users to model their application.  Once we hit the save button, the business model classes are generated based upon the XPO/XAF attributes.  We can then run the application for the first time and within a matter of minutes, have a working prototype.

From there, we use the power of XAF to complete the UI design.  This framework has proven to be very flexible and powerful at the same time. 

If you have any questions or comments, please feel free to send them my way.

Domain Builder Progress

It is with great heartache that I updated the progress of Domain Builder.  It seems as though the Domain Builder project might be meeting an untimely death.  While I still have great pride and joy in the progress made thus far, I have been working with the new MVC Toolkit bits from Microsoft and the areas that they are moving forward on.  These tools are already tackling several of the areas that I was looking into.  Instead of being responsible for a framework, I can again focus on the business problems at hand.

These technologies rock!!!  The DynamicData website project absolutely makes quick work of making down and dirty CRUD (Create Read Update Delete) operations out of the database.  This is great from the perspective that it creates a quick site but allows you to customize it to your liking.  Just like what I wanted to do, so why waste my time trying.  Let's learn new Microsoft tools.

Next, I did a quick look into the MVC (Model View Controller) and discovered that it is quite similar to the MonoRail project at Castle Project.  While I have implemented the MonoRail on one application, the MVC pattern makes sense and was an easy transition.  It doesn't hurt that my experience has primarily been in Microsoft technologies.  The MVC pattern makes a whole lot of sense if you think of it like this:  The view is nothing more than a dumb-terminal (just displays and accepts information), the controller responds to the user interactions and directs traffic (he know how to get things done) and the model does the work.  The way this fits together, the model can then be anything you wish.  It could be a service oriented approach, CSLA project or other entity frameworks.  Again, the controller does not DO the work, but knows who to contact to get the job done. 

The other area that I still need to research it the Entity Framework.  While the concept here is very exciting, how does this compare to the rich business logic within CSLA?  Still trying to figure this one out.

I'm heading back to the laptop for more research time, but this stuff is extremely exciting!!! Keep going Microsoft.

MVC kicks A$$

I have been working on the domain builder but still reading articles and blogs. While I still love the idea and the concepts, the MVC presentations are really slick. I think that I am going to change direction just slightly and focus on the MVC pattern from Microsoft.

I still plan on having CSLA and NHibernate talking together. I just read another article on Ayende's site about having NHibernate using LINQ. I will explore this further as well, but right now my focus is getting the MVC pattern talking to CSLA. This will provide a quick way of seeing and consuming the business objects while still providing a rich business layer. The CSLA layer will then talk to NHibernate through LINQ and call the database as configured.

This change will then require the project to be framework 3.5 rather than 2.0, but this is a sacrifice that I am willing to look into. Until I write again, happy coding.

Domain Builder Progress

I know it's been awhile since I last posted, but let's blame it on the holidays.

Anyway, what I wanted to post today are screen shots of the latest working code.  First I'll start with what the domain builder interface looks like.  It leverages the DSL (Domain Specific Language) interface as part of the Visual Studio SDK package.  Click on the picture below for a closer look.

domainbuilder_model 

The model represented above has all entities sharing common attributes and thus inherit from the BaseEntity class.  You will also notice that each entity has an italicized name under it.  This represents the table name that the entity relates to.  Remember that this diagram will code generate the business layer using CSLA, the data layer using NHibernate and then generates the model view/presenter layers for reusability.  Note the solution explorer below.  This shows the layers that are generated for you.  Again, click on the image for a closer look.

domainbuilder_solutionexplorer

The Domain Builder tool generates each of the layers above and adds the appropriate references that it needs.  Here are the layers that are generated and my reasoning behind it.

Layer Description
Business Utilized CSLA and handles the RootBusinessEntity for each entity in the model.
BusinessListLayer Utilized CSLA and handles the RootListEntity for each of the entities in the model.
DataAccessLayer Generates the property to column mapping using NHibernate.  Each class uses ActiveRecord to handle the mapping in an easier format.
Interfaces Generates an interface for each entity in the diagram so that the mapping between CSLA and NHibernate can be coded easier.  Also, you should be coding for an interface and not for the actual implementation.
Presenter Currently generates a list and detail presenter for each of the entities in the diagram.  This still needs some attention, but I like where it is currently headed.
QueryLayer This is one of the more interesting layers.  This layer is generated based upon Ayende's Query Builder and create a "LINQ-like" interface for 2.0.  This generates an API so that you can do something like the following:
List list = List.Retrieve(Where.Entity.Property.Eq(Value)); -> reads much easier and simplifies the code drastically.
View Creates the views for the detail and list presenters.  These are just interfaces that represent what the view should provide.

 

There are more details to come, but I wanted to update whoever was still listening.  Thanks.

Domain Builder Setup

To make things easier to track (and straight in my mind), I have created an open source project to share the domain builder.  You can find the project at Domain Builder on Code Plex.  This will everyone to follow along at home on the progress as well as provide feedback in the process.

Also, I thought would be important to share more of my detailed technical thoughts on the wiki as well.  You can find this along with a list of open tasks and scenarios on the Code Plex website. 

The other items within this post are the links to the inspiration for this project:

Initial Design of Domain Builder

I have a simple goal.  I want to be able to work with domain experts and quickly diagram the application area.  This should be similar to the class diagram tool already built into Visual Studio. 

Once the diagram is built and approved, the ability to code generate should be next.  My idea here is to generate the Data Access Layer (DAL) by using NHibernate.  This would allow the application to be database agnostic by generating dynamic SQL on the fly.  The Business Persistence Layer (BPL) would be generated using CSLA (Composite Scalable Logical Architecture) by Rocky Lhotka. This allows the domain to take advantage of communication layer within CSLA which now utilizes Windows Communication Foundation (WCF).  It also allows the N-Level undo and security layer utilizing the Principal and Identity objects built into Visual Studio.  These layers working together provide for a rather robust and flexible middle tier(s) of the application. 

My next idea for the domain model is to provide a swim lane diagram to document each of the interactions between the user and the application.  These interactions would then be generated into Model View Presenters (MVP) so that the application could be wired to the domain.  By using the Passive View, as described by Martin Fowler, the view becomes a dumb implementation that should handle just the specific UI logic and not any of the business logic.  By doing this, the same presenter could be used between a Windows interface and Web interface, as well as a Mobile interface.  All these working together would be able to deliver the same user experience regardless of the UI implementing the interaction.

And finally, the implementation model would be modeled using the Component diagram.  This would allow the user to model how the application is implemented on the server(s), how the layers would communicate and where the database is located.  This model would then code generate the configuration file(s) needed. 

So, as you can see, this is a simple goal, but I plan on documenting the process as it progresses.  If you have any comments or questions, feel free to send me a note.

Model