vbug talks in bristol coordinators david ringsell david@talk-it.biz steve hallam...

Post on 12-Jan-2016

223 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

VBUG Talks in Bristol http://cms.vbug.net

Coordinators

David Ringselldavid@talk-it.bizwww.talk-it.biz

Steve Hallamsteve@plumsoft.co.uk

VBUG Winter Conference 2005www.vbug.net

Ain’t No Mountain High Enough .Net Case Study

Matt Link Wednesday February 15th

What?!? C# Could Do That???

Shay FriedmanTuesday March 27th

Talks in Bristol

Ain’t No Mountain High Enough- a product case study

Matt Link

Covering……..

Challenges in writing a product vs. bespoke Customisations Version Control Deployment

Security

What is Parnassus?

A mountain of limestone in central Greece 

What is Parnassus?

What is Parnassus?•Sit

es•Q

ualifications Offered

Centres•Pa

thways

•Units

Qualifications

•Registrations (Single and bulk upload)

•Grades (Single and bulk upload)

Learners

•Certificate Printing

•Export to 3rd Party printing software

Certification

Awarding Body Management Software

What is Parnassus?

To Parnassus…..

Challenges in writing a product

Versioning & Deployment Many installations, not all upgraded at the same

time

Integrations Many require integration with other systems

Customisations UI Business Logic Security

Challenges in writing a product

How to handle these issues whilst: Keeping the code maintainable One code base Ensure changes for one customer don’t adversely

affect another customer

Customisations

Plug-ins

Improved Maintainability of code• Customer Specific code doesn’t end up in core

Parnassus• Fewer settings

Easier to test• Additional code is self-contained in the Plug-in

Greater Flexibility• Not all code changes now require a new version of

Parnassus to be created

MEF (Managed Extensibility Framework)

A bit like

eBay WebsiteBuyers• Looking for X

Sellers• Have x

MEF

eBay WebsiteBuyers• Looking for X

Sellers• Have x

MEF Composition ContainerImports• Looking for X

Exports• Have x

MEF

A Composable Part is something which either

• Needs (Imports) something• Offers (Exports) something• Both!

These “needs” and “offers” are matched based on Contracts by a Container

We use Interfaces, but you can just use a string……..

MEF (Managed Extensibility Framework)

MEF

A Part Specifies what it wants to Import

[ImportMany(typeof(IQualificationRegistrationCreated))]

A Part specifies what it can Export

[Export(typeof(IQualificationRegistrationCreated))]

The Container matches the two together

A Catalogue is used to discover the Parts

MEF

public static CompositionContainer Container {

get {

string dir = PluginDirectory; DirectoryCatalog cat = new DirectoryCatalog(dir); var container = new CompositionContainer(cat); return container; } }

public static void Compose(object toCompose) { try { CompositionContainer c = Container; c.ComposeParts(toCompose); } catch (Exception ex1) { throw new Exception("Error Composing Object: " + toCompose.GetType().Name, ex1); }}

Calling “ComposeParts” on a Container matches Imports to Exports

DirectoryCatalog scans a given directory for Parts

MEF - A Quick demo

ImportedPlugins Class

[ImportMany(typeof(IQualificationRegistrationCreated))]

public FilteredExportCollection<IQualificationRegistrationCreated> QualificationRegistrationCreated

{

get;

internal set;

}

Contract

FilteredExportCollection<T> : ICollection

QualificationRegistrationCreated_Demo Class

[Export(typeof(IQualificationRegistrationCreated))]public class QualificationRegistrationCreated_Demo : IQualificationRegistrationCreated

MEF - A Quick Demo

To the Code………..

MEF

1.When the Compose Method is called on the Container, MEF matches Imports to Exports based on the Contracts.

2.This populates a collection (in our case a generic FilteredExportCollection<T>)

3.Any Exports matching the Contract are now available in the collection

MEF – Example Uses Custom Validation

• Normally involves • Yet another setting / Code into core Parnassus

Finance

Address Lookup

Integration• E.g. On learner save send details to another system

Translations

Every customer calls things by different names

Translations needs to be applied everywhere with minimum of developer effort

Every customer has a different set of translations

Translations

Extension Method “Add" methods to existing types

Enables you to do:

Translations

Translations

On every page:

For each Control on the page…1. Get Control Type2. Change a property to the translated

version…

Security

Similar challenge with security Every customer has different rules asp.net Page level security not fine grained

enough

Only controls access to whole pages / folders

Field level security required Minimise developer effort (make security easy)

Security

Security

Gets cached security rules for the page For each Control on the page…

1. Get Control Type2. Apply security rules based on control type

1. E.g. GridView - Adds an Event Handler to DataBound event

Security

Parnassus as a Centre User…. Limited menu options Restricted to seeing limited details of own centre Restricted to viewing only their learners

Customer decides how much each User / Role can see and do in Parnassus

To Parnassus…… User: Centre1 Pass: Centre1

Deployment

Deployment Many customers, many versions

About 4 different versions being supported

Initially struggled with upgrade paths DB change scripts from one specific version another specific

version

V2.0 Scripts V2.3 Scripts V3.0

Customer A - Jan Feb December

V2.0 Scripts V2.5 Scripts V3.0

Customer B - Jan April December

Deployment

Problems: Almost no reuse of upgrade scripts

Customer A’s V3.0 not quite the same as Customer B’s

OK when fairly regular updates, harder when big jumps

Deployment

No more schema upgrade scripts

Will upgrade any version of Parnassus

Quicker than producing upgrade scripts

Potential to use them for Source Control of the Database

Solution = Database Projects

Deployment – Database Projects

Visual Studio

SQL

1) Database Synced with Database Project

Build Output

2) DB Project produces .dbschema

Deployment

To a quick Parnassus Upgrade…..

Versioning

Versioning – What changed / changing when

Work Items in TFS for us Assign work to Versions / Iterations Track work status (Design / Coding / Testing) Associate code check-in with work items

Change Log comments for the customer Viewer App to extract them Quickly generate a change log for a version

TFS Work Items

Branching & Merging

Need to be able to release patch versions Fix once, apply to all versions

Allow ongoing development at the same time

Requires Source Control Software (TFS) Compare / Merge tool (DiffMerge) A branching strategy…..

Branch Label

Branches are duplications of an object under revision control so that modifications can happen in parallel along both branches.

On going development of new functionality

Branching & Merging

Visual Studio TFS Branching Guidehttp://vsarbranchingguide.codeplex.com/

Other things to talk about….

Custom User Controls Settings Code Generation Auditing

Questions

top related