Friday, July 24, 2009

Continuous integration for eXpand

First of all thank you very much for your good words in eXpand . I am going to continue releasing modules and the next one will be a big one so please bear with me.

But since I am relasing a lot of code and some other developers contact me that they want to contribute also. I think its time to to move on to apply a more continous integration to our build proccess.

What I mean by that? the paragraph bellow was takes from martinfowler.com

The easiest way for me to explain what CI is and how it works is to show a quick example of how it works with the development of a small feature. Let's assume I have to do something to a piece of software, it doesn't really matter what the task is, for the moment I'll assume it's small and can be done in a few hours. (We'll explore longer tasks, and other issues later on.)
I begin by taking a copy of the current integrated source onto my local development machine. I do this by using a source code management system by checking out a working copy from the mainline.
The above paragraph will make sense to people who use source code control systems, but be gibberish to those who don't. So let me quickly explain that for the latter. A source code control system keeps all of a project's source code in a repository. The current state of the system is usually referred to as the 'mainline'. At any time a developer can make a controlled copy of the mainline onto their own machine, this is called 'checking out'. The copy on the developer's machine is called a 'working copy'. (Most of the time you actually update your working copy to the mainline - in practice it's the same thing.)
Now I take my working copy and do whatever I need to do to complete my task. This will consist of both altering the production code, and also adding or changing automated tests. Continuous Integration assumes a high degree of tests which are automated into the software: a facility I call self-testing code. Often these use a version of the popular XUnit testing frameworks.
Once I'm done (and usually at various points when I'm working) I carry out an automated build on my development machine. This takes the source code in my working copy, compiles and links it into an executable, and runs the automated tests. Only if it all builds and tests without errors is the overall build considered to be good.
With a good build, I can then think about committing my changes into the repository. The twist, of course, is that other people may, and usually have, made changes to the mainline before I get chance to commit. So first I update my working copy with their changes and rebuild. If their changes clash with my changes, it will manifest as a failure either in the compilation or in the tests. In this case it's my responsibility to fix this and repeat until I can build a working copy that is properly synchronized with the mainline.
Once I have made my own build of a properly synchronized working copy I can then finally commit my changes into the mainline, which then updates the repository.
However my commit doesn't finish my work. At this point we build again, but this time on an integration machine based on the mainline code. Only when this build succeeds can we say that my changes are done. There is always a chance that I missed something on my machine and the repository wasn't properly updated. Only when my committed changes build successfully on the integration is my job done. This integration build can be executed manually by me, or done automatically by Cruise.
If a clash occurs between two developers, it is usually caught when the second developer to commit builds their updated working copy. If not the integration build should fail. Either way the error is detected rapidly. At this point the most important task is to fix it, and get the build working properly again. In a Continuous Integration environment you should never have a failed integration build stay failed for long. A good team should have many correct builds a day. Bad builds do occur from time to time, but should be quickly fixed.
The result of doing this is that there is a stable piece of software that works properly and contains few bugs. Everybody develops off that shared stable base and never gets so far away from that base that it takes very long to integrate back with it. Less time is spent trying to find bugs because they show up quickly.

What tools can help us on this one ?

1st there is CCNET which is open source but difficult to setup

But what I am going to use is TeamCilty which has a license for open source projects like eXpand and go one step further as you can see bellow

Pre-Tested Commit: No broken code in your version control. Ever.

So don’t be afraid if the versioning goes mad, from now and on I am going to automate as much as I can the work that a developer has to do.

Technorati Tags: ,,,

Subscribe to XAF feed
Subscribe to community feed

DiggIt!

Tuesday, July 21, 2009

How to download eXpand source code from google subversion

After some requests I am going to give any info required to get eXpand’s source code from Google code.

First you are going to need a Subversion Client. I am using the free  TortoiseSVN client on both 32 and 64bit environments without any problems.

In fact it is very easy to use . After you install it just right click inside any directory in your windows explorer and you are going to see some more entries on the popup menu

image

for getting a read-only copy of expand click on the SVN Checkout menu entry and paste

http://expandframework.googlecode.com/svn/trunk/ on the popup window

image

and you are going to have all the source code to your disk.

Contributing your code.

For those that never use an svn client before I suggest to download and use up to trial end (or you can buy it of course if you like it ) http://www.visualsvn.com/visualsvn/download/

VisualSVN is a visual studio add-on that provides seamless integration with subversion server

just do a checkout from within your studio

image

paste again http://expandframework.googlecode.com/svn/trunk/ at the popup window

image

and eXpand will open inside your visual studio

Your Solution explorer will now have a orange/green circle before each file. Orange means modified file and Green means unchanged file

image

at any time you can commit your changes (orange files) to Google subversion by

image

or update your copy with any changes made at Google subversion by

image

or revert any changes you make at your local copy at your hard disk

image

Tortoise has endless command but those above is the most often used. You can accomplish the above and much more using the free TortoiseSVN from explorer

image

It is very easy to do it!!!! Just try it.

 

To contribute your code you have to contact me so I can make a review on it , and If its good you are on the team

Subscribe to XAF feed
Subscribe to community feed

DiggIt!

Monday, July 20, 2009

Configurable low level datastore filtering provider module for Xaf

This one is hard to explain so I would start with one scenario that can be implemented with ease.

You have a request to create a windows form application that the data should be filtered according to the active skin, also the request says that Customers should be shared through skins.

Another request for the same project is application data to be filtered according to the active user but customers to be shared across all users

For such scenarios that are: Filter data at a low level so any logic above this level to still function (see validation rules) I have develop FilterDataStore module and I am going to release it as part of eXpand 0.0.0.7

To configure the module one have to add a filter provider at its application configuration file (see A practical guide to decoupling .NET 2.0 applications).

I am going to release 3 projects

eXpand.ExpressApp.FilterDataStore
Contains the filtering implementation and any providers that are not platform specific. It is  very easy to create a custom provider you just have to inherit FilterProviderBase class and implemented the required methods. Look for eg. the UserFilterProvider bellow I think is self described

public class UserFilterProvider:FilterProviderBase
{
    public override object FilterValue
    {
        get {
            if (SecuritySystem.CurrentUser != null)
                return ((XPBaseObject)SecuritySystem.CurrentUser).ClassInfo.KeyProperty.GetValue(SecuritySystem.CurrentUser);
            return null;
        }
    }

    public override string FilterMemberName
    {
        get { return "User"; }
    }

    public override int FilterMemberSize
    {
        get { return SizeAttribute.DefaultStringMappingFieldSize; }
    }

    public override bool FilterMemberIndexed
    {
        get { return true; }
    }

    public override bool UseFilterValueWhenNull
    {
        get { return false; }
    }

    public override Type FilterMemberType
    {
        get { return typeof(Guid); }
    }
}

eXpand.ExpressApp.FilterDataStore.Win
This one will contain any windows specific classes. For the moment it will contain the SkinFilterProvider

public class SkinFilterProvider:FilterProviderBase
{
    public override object FilterValue
    {
        get { return UserLookAndFeel.Default.ActiveSkinName; }
    }

    public override string FilterMemberName
    {
        get { return "Skin"; }
    }

    public override int FilterMemberSize
    {
        get { return SizeAttribute.DefaultStringMappingFieldSize; }
    }

    public override bool FilterMemberIndexed
    {
        get { return true; }
    }

    public override bool UseFilterValueWhenNull
    {
        get { return false; }
    }

    public override Type FilterMemberType
    {
        get { return typeof(string); }
    }
}

FilterDataStore has been preconfigured to disable filtering for the following system database tables

AuditDataItemPersistent
AuditedObjectWeakReference
ModuleInfo
PersistentPermission
Role
User
UserUsers_RoleRoles
XPObjectType
XpoModelDictionaryDifferenceStore
XpoRoleModelDictionaryDifferenceStore
XpoRoleModelDictionaryDifferenceStoreXpoRoleModelDictionaryDifferenceStores_RolesRole
XpoUserModelDictionaryDifferenceStore
XPWeakReference

see how

image

In Order to use FilterDataStore Module we have to do what I say in the video bellow but instead of using DictionaryDifferenceStore Module we should use FilterDataStore module

assuming you have setup your references see how you can setup your filtering providers. So your application configuration file should look like

image

Latest version of eXpand can be found at http://code.google.com/p/expandframework/


Technorati Tags: ,,

Subscribe to XAF feed
Subscribe to community feed

DiggIt!

Sunday, July 19, 2009

DxCore plugins for Xaf are moving

I am releasing new version of eXpand (0.0.0.7) that will contain a configurable low level datastore filtering provider module and I am going to merge Coderush plugins into it as well.

You have to download latest version of eXpand from

http://code.google.com/p/expandframework/downloads/list

and add only the following assemblies into your community folder if you are not interested in eXpand 

DevExpress.ExpressApp.ModelEditor.v9.1
eXpand.Utils
Wintellect.Threading
eXpandAddIns

Subscribe to XAF feed
Subscribe to community feed

DiggIt!

Tuesday, July 14, 2009

Runtime distribution of model changes to a group of users

I am going to demonstrate one more application scenario using eXpand and DictionaryDifferenceStore module. We are going to create to roles (hrempolyers , courierempoyers) and we are going to assign a difference Cutomer listview to each one of them

Listview for HR people will see customers grouped by their birthday and listview for courier grouped by their address

For both roles the navigation menu will contain the default User button that was provided by xaf.

see how to setup DictionaryDifferenceStore module

In the next video I have already created 2 extra Roles

HRRole with Hr1, Hr2 Users
CourRole with Cour1, Cour1 Users inside

The above video was recorded with eXpand v0.0.0.6

http://code.google.com/p/expandframework/downloads/list

Subscribe to XAF feed
Subscribe to community feed

DiggIt!

Friday, July 10, 2009

Generate runtime members -- eXpand

 

Today I am going to saw you how easy is the Generation of runtime members. eXpand provides a controller that extends model schema and allow runtime generation of members without writing even 1 line of code (Xaf power to the people!!!)

For doing this You have to use a combination of features from eXpand.DictionaryDifference.dll && eXpand.ExpessApp.Win.dll

This generation is doable due to the fact that we have use use DictionaryDifference module to store the model in the database, and since there is a clear distinguish between user model and application model, we can have use dictionarydifference UI to set the Model editor attribute that does that expansion, which is the IsRuntimeMember attribute defined at eXpand.ExpressApp.SystemModule.AddRuntimeFieldsFromModelToXPDictionary controller

Imagine the power you have, now you can create a more dynamic extension of model schema cause you at runtime!!

Our scenario will involve adding a new Mobile Phone member to our User class publish that change to all applications that run in our network

DictionaryDifference take care also the debugging scenario by using the model.xafml stored in your disk as application model when debugging and the one stored on the database when not, so becarefull when running your solution at debug mode because it always is going to use as an application model the one stored at your disk and when you do not run at runtime (CTRL+F5) the one stored at the database will be used

see demo video

eXpand is available at http://code.google.com/p/expandframework/downloads/list

Subscribe to XAF feed
Subscribe to community feed

DiggIt!

Wednesday, July 8, 2009

Real World FrameWork (eXpand)– First release

Refactoring was too time consuming cause I had to work with all modules together and they are almost 40 of them.

Because I want to focus only at the modules that we are going to release at first alpha version I am going to talk only about those.

eXpand as I already said has almost the same architecture as Xaf .The number of project we are going to released are 11.

eXpand.Utils
That project is holding reusable classes that can be used through other modules. Also dynamic Linq library is hosted here

eXpand.Xpo
CustomCollections, ConnectionProviders, ValueConverter, FunctionOperators, CustomXPObjects, TypeConverters, Attributes that are specific to Xpo are hosted here.

eXpand.BaseImpl
Is the same as ExpressApp.BaseImpl and is holding base implementations of Persistent Objects that are used from other modules. Generic ValidationRules belong also here

eXpand.Base
All objects that they are not xaf oriented but they have some kind of dependency with any Persistent object are using should go here

eXpand.ExpressApp
This one is the first generic module that will hold controllers that can run in both win,web environments. Also will host classes that derived from classes of DevExpress.ExpressApp module. Like custom CollectionSources,ViewExtensions,DictionaryHelpers,DataStoreProvider,XafApplicationExtensions,ObjectSpaceProviders

eXpand.ExpressApp.Win
This is the second generic module that will hold controllers that are specific to win enviroment. WinListEditors, WinPropertyEdtiors, WinTemplates, WinApplication derived classes and anything is windows targeting belongs here.

eXpand.ExpressApp.Web
This is the third generic module that will hold controllers that are specific to web enviroment. WebListEditors, WebPropertyEdtiors, WebApplication derived classes and anything is web targeting belongs here.

eXpand.ExpressApp.Security
BasePermissions and Security engines for different artifacts should go here

eXpand.ExpressApp.DictionaryDifferenceStore
Using this module you can save your model at your database instead of disk. Also it generates the UI required so you can modify your Model.xafml,User.xafml, or assign User.xafml to any user, or combine models with each other. Its a very flexible module that provides a distinguish between Model.xafml and User.xafml. If you change the model using the current model editor at runtime, only your user model is going to be modified now you can change your model.xafml for all users since its store at the database with ease making your product support less painful cause the model “work” is now centralized.

eXpand.ExpressApp.DictionaryDifferenceStore.Win
Only a Model editor propertyEditor is defined here for the momemt


eXpand.ExpressApp.DictionaryDifferenceStore.Web
Only XpoWebModelDictionaryDifferenceStore class that is responsible for enable any further element / debugging of the of the DictionaryDifferenceStore for web

Important: This is the 1st alpha version so code will be subject to many changes. Wiki’s are going to be written in the next few weeks and many blog post by me demonstrating the use of controllers and modules released

 

bellow you can see a code analysis using NDepend (read more )

image image

An open source project hosting the above modules can be found at

http://code.google.com/p/expandframework/downloads/list

ps: For all contributors of eXpand a professional license For TypeMock, NDepend, NCover can be provided in order to help building it

Subscribe to XAF feed
Subscribe to community feed

DiggIt!

Saturday, July 4, 2009

Inspect Xaf code quality and override version migration problems using NDepend

NDepend is the most wonderful analysis tool I have ever found . It can help you by providing metrics of your code or anyone else  code, specify code constrains, analyze code, diff between versions of your code.  It also has an open source license to anyone interested.  I am going to apply the some metrics like the ones Patrick posted here

http://codebetter.com/blogs/patricksmacchia/archive/2009/05/21/a-quick-analyze-of-the-net-fx-v4-0-beta1.aspx http://codebetter.com/blogs/patricksmacchia/archive/2009/04/26/the-big-picture-of-the-sharpdevelop-code-base.aspx
http://codebetter.com/blogs/patricksmacchia/archive/2009/04/23/ndepend-and-the-quality-of-the-cruise-control-net-code-base.aspx
http://codebetter.com/blogs/patricksmacchia/archive/2009/01/11/lessons-learned-from-the-nunit-code-base.aspx http://codebetter.com/blogs/patricksmacchia/archive/2009/01/19/mono-vs-net-framework-public-api-compatibility.aspx http://codebetter.com/blogs/patricksmacchia/archive/2008/10/01/comparing-silverlight-and-the-net-framework.aspx http://codebetter.com/blogs/patricksmacchia/archive/2008/08/26/nhibernate-2-0-changes-overview.aspx http://codebetter.com/blogs/patricksmacchia/archive/2008/08/13/net-3-5-sp1-changes-overview.aspx

in to Xaf 1.5.4

I am very interested to know how serious DevExpress is taken code quality . From my experience, I mean from digging their source every day I say they are good but lets find exactly how good they are.

In the right view you can see one of the many NDepend views that help you to visualize your analysis, and from just a look we can see that in this query a very small part of the framework is involved (where color is blue)

Field Analysis

  • Number of Fields
image image

Method Analysis

  • Number of methods

image image

ok !! same results

  • Number of Lines of code >25
image image

For this one I think that maybe someone should start put some more rules to their team

  • CyclomaticComplexity >15
image image

aha!!! Here we start to see how much NDepend Rocks!!! (see right picture) .Almost 3 times better than previous metric. Good work on this one.

  • Poorly commented
// <Name>Methods poorly commented</Name>
// A method with at least 10 lines should be commented.
WARN IF Count> 0 IN SELECT METHODS WHERE
PercentageComment < 20 AND NbLinesOfCode > 10

image

NONE!!! excellent!!!

  • With parameters count>5
image image

You see by just looking the right image you can tell if the metric is applied or not even if the image has small resolution

  • With local variables count > 7
image image
  • Better encapsulation
image image

Types Analysis

  • Inheritance tree depth >5
image image

Interesting !!! I didn’t expect to find so many types

  • Number of fields > 10
image image

that is a bad one

  • Types that use boxing
image image

another bad one

  • Better encapsulation
image image

Most powerful eh? what do you think? NDepend features do not stop here!!! they are endless.

lets see how the above statistics vary through time, by getting the diff between 9.1.2 and 9.15 version

image

Ok nice info but we can do better than that.

We Can find all types that added or changed since 9.1.2 version

image

Version migration

And something even more powerful, you can tell with ease if your application that you have build with 9.1.2 with hold a 9.1.5 version migration by using NDepend’s CQL language to ask “if there are methods that used to be public and for which visibility was changed or have been removed

image 

very powerful tool!!! You should try it.

ps: I should say a very big thnks to NDepend that has offered a free pro license to all contributors of eXpand

Subscribe to XAF feed
Subscribe to community feed

DiggIt!

Thursday, July 2, 2009

eXpand step 2-Singing assemblies with strong Names

Related posts:
eXpand RWF = (Real world framework)--->First thoughts
eXpand Step 1 – refactoring and renaming
eXpand step 2-Singing assemblies with strong Names

We are going to use the same approach as Dx on this one. Dx uses a strong key at DevExpress.Key folder we are going to use it at eXpand.Key folder. All project (*.csproj) files should have an AssemblyOriginatorKeyFile attribute that will point to ..\..\eXpand.Key\eXpand.snk relative path

 

image image

that way the eXpand.snk will not be embedded to our projects.

Subscribe to XAF feed
Subscribe to community feed

DiggIt!