Wednesday, November 14, 2007
Yep, that time again, the 20th Architecture chat will be held this thursday, 11:30am at the Sylvia Park in Auckland (at Garrisons), all are welcome to come along.

Some topics (off the top of my head) this week include:
  • Java & .Net (didn't make it in last week)
    • The IKVM project (Java VM implemented in .Net)
  • ORM Love
    • NHibernate 2.0 features/maturation (and yes, it looks like the Castle trunk will be moving to it, hurray!)
    • Lightspeed 1.1 has been released.
    • Experiences of writing a Linq to query parser.
  • VS2008 very close
    • But ReSharper for C# 3.0 a while off.
    • Tempted by TeamSystem just to get the in-line "annotate" functionality.
And if anyone else has suggestions, feel free to throw me a comment/email etc. - obviously a bit topic light at the moment.

See you all Thursday!

posted @ Tuesday, November 13, 2007 6:54:18 PM (New Zealand Daylight Time, UTC+13:00)    Comments [0] | Trackback |
 Monday, November 12, 2007
So first off... for those who don't know SharePoint... CAML is a bit of swiss army knife... if you understand it, can stand it, and know where to stick it you can pull off some interesting and useful results with SharePoint... I'm no expert however, having only touched it for querying and tweaking it here and there for some custom views. Though I think I can confidently say CAML is a wonderful example of XML Abuse :)

At any rate, one aspect of CAML is being able to write CAML queries to query data sources i.e. SharePoint Lists.... I'm against constructing strings for querying data sources, because they're ugly - and difficult to mutate with code, so I decided to give CAML.Net a try (and ended up using it, albeit reluctantly) - here's an example query in CAML:

<Where>

    <Or>

        <Eq>

            <FieldRef Name="ContentType" />

            <Value Type="Text">My Content Type</Value>

        </Eq>

        <IsNull>

            <FieldRef Name="Description" />

        </IsNull>

    </Or>

</Where>


And then in CAML.Net - at first glance it looks ok:

Console.WriteLine(CAML.Where(

                      CAML.Or(

                          CAML.Eq(

                              CAML.FieldRef("ContentType"),

                              CAML.Value("My Content Type")),

                          CAML.IsNull(

                              CAML.FieldRef("Description")))));


But of course then you look a little closer and see that CAML.Where, CAML.Or, CAML.Eq etc. all return strings... so your not actually building a model of your query - which to me immediately removes a large part of the value for this solution.

Looking around the blog-sphere I see lots of people using CAML.Net, and yet nobody seems to have a problem with the way it works?... it puzzles me... At any rate.. let's dive into why I don't like this approach... with another example:

Console.WriteLine(CAML.Where(

                      CAML.Or(

                          CAML.Eq(

                              CAML.FieldRef("Title"),

                              CAML.Value("My Title")),

                          CAML.Or(

                              CAML.Eq(

                                  CAML.FieldRef("ContentType"),

                                  CAML.Value("My Content Type")),

                              CAML.IsNull(

                                  CAML.FieldRef("Description"))))));


And here's the CAML for that:

<Where>

    <Or>

        <Eq>

            <FieldRef Name="Title" />

            <Value Type="Text">My Title</Value>

        </Eq>

        <Or>

            <Eq>

                <FieldRef Name="ContentType" />

                <Value Type="Text">My Content Type</Value>

            </Eq>

            <IsNull>

                <FieldRef Name="Description" />

            </IsNull>

        </Or>

    </Or>

</Where>


Notice the Or inside an Or... this is direct feedback from the CAML query language itself - notably that you can't construct a query with multiple root-level criteria, so your left to construct a tree of Or and And's as required to represent your query - which is ugly, and ultimately confusing - it doesn't express intent well... So my first problem with the CAML.Net approach is it makes me aware of the problems in CAML, when they could've been abstracted away for me... now let's look at a reasonably dynamic CAML query.

string title = "My Title";

string contentType = "My Content Type";

 

List<string> orFragments = new List<string>();

 

if (!string.IsNullOrEmpty(title))

{

    orFragments.Add(CAML.Eq(

                        CAML.FieldRef("Title"),

                        CAML.Value(title)));

}

 

if (!string.IsNullOrEmpty(contentType))

{

    orFragments.Add(CAML.Eq(

                        CAML.FieldRef("ContentType"),

                        CAML.Value(contentType)));

}

 

orFragments.Add(CAML.IsNull(CAML.FieldRef("Description")));

 

string query = CAML.Where(

    OrCamlRange(orFragments.ToArray()));


And suddenly I'm forced into a world of pain - having to manage the various criteria myself, and strings no less - in this case I'm only using Or's - so I can use a little function to stitch everything into a valid query:

private static string OrCamlRange(string[] items)

{

    if ((items == null) || (items.Length < 1)) throw new ArgumentNullException("items");

    if (items.Length == 1) return items[0];

 

    string[] remainingItems = new string[items.Length - 1];

    Array.Copy(items, 1, remainingItems, 0, remainingItems.Length);

 

    return CAML.Or(items[0], OrCamlRange(remainingItems));

}


But I can't help feeling that an opportunity for CAML.Net to really shine has been tarnished by an initial design choice of returning strings, instead of models.  At least for my use cases, I would've been much happier with something that returned a model which I could post-parse - to smarten up the experience so I could identify misspelled fields, mutate the query based on user choices etc.

Finally, just to be clear - this is not a dig at John Holliday - CAML.Net's author, he's a smart guy who knows a lot more then I ever will about SharePoint!  It's merely an opinion/observation on the negatives of query building approaches which don't embrace an intermediate model which can be parsed or mutated.



posted @ Sunday, November 11, 2007 9:40:34 PM (New Zealand Daylight Time, UTC+13:00)    Comments [0] | Trackback |
 Sunday, November 11, 2007
So I rediscovered my Vietnamese coffee dripper today... and a small cache of Trung Nguyên coffee I had secreted away after getting back from my Asian excursion a while ago... a little dubious as to whether it would have stood the test of time I brewed a test batch...

And had completely forgotten just how strong it is... yikes - I've been on caffeine buzz for the last hour or so ... it has such a distinctive flavor too... took me straight back to sitting in 35 degree heat, drinking extremely strong coffee mixed with ice cubes and condensed milk in the Vietnamese jungle... (it was a lot more fun then it sounds, though the sweetened condensed milk is a bit too sweet for my liking)

So at any rate - I'm starting to unwind after an incredibly busy period of work - think 16+ hour days for a couple of months ... which has left me a little shattered to say the least... so I'm unwinding a little today...  The lawns are mowed, the sun is shining and I've started to read Beautiful Code - which I've heard mixed reviews of, but I figure it'd be a nice change from SharePoint blogs and should hopefully put me in the right frame of mind as a shift my focus back to projects revolving around ALT.Net technologies once again.


 |  | 
posted @ Sunday, November 11, 2007 3:48:49 AM (New Zealand Daylight Time, UTC+13:00)    Comments [0] | Trackback |
 Saturday, November 10, 2007

Here are some more SharePoint hacks (continuing on from my last post here)

First off some hacks for the SPGridView which is actually a pretty useful control, but fails to do a few things, like displaying attachment columns as-per SharePoint's default List views (with a little paper-clip symbol), and the second (and much more annoying) it doesn't use the current users regional settings / timezone for formatting DateTime values.

The hacks:
And finally support for a ListForm replacement web part - after trying to customize the ListForm to suit a customers requirements by creating a CustomListForm in SharePoint designer I gave up in disgust because it's just too limited in what it lets you achieve, and worst of all, it breaks attachments support!  So I wrote a small web part to replace it, which allows for fine-grained control of visibility and editability (if that's even a word) of each field, and as an added bonus it doesn't break the attachments functionality.  I also wanted to add additional links/buttons to the form which triggered a save including validation etc. - so I did a little hack to implement that as well.
I might have a few more to post before the end of the project - but it's almost wrapped up, so these may be the last for a while.

Hopefully someone out there finds them useful.
posted @ Friday, November 09, 2007 9:38:26 PM (New Zealand Daylight Time, UTC+13:00)    Comments [8] | Trackback |
 Wednesday, November 07, 2007
I've been working with SharePoint lately, it's a technology of highs and lows... the highs are when you've finally got something to work that should've worked in the first place, the lows are well... all the times in between.

Ok, so that sounds cynical - SharePoint is actually quite a cool product - there's a lot of good in there... stuff that would take you a while to write yourself... but it just tends to drive you a bit crazy, things that look easy from a distance become hard to achieve because of poor documentation, lack of extension points and the difficulty in building testable code.

At any rate, while on this project I've been compiling a list of hacks that other people may find useful, which I used to solve a few of the problems I was hitting while developing... here are the first few:
There are some more coming shortly.
posted @ Wednesday, November 07, 2007 12:04:46 AM (New Zealand Daylight Time, UTC+13:00)    Comments [2] | Trackback |
 Thursday, November 01, 2007

Architecture Chat #19

So another small turnout - Garreth, David, Murray (From Terabyte) and Myself. Peter gave his apologies, being out of town today.

First off we had a talk around the various issues / challenges facing electronic payment, US dollar merchant accounts, PayPal etc. when selling your products on line. 

Part of the discussion focused around the fact that there is no existing product/site out there that can help sell your software products (that has the right features), we're thinking:
  • Distributing licenses from a pool.
  • Calling back to a web service for generating licenses on the fly.
  • License activation over the Internet.
  • License expiration (for yearly licenses) and the required logic around that i.e. automatically adding license renewals to a users shopping cart, sending notifcations.
  • The list goes on...
Even more so, building a community around selling add-ons, templates etc. for your product, and providing a model where micro payments can be collected i.e. buying credits and redeeming them on purchases etc. There are plenty of good ideas in this space.

Last of all, the existing software retail sites need to take a smaller cut - a not uncommon amount is 10-20% of the product cost... that's just crazy, especially for high-cost products, thats no different to giving them a 20% share in your business - you don't need to ship many products before you could've just built your own using PayPal.

Following that we had a long conversation around Garreth's ArchAngel product again, and in particular around the challenges of templates, round-tripping code, interesting usage scenarios i.e. (generating a model, the UI to bind to that model and WatiN classes which make it easy to write tests for the UI) - and also around preferences i.e. strengths and weaknesses of using a statically typed language (C#) embedded in the templates vs. something like IronPython or Boo, and how you can flow compilation errors (line numbers etc.) from the compiler back to the template - something I have trouble with when diagnosing Binsor, brail and my own boo based template engines at the moment, mostly because I haven't invested the time to make the experience better.

At that point we had a discussion around the various CMS's - I've been doing some research to pick one for a few sites I want to port from "other" CMS's.... The three I picked on for .Net were:
i.e. some of the open source ones... I would've liked to have included rainbow cms as well, but I just haven't had the time to review it yet.

Everyone knows about DNN (in fact we complain about it quite regularly ;o) - so it was really put up as a base line for comparing the others... mojoPortal is a bit like DNN, however it supports a wider range of databases - can run on mono and has a few unique/interesting features.  It lacks the same level of community involvement as say DNN or Umbraco, but it does give you the opportunity to avoid shelling out for OS licenses... Alas it uses web parts, and though xhtml compliant it lacks the rendering flexibility of Umbraco - Also the data model is pretty scary... a single class for all core data access, using stored procedures.

Umbraco looks good - has a reasonable template engine, and is a little more content-flexible then the other products which are based on web-parts - Sql server only and the business entities have in-line sql (why haven't any of them been built using a bloody ORM!) - this kind of thing scares the hell out of me - round trip per-property?? why!

public int MasterTemplate

{

    get{return _mastertemplate;}

    set{

        _mastertemplate = value;

        SqlHelper.ExecuteNonQuery(_ConnString,CommandType.Text,"Update cmsTemplate set master = " + value + " where NodeId = " + this.Id);

    }

}

 

public string Design {

    get {return _design;}

    set {

        _design = value;

        SqlHelper.ExecuteNonQuery(_ConnString,CommandType.Text,"Update cmsTemplate set design = '" + value.Replace("'","''") + "' where NodeId = " + this.Id);

    }

}


Or better still, how about this web control's OnInit method:

protected override void OnInit(EventArgs e)

{

    base.OnInit (e);

    SqlDataReader dropdownData = SqlHelper.ExecuteReader(umbraco.GlobalSettings.DbDSN,

        CommandType.Text, "select id, text from umbracoNode where nodeObjectType = '39EB0F98-B348-42A1-8662-E7EB18487560' order by text");

    base.DataValueField = "id";

    base.DataTextField = "text";

    base.DataSource = dropdownData;

    base.DataBind();

    base.Items.Insert(0, new ListItem(ui.Text("choose") + "...",""));

 

    // Iterate on the control items and mark fields by match them with the Text property!

    foreach(ListItem li in base.Items)

    {

        if ((","+Text+",").IndexOf(","+li.Value.ToString()+",") > -1)

            li.Selected = true;

    }

    dropdownData.Close();

}


The biggest down-side to me however is not the glorious SQL sprinkled everywhere - but the XSLT... I just flat out hate working with XSLT... and nobody at the table seemed to have anything good to say about it either.  It's certainly powerful, but it's just no fun to work with (XSLT that is, not Umbraco).

Still none of these are necessarily reasons to throw the baby out with the bathwater, if it gets the job done (which Umbraco certainly seems to, based on community feedback) then why not use it - the only other thing that puzzles me is the complete absence of a test suite for a project, even an empty test project would be a good sign ;o)

So on that note, Murray is embarking on a Umbraco project over the next couple of weeks - I'll check back with him when it's done and get a post-mortem on how it went, and what his thoughts are on the framework.

On the flip-side... why hasn't a monorail/ActiveRecord based CMS been released yet (that's open-source) ... a few have been written (obviously for commercial projects), but the parties and companies involved never seem to have the initiative to allow their code to escape out into the wild... I can't help but wonder how much stronger Monorails position would be if a CMS had been developed and grown along-side the project, if nothing else I suspect we might have a seen a few more interesting view components developed and made available by now.

Hardly new thoughts though - this has been discussed a few times on the Castle-project-users list, but nothing seems to come of it...

We then had a brief talk about F# becoming a "first class" language for the .Net framework, that will be in VS2008... one of the questions was what F# offered, there is a lot, but things that I can recall.
  • Functional programming, in particular foundational features like lists, tuples (allowing multiple arguments /multiple returns), pattern matching etc.
  • Type inference (which we discussed, i.e. is code using inferred types harder to read/understand as things become more complex, a bit like using var in C# 3.0?)
  • All data is immutable by default (makes multi threading etc. easy - mutable data must be declared explicitly).
  • Linq integration, and some metaprogramming functionality.
I'm pretty sure that list does the language a great injustice :)

What is exciting is that unlike C# vs VB... in this case F# provides features which make it compelling for solving certain types of problem - and as a first-class language you don't miss out the debugging etc. experiences (and your guaranteed a language which isn't going to stall or be thrown away any time soon) - I doubt I would use it for an entire project, but I could certainly see writing specific libraries in it for consumption from C#/VB.Net applications.

Last of all we discussed Recruiting (in a fairly light-hearted manor) - in particular graduates and the state of the industry with regards to finding good/brilliant graduate and intermediate developers who you can throw at interesting jobs that require a real passion and depth of understanding i.e. writing language parsers, building development frameworks etc.

The jobs we would've liked to have had when starting out ourselves no doubt!

In short it seems very hard to find really talented junior and intermediate developers to throw at highly technical work at the moment in the Auckland region (or contract resources for that matter)... And that salaries (which we've discussed are already too low in NZ for "distinguished" engineers) offered for many intermediate positions are too low to attract the right candidates, I still see some intermediate positions being offered for between $50 to $65K .. I had an $50K+ intemediate position 5 years ago!

Some thoughts included:
  • Getting more involved with institutes before the students graduate i.e. offering 3rd year projects etc.
  • Giving up and outsourcing overseas using a service like rentacoder... or maybe looking to a company like Castle stronghold.
  • Luring people away from open source technologies like ruby/python/php with more money.
Not great conclusions I'm afraid!

I also had planned some discussion around Java & .Net (as mentioned in this post) which we didn't get too - we'll discuss those next time if anyones interested (sounds like something that might be of interest to Peter).

And that's it for another Architecture Chat, thanks to all those who attended, and I'll see you in a couple of weeks time (Thursday 15th November).

BTW - If you have any suggestions for topics next time, please feel free to pass them on, and maybe next time we can move the focus back to some broader architectural topics and get some debate going on :)

Announcements

Quick couple of announcements / reminders:
  1. The CodeCamp BootCamp 2007 is on this weekend in Christchurch (where you can watch Ivan put IronRuby through it's paces, among other things)
  2. André Meurer from Olympic software has organised another Ellerslie DNUG meeting next thursday, details are below:

Microsoft PerformancePoint 2007

Ellerslie, Auckland , Thursday 8 November 2007
Gather at 5:45, starting at 6:00

Presented by: Adam Cogan (Chief Architect at SSW, MVP)

Microsoft Office PerformancePoint Server 2007 is an integrated performance management application designed to help improve operational and financial performance across all departments and all levels of your organization.

With Office PerformancePoint Server 2007, you can monitor progress, analyse what is driving variances, and plan your business from budgeting to creating management reports. You can have metrics, key performance indicators (KPIs), and reports delivered to every desktop through intuitive scorecards, dashboards, and the easy-to-use 2007 Microsoft Office system environment. A key component of the Microsoft Business Intelligence (BI) offering, Office PerformancePoint Server 2007 can help you understand how performance can align with personal and departmental.

http://www.microsoft.com/business/performancepoint/

Click Here to Register


Catering: Pizza & Drinks
Door Charge: Free!
Parking: Free, just park in Olympic Software’s car park

Venue:

Olympic Software
10 Cawley St
Ellerslie
Auckland

Map of venue

posted @ Thursday, November 01, 2007 12:28:37 AM (New Zealand Daylight Time, UTC+13:00)    Comments [7] | Trackback |
 Tuesday, October 30, 2007
Hi All!

The next Architecture chat is on thursday this week, 11:30am at the Sylvia Park in Auckland (at Garrisons).

As always, bring along your thoughts and discussions, and in the mean time here are some possible topics for discussion that have caught my eye over the last two weeks.
  • Java & .Net
    • The IKVM project (Java VM implemented in .Net)
  • Accropolis changes
    • No new previews
    • P&P will provide WPF Composite Client guidance (uh oh)
  • Open source CMS's
  • F# - becoming a first class language in VS.Net
  • PLinq, now GridLinq.
  • Recruiting .Net developers how to/approaches.
And if anyone else has suggestions, feel free to throw me a comment/email etc. and hopefully we can get a few more of the regulars back this week.

See you all thursday!

posted @ Tuesday, October 30, 2007 9:34:41 AM (New Zealand Daylight Time, UTC+13:00)    Comments [5] | Trackback |
Just a quick note that I've put together a small guide on working with the Castle / Nhibernate / RhinoTools trunk here on my wiki, which goes well as a companion to this article on working with the Castle trunk which can be found on using.castleproject.org.

Hopefully it proves useful to someone other that myself.

posted @ Tuesday, October 30, 2007 8:30:36 AM (New Zealand Daylight Time, UTC+13:00)    Comments [7] | Trackback |
 Sunday, October 28, 2007
So, another small turnout last week – but good discussions none the less, with 4 of us in total (Peter, David, Gareth and Myself).

First off we had a talk about ArchAngel, the product that Gareth has architected/written, and what it solves, and around the upcoming release of the new site, as the product moves out of beta – a lot of us have given him grief over the existing DNN site, and it should be good to see it get a face lift ;o) - Following that we talked a little about the challenges of round tripping code, and the problems with a lot of the current MDA/MDG implementations, and how ArchAngel can resolve a lot of pain associated with other code generation approaches due to the holistic approach.  It’s a very exciting product and hopefully at some point a screen cast or two will be made to demonstrate the various features / advantages of the product (hint hint).

I again voiced my frustrations with SharePoint – or "swearpoint" as David coined it, I think much of my problem has been around lack of good documentation, and finding the right combination of tools for doing the job i.e. not using VseWSS projects but instead using WSPBuilder, and getting to grips with the various nuances of deployment packages and the SharePoint 12 etc. folder structure – not the mention the diabolical and misleading exceptions you get at some points – I still haven’t found a good approach of TDD’ing that works across event receivers, web parts, controls etc. that doesn't introduce a large ammount of uncessary complications and abstracts just to make the untestable testable – For the next SharePoint project (if I dare touch another one) I'll definitely take the time to develop a better TDD approach, and probably buy a tool like typemock to assist with it.

I brought up the ASP.Net MVC framework – with the latest wave of information coming after the ALT.Net conference where Scott Guthrie did a presentation... and we discussed how it fits in with web forms, and where it leaves Monorail –based on current observations within the monorail community I believe many would consider moving across to the ASP.Net MVC platform based on what has been presented so far, though the approach and architecture is similar enough that there should be opportunities to easily shim view components etc. To work with both MVC frameworks.

After that we had some rambling discussions about Accessibility (including web browsing for the blind, designing accessible forms, x-forms, tables vs. div’s for web forms and how nothing done for local/central government really conforms with their accessibility requirements, or is even tested for accessibility.

Intertwined with that conversation was the rather slow adoption of WPF (I mentioned some of the points brought up in recent panel discussion that was on .Net Rocks!), WPF & Silverlight control suites and the power of filters and binding, also include in that discussion I briefly mentioned that I’d been working on building a web based workflow designer application using the OpenJacob library (the draw2d javascript library to precise) and Monorail with some success, but would like an off-the-shelf WPF or better yet Silver light toolkit to do the same job.

Last of all we discussed Alex James’s proposed question around thoughts on POCO (plain old code/c# objects) and how important it was to us (in association with ORM's / Domain Driven Design, or at least thats what we talked about).

The thoughts were basically:

  • Single inheritance makes non-POCO based Orm’s a pain to work with in some cases, i.e. there’s a loss of control, and accommodating some scenarios such as MarshalByRef become difficult/impossible.
  • Can often make it harder to enforce correct usage of your domain model, such as aggregates.
  • Depending on the ORM, non-POCO objects are harder to test with in a disconnected manor.
On the flip side:

  • Incorporating concepts like current/previous value can be more natural.
  • Performance / ease of development for the ORM can be simplified when not accommodating POCO.
  • You generally need to rely on proxying and virtual methods to make POCO possible, this can introduce additional complexity and small performance hits both on startup and at run-time (not generally that noticeable).
I also took the opportunity to once again mention PostSharp – which I’ve been using to prototype methods for removing a lot of the repetitive or ugly plumbing code that developers often have to write when developing non-POCO entities.

Oh, and sorry about the late write up! .. Things have been a bit crazy lately and I’ve been hard pushed to find the time to post this till now, I’ll do better with the next chat and try and get that writen up in a more timely manor (a 1 to 2 day turn-around).

Last of all – our next chat is Thursday this week - hopefully we can push our numbers back up to 6 or 8 and catch up with some of the other regulars who haven’t been able to make it over the last month and half - and as usual, if you have any topic suggestions, just drop me a comment/email etc. and I'll bring it up at the next chat.
posted @ Sunday, October 28, 2007 4:38:21 AM (New Zealand Daylight Time, UTC+13:00)    Comments [0] | Trackback |
 Wednesday, October 17, 2007
SmallSpider.jpg

Yes - it's that time again, with another Architecture chat tomorrow, 11:30am at the Sylvia Park in Auckland (at Garrisons).

As always, bring along your thoughts and discussions, in the mean time I thought I would list some possible topics for discussion.
  • ASP.Net MVC.
  • ALT.Net.
  • AOP - Policy Injection / Dynamic Proxies / PostSharp etc.
  • Testing  & TDD combined with Products like SharePoint.
  • SharePoint deployment.
  • Source code available for .Net libraries available.
See you all there tomorrow!

 - Alex

posted @ Wednesday, October 17, 2007 2:20:12 AM (New Zealand Daylight Time, UTC+13:00)    Comments [2] | Trackback |
Search
FeedCount

Tags...
Who am I?
Alex Henderson
Alex Henderson
Auckland, New Zealand
Managing Director at Dev|Defined Limited

"Self Confessed Coding Junky for 15 years"
View Alex Henderson's profile on LinkedIn
 
Mobile: +64-21-402-969
Email: bittercoder 'at' gmail 'dot' com
MSN: bittercoder_nz@hotmail
Skype: alex.devdefined
Navigation