Architecture Chat 18 Tomorrow





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
Read More

Architecture Chat 17

Sorry about the much belated write-up for the last Architecture Chat, been rushed off my feet of late, though a whole week's gone by now ... so the only real excuse could be that I've been a slack bastid.

So, first off... terrible turn out, with only myself and an envoy from Intergen turning up - hopefully not a sign of things to come (small numbers that is, not the intergen guys ;o) and also hopefully not something to put off the Intergen guys from making the trip out this way again (though I suspect Kurt would do it just to get Mexican) - Not to mention Peter losing out on some vital opportunities to introduce Wiki-love to some new comers!

So, as opposed to the usual mixed bag of discussions we focused largely on what tooling and practices Intergen Auckland use (and by comparison myself) - internally it sounds like they have a big drive towards

  • "All sorts of testing"
  • Continuous Integration / Build Servers

So we covered continuous integration (CC.Net) ... make tools i.e. Nant, which has adoption within Intergen, and MSBuild which I use (mostly because I swapped over during the first beta of VS2005, prior to Nant having support for the Framework 2.0, and never moved back) - the key observation was that MSBuild just seems to have very unintuitive syntax - i.e. a Nant build scripts reads a lot more like plain English then a MSBuild equivalent.  I asked if anyone had tried TeamCity, which they had, but without much success (much like my own experience).

Installers were next on the agenda - I'm a big supporter of WiX, though the feeling from  some of the guys at Intergen (and I think many people out in the wild) is that getting a WiX installer off the ground was a cumbersome experience, but on the flip side the "setup" project isn't as friendly when it comes to continuous  integration or support concurrent development (merging setup projects, ugh!) - I expressed my views on the fact that WiX is a hell of a lot easier to maintain once it's in place (i.e. figuring out changes other developers have made), and that making use of tools like Heat that come with WiX can accelerate your development effort quite a lot - Once you have a couple of reference projects with WiX installers it's very easy to rinse and repeat for new projects, or perhaps keep a library of wix templates on a wiki ;o)

Source control cropped up - I use Subversion - From what was mentioned Intergen are using Team System, though TFS does plenty of things SVN does not (Merge history and light-weight labeling appeal to me) - the lack of a good "off line" story still annoyed everyone at the table - maybe once SVN Bridge is half way stable, this won't be such a problem..?

That lead into issue tracking and bug management - where I generally use Trac, though for some clients I'm migrating to Jira (Trac comes across as "to simple" to clients for some reason, especially to dedicated testers, but I'm still a little puzzled as to why, perhaps they just don't get the "wiki" side of things?)

Mingle also came up in conversation - which is a product I'd never taken a look at - after a quick look around the site it looks pretty cool, especially with the source control aspect, I will definitely need to explore it further, though even something with about 80% of its  features as a Trac plug-in would suite my needs ... any readers out there using mingle who can offer an opinion?


I also brought up the news of the  framework code being made available - I'm not really sure it registered, or perhaps there just wasn't a need (we've all got so used to using reflector) ... though at the moment I'd rather have the SharePoint source code then the framework (especially considering parts of the sharepoint framework are obfuscated).

Hopefully next week we'll be back on track for next Thursday with a few of the regulars, or if Thursday is turning into a "bad day" for everyone then perhaps we need to mix it up a little.

See you all there!

Read More

Architecture Chat 17 Tomorrow...

Just a quick announcement.

The Architecture chat is tomorrow, 11:30am at the usual spot... some possible topics for discussion.

  • AOP - Who's doing it day to day, and what tools are available out there for it, partly sparked by my belated look at PostSharp.
  • Sharepoint - yes I'm still on it, and unlike Peter Jones I'm still not loving it all that much (though I don't have the luxuary of MOSS and it's additional features).
  • MonoDevelop is finally in beta - Mono is looking more and more attractive as an alternative, but I'm still unsure I could survive without resharper.
  • Windows 2008 RC is out & Vista SP1 (for select people) - anyone played with them yet?


If anyone else has any topic suggestions then let me know, otherwise it'll just be an open discussion - much like every other time :)

See you there!

Read More

PostSharp 1.0 - First Impressions

Ok so I must've been sleeping under a rock or something, so this is no doubt old news to many people - but PostSharp completely slipped by without me noticing it until now... Having played with it tonight, I'm definitely liking it :)

So far I've just used it for doing some AOP... unlike doing AOP using something like Dynamic Proxy / AspectSharp in Castle, PostSharp gives you a more... personal experience... letting you apply AOP to internal or sealed types, and allowing you to declaratively setup aspects with very little effort... as an example I created a simple little class for recording and playing back methods out of sync... so, first off I have a recorder interface:

public interface IRecorder
{
bool IsPlayback { get; }
void RecordMethod(MethodInfo method, object[] parameters);
}

Following that I implemented a base class for recording the methods, and allowing for playback:

public class BaseRecorder : IRecorder {
private readonly List
_methods = new List();
private bool _isPlayback;

#region IRecorder Members

public void RecordMethod(MethodInfo method, object[] parameters)
{
_methods.Add(new RecordedMethod(method, parameters));
}

public bool IsPlayback
{
get { return _isPlayback; }
}

#endregion

public void Playback()
{
try {
_isPlayback = true;
foreach (RecordedMethod method in _methods) method.Replay(this);
} finally {
_isPlayback = false;
}
}

#region Nested type: RecordedMethod

public class RecordedMethod {
private readonly MethodInfo _method;
private readonly object[] _parameters;

public RecordedMethod(MethodInfo method, object[] parameters)
{
_method = method; _parameters = parameters;
}

public void Replay(object instance)
{
_method.Invoke(instance, _parameters);
}
}

#endregion
}

Pretty basic - then I wrote myself the aspect - it really could not be simpler:

[Serializable]
public class MethodRecordAttribute : OnMethodInvocationAspect
{
public override void OnInvocation(MethodInvocationEventArgs eventArgs)
{
IRecorder recorder = (IRecorder) eventArgs.Delegate.Target;
object[] arguments = eventArgs.GetArguments();
if (recorder.IsPlayback) eventArgs.Delegate.DynamicInvoke(arguments);
else recorder.RecordMethod(eventArgs.Delegate.Method, arguments);
}
}

And finally a demo... so I create a recorder class of my very own and decorate it with the attribute created above:

[MethodRecord]
public class MyRecorder : BaseRecorder
{
public void SayHiTo(string name)
{
Console.WriteLine("Hi {0}", name);
}

public void AddSomeNumbers(int x, int y)
{
Console.WriteLine("{0} + {1} = {2}", x, y, x + y);
}
}

And now a quick demo:

[TestFixture]
public sealed class TryOutPostSharp
{
[Test]
public void RecordAndPlayback()
{
MyRecorder recorder = new MyRecorder();
Console.WriteLine("Starting to record");
recorder.SayHiTo("Alex");
recorder.SayHiTo("Renee");
recorder.SayHiTo("Blog subscribers");
recorder.AddSomeNumbers(10, 20);
Console.WriteLine("Starting to replay");
recorder.Playback();
Console.WriteLine("All done");
}
}

The output is:


Starting to record
Starting to replay
Hi  Alex
Hi  Renee
Hi  Blog subscribers
10 + 20 = 30
All done

Which I think is pretty darn sweet, I can definitely see this having a place in my toolbox in the near future - especially when attempting to uphold DRY in some of my code - anyone using it on production projects in NZ at the moment?

So how does PostSharp pull it off?  Well it post-processes the compiled assembly... it does so by hooking in to an existing extension point in msbuild, so that the post-processor is executed for any project where it references the PostSharp.Public assembly.

All this means that you get to see a couple of extra lines in the build output during compilation:

Compile complete -- 0 errors, 0 warnings
PostSharp 1.0 [1.0.7.261] - Copyright (c) Gael Fraiteur and
Community, 2005-2007.
TryPostSharp ->
C:devexperimentsTryPostSharpTryPostSharpbinDebugTryPostSharp.dll

========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

But how does it really work? Well if we take a look at the list of 7 approaches to AOP Ayende did ... then it fits into the last two (Compile-time & Run-time IL Weaving).

If you have been living under a rock like myself I'd definitely suggest talking 10 minutes out of your day to give it a quick try.

Read More