Sunday, December 09, 2007
So I've been playing with Volta in my spare time this evening - just had a go at tier-splitting a winforms application to see how that works... so I did something pretty trivial, the form has a button, you type a name into a textbox, click the welcome button, it invokes a method on the welcome service and outputs the results to the textbox... I plan to tier split between the client and the underlying service, so that the service could be executed on a "Server".

2_simple_winform.png

public partial class Form1 : Form

{

    public Form1()

    {

        InitializeComponent();

    }

 

    private void welcomeButton_Click(object sender, EventArgs e)

    {

        SomeService service = new SomeService();

        welcomeOutput.AppendText(service.WelcomeMessage(nameTextBox.Text));

    }

}

The service itself looks like this:

[RunAt("Server")]

public class SomeService

{

    public string WelcomeMessage(string name)

    {

        return string.Format("Welcome: {0}", name);

    }

}


Unlike a web-app, you can't seem to use "RunAtOrigin" for indicating a tier-split between client/server - when you think about this makes sense (you could have more then server for a win-forms app, because the "origin" and the client are the same thing, unlike the client (javascript) and origin (web server) relationship that exists for a web app.

Now running the application spins up the Volta test server, if you click on volta icon (btw, cudos to whoever did the volta branding/logos - I love em) in the system tray, you can tick the "log requests" to see what traffic between client/server is occurring... clicking the welcome button shows two requests being made for each button click.

1_log_requests.png

Now moving our eyes towards the tier splitter's output, we can see on the client side that our test service class is converted into a proxy (obviously)

[RunAt("Server")]

public class SomeService

{

    // Fields

    private Guid __id;

    private static ClientMap __map;

    private static string __uri;

 

    // Methods

    public SomeService()

    {

        object[] parameters = new object[0];

        this.__id = Proxy.Call<Guid>(__Serializer.GetInstance(), __GetUri(), "SomeService", 1, null, null, parameters);

        __GetMap().Add(this.__id, this);

    }

 

    private SomeService(__TypeSerializer __typeSerializer)

    {

    }

 

    private static ClientMap __GetMap()

    {

        if (__map == null)

        {

            __map = new ClientMap();

        }

        return __map;

    }

 

    private static string __GetUri()

    {

        if (__uri == null)

        {

            string service = ConfigurationManager.AppSettings.Get("Server");

            if (service == null)

            {

                throw new ArgumentException("Could not find application configuration entry for 'Server'.");

            }

            __uri = ServiceLocation.GetService(service, "__TierSplit.aspx");

        }

        return __uri;

    }

 

    public string WelcomeMessage(string name)

    {

        object[] parameters = new object[] { name };

        return Proxy.Call<string>(__Serializer.GetInstance(), __GetUri(), "SomeService", 0, this, null, parameters);

    }

 

    // Nested Types

    public sealed class __TypeSerializer : AbstractTypeSerializer<SomeService>

    {

        // Methods

        public override SomeService Deserialize(ISerializer serializer, IObjectReader reader)

        {

            reader.ReadSeparator();

            reader.ReadMemberName("id");

            Guid id = new Guid(reader.ReadPrimitive());

            ClientMap map = SomeService.__GetMap();

            SomeService byID = (SomeService)map.GetByID(id);

            if (byID == null)

            {

                byID = new SomeService(this);

                byID.__id = id;

                map.Add(id, byID);

            }

            return byID;

        }

 

        public override void Serialize(ISerializer serializer, IObjectWriter writer, SomeService value)

        {

            writer.WriteSeparator();

            writer.WriteMemberName("id");

            writer.WritePrimitive(value.__id.ToString());

        }

    }

}


And on the server-side, our service has also been altered slightly, note the inner __Service class:

[RunAt("Server")]

public class SomeService

{

    // Methods

    public string WelcomeMessage(string name)

    {

        return string.Format("Welcome: {0}", name);

    }

 

    // Nested Types

    public sealed class __Service : Service<SomeService>

    {

        // Methods

        public override string get_Name()

        {

            return "SomeService";

        }

 

        protected override void ProcessMethod(Service<SomeService>.Call call)

        {

            switch (call.GetMethod())

            {

                case 0:

                    call.Return<string>(call.GetInstance().WelcomeMessage(call.GetParameter<string>(0)));

                    break;

 

                case 1:

                    call.Return<Guid>(call.AddInstance(new SomeService()));

                    break;

 

                default:

                    throw new InvalidMethodException();

            }

        }

    }

}


Now what about those two requests - looking at the code we can deduce that the two calls are occurring first for construction/registration of the client proxy, and second for handling the message - changing the client app to look like this:

public partial class Form1 : Form

{

    SomeService service = new SomeService();

 

    public Form1()

    {

        InitializeComponent();

    }

 

    private void welcomeButton_Click(object sender, EventArgs e)

    {  

        welcomeOutput.AppendText(service.WelcomeMessage(nameTextBox.Text));

    }

}


And clicking the welcome button fixes the behavior, so that for successive button clicks only one request is being generated.

Afraid that's all I have time for tonight... but I'll post more about my Volta explorations this week when I get spare moments.
posted @ Sunday, December 09, 2007 10:08:19 AM (New Zealand Daylight Time, UTC+13:00)    Comments [0] | Trackback |
 Thursday, December 06, 2007
So plenty of subjects today, though a small’ish turn-out, kinda goes with the time of year, and is probably also related to the bar camp Agile down in Wellington tomorrow, which I know at least one of the regulars is heading to.

Code protection and obfuscation was floated by Garreth – sparked off by his need to find a new code protection production, as the product he currently uses doesn’t appear to be under development any longer (.Net Reactor I believe was the product).

In fact, it’s worse than that – he suspects that the Author may have had an accident or something similar, because the releases stopped a few months back and the Author is no longer replying to questions or queries on the forum, but prior to that was a very active individual - He can’t even be contacted by cell phone.  Incidentally if anyone reading this knows of the Author or his fate personally, we'd love to find out more.

Right - so deploying key logic on web-services and some of the alternative licensing products having a requirement of a windows service being installed alongside the product got discussed, with the good and the bad points - it was interesting to see that most of us didn't mind having a windows service installed on our machine to license the product, as long as it was well behaved and made it abunduntly clear that this was being done by the product, and was named/described well (so you knew just what it was) - Garreth just wanted to confirm this with some fellow developers because he's looking into a range of products including PRO-Tector from Nalpeiron that uses this approach, and was worried he might get too much "kick back" from his target customers (i.e. other developers).

From there we moved onto obfuscation products – we’ve talked about these before, including Dofuscator and SmartAssembly which came highly recommended from Andrew @ Mindscape.

All of this rounded up with a discussion around “should you even bother obfuscating” and the rationale behind Microsoft obfuscating key portions of their technologies such as SharePoint or Dynamics CRM (i.e. not just protecting IP, but perhaps protecting volatile and undocumented behaviour which you might leverage or rely on which could be broken easily between service packs for even the same version of the product).

Garreth also recommended Kagi that none of us had heard of – which is a great e-commerce solutions/services provider that goes above and beyond using alternatives like Paypal or local credit card merchants, key differentiating points he made were:

•    It takes care of varying Tax legislation etc. so you don’t personally need to think about collecting VAT etc. - because they act as a "reseller' for your product.
•    Supports non-electronic processing i.e. Cheques, purchase orders, direct debit etc.
•    Entirely customizable UI, can be entirely gutted and made to look like your own site.
•    It understands selling Software and digital content, and provides call backs so you can integrate custom license generation etc.  Within the payment site and provisioning workflow.

It could be just the ticket if your thinking of selling some software and don’t want to completely roll your own solution.

Next I ran quickly through the various product announcements etc. over the last 3 weeks - We pretty much bypassed everything and headed straight to Silverlight 2.0 and Volta (VS2008 is old news already, though the Isolated VS2008 Shell got a mention, however most were shocked at the size of the redistributable component – 315MB – that’s a big ask if you want to leverage it for a simple product/project).

I was also hoping to get back to talking about the ParalellFX CTP which I’ve also been playing around with – but never got the opportunity.

So Volta has featured in previous discussions – some of us didn’t even imagine it would see the light of day – yet we now have a preview in our hot little hands which can be played with – I took it for a test drive this morning, and miraculously it works!?

With naught but an attribute I was happily able to move code between my client script and server... We discussed the implications of this, the intended audience (It looks very appealing to existing win forms developers who have resisted until now from engaging a web platform, because it feels very "familiar").

I’m quite keen to take an existing windows forms application and see how easily I can move from thick client to web client/server using this approach i.e. just how much of the existing code base, event driven structure etc. can be maintained – even in its current state I think it could do a pretty good job of converting some winforms apps I've built in the past, short of re-implementing complex visual controls.

Things I've still yet to try:
  • Unit testing with NUnit (can't see why it wouldn't work though)
  • Introducing additional tiers i.e. tier splitting between an application server, webservice and client script (not sure this works when using Visual Studio at the moment - the release notes suggest "no", so will probably require some spelunking and command line compilation at this stage.
We talked about Silverlight 2.0, its release date (probably near the end of Q1 2008) - and just what ships and what doesn’t i.e. is there a compiler and does it live on the server, extensible control model, 2-way data binding etc.  Certainly Silverlight 2.0 is looking very comprehensive, and the Silverlight team look to have been/are very busy (I wonder how on track the Moonlight team are, considering the surface area of things to develop has grown somewhat from the original 1.1 scope).

Next we talked about DSL’s ... what makes a DSL... the stages of DSL’ness from the “barely there” Fluent interface, through to varying grades of internal DSL and finally a custom language which requires parsing into a syntax tree (which F# is great for I think) and being consumed by your application, or a Visually depicted DSL, ah-la Microsofts DSL SDK for VS.Net.

In the same conversation we also talked about operator overloading, making things explicit, avoiding operators all together (i.e.  “A == B” is far less meaningful in relation to a domain specific language then "A.Equals(B)" or even better “A equals B” – i.e. being terse may prevent your DSL from being explicit enough to be read by the people who best understand the domain language and the concepts it's modeling to begin with. 

We also talked about the things which make a internal DSL work well with languages like Boo i.e. the ability to drop braces, and whitespace awareness (which I hated, but I’m gravitating back towards liking it once more in the right context, because a couple of spaces is a lot nicer to read then opening/closing braces and associated visual noise - and it’s easier to show the raw code to clients when discussing problems because it’s less confusing).

Along the same line we talked about operator overloading conventions and on a side note Peter gave Algol a mention for having such wonderful (!) set of operators and needing a special keyboard or a memory for keystroke combos ;o)

¬, ?, ?, ?, ?, ×, ÷, ÷×, ÷*, %×, ?, ×:=, ÷:=, ÷×:=, ÷*:=,  %×:=, ~ ?, ?,÷::=,:?:, :,::, ::=...

He also mentioned Postscript, though I don’t know much about its operators etc. and didn’t really feel like digging up some samples from the red book.  Incidentally F# lets you define new operators:

let ( <:-> ) a b = string.Format("{0} is happy about {1}", a, b)

let ( <%=> ) a b = string.Format("{0} is confused by {1}", a, b)

 

let m = "mort" <:-> "user defined operators"

let n = "but mort" <%=> "his own code"

 

let result = Console.WriteLine("{0}, {1}", m, n)


Which of course displays:

mort is happy about user defined operators, but mort is confused by his own code.

From there we branched into discussing multi-language projects – i.e. why do we need to have separate languages in separate assemblies... a lot of us fondly remember the old days of in-line assembler, and would like opportunities to use a language like F#, Boo or one of the DLR based languages in-line within a C# or VB.Net project – i.e. within the bounds of a function/method... I see F# pattern matching as a great example of where this would be really handy – same goes for embedding your own DSL’s in-line, or even leveraging a few lines of concise ruby code to do some string manipulation.

I suggested a compiler model much like Boo’s would work well in allowing this to happen – though there are issues with just how you compile it, approach merging the separate chunks of IL etc. and cross-referencing.

PDF file parsing got discussed - there is a binary and text based standard (which is largely human readable) – Peter suggested that ABC PDF is very good at pulling apart PDF documents for information extraction in the Enterprise edition, and also supports CMYK colour, useful if you’re working with professional printers.  Because there isn't much metadata stored in many cases, you often have to rely on specific style information to identify key bits of content.

We then had a talk about model driven architecture, and in particular, integrating UML models, code and business related information such as device and install inventories, and product life cycle information - we're finally starting to see some traction in New Zealand in this space, and it's ushering in the rise of the true "Enterprise Architect", with people becoming more aware of frameworks for Enterprise Architecture such as Zachman, TOGAF etc. and realizing the true value of driving from an ultimate and largely strategic high-level organizational model of past, present and future systems (including when certain systems are going to be retired), all the way down to individual applications, business processes, use cases, test scripts/runs, classes, unit tests, machine inventories and even live application data that can be used to be make decisions... even as a develop this has real value, i.e. integrating with a system you could identify how many systems integrate with it, when it's due to retired/replaced/upgraded, maybe how many transactions it's processing, or how often it refreshes itself with key business data from other parts of the organization.   I saw a nice example of this just last week at the EA Symposium presented by IAG.

It's definitely a subject I'd like to visit again in the future, and perhaps we can get one of the NZ experts in this field to come and participate such as Lukas Svodba (who also runs the arcast.co.nz site) - this also ties in with MDA and MDG, The later of which I'm still having difficulty reconciling with a largely agile test driven development process.

Also on that note I mentioned the JetBrains meta programming system and wondered if it will ever reach a v1 status, I had high hopes for it a couple of years ago.  It doesn’t seem to have had much activity associated with it over the last couple of years (I almost wonder if it was largely an Idea which was well before it’s time for a lot of the .Net community, that are only now starting to appreciate DSL’s and considering working/developing at a higher level of abstraction – or lower level if you look at it from the perspective of the problem your trying to solve i.e. closer the metal of the problem domain itself).

We pretty much wrapped it up there, so that’s year 1 of the Architecture Chats brought to a close (we decided against one more for this year, because of the holidays and not to mention our venue being overrun with rampant shoppers, probably removing any chance of finding a park or hearing ourselves think!)

Big thanks to Alex James (Meta me) for getting this chat off the ground, and thanks to all the regulars who come along every fortnight – you’ve all helped to make the Architecture chat one of the most successful and interesting recurring events I’ve had the pleasure of attending/participating in – and it’s been great to have been able to swap ideas and information over the last year.

Have a merry Xmas and a happy new year one and all!

posted @ Thursday, December 06, 2007 2:14:25 AM (New Zealand Daylight Time, UTC+13:00)    Comments [0] | Trackback |
 Wednesday, December 05, 2007
Well this blog, the wiki and all the other associated services disappeared for most of today... thanks to the magic of NoAuth ... for no reason that anyone could explain to me beyond "it sometimes happens" - Orcon lost Authority over my business DSL connection, and it reverted back to Telecom/Xtra (New Zealands "legacy" telco)... and it took must of today for them to get the authority changed back, I don't think this was any fault of Orcons, but it still pissed me off no end.

So appologies to anyone wondering where my blog went, or any of the related services - I do have plans to migrate the blog to US servers in the not to distant future.  And big appologies to all the Architecture chat participants, sorry I couldn't get a reminder email out sooner.

On a different note - It did identify a need for me to maintain a secondary connection, with a static IP, that I can fall back to if required... thankfully the three concurrent projects that have been in UAT over the last couple of weeks have all wound down now - so it didn't have as much impact as it could of.

Though at least they wouldn't have been able to log bugs about servers being unavailable, Trac would've been unavailable too ;o)

... so any suggestions as to what would make an adequate fall back technology (something other then DSL, I've used wired country two-way-radio to the sky tower in the past which has worked well, but it doesn't give much "bang" for buck and has a high up-front cost last time I checked) ... I'm not too worried about 1 day downtime, but if this had been 3 or 4 days it would've been quite damaging for me, customers and those intangibles like reputation.


At any rate - thanks for the patience, and I'll see some of you at the Architecture Chat tomorrow.

Cheers,

 - Alex
posted @ Wednesday, December 05, 2007 10:34:04 AM (New Zealand Daylight Time, UTC+13:00)    Comments [1] | Trackback |

That's right, it's time for another Architecture chat Tomorrow

So as I mentioned last week - The Architecture chat is being held this thursday, 11:30am at Sylvia Park in Auckland (at Garrisons), all are welcome and encouraged to come along and share your views.

Some topics / announcements that have taken my eye over the last 3 weeks which might make good discussion fodder:

And some conversational topics related to what I've been working on lately...

  • Agile model driven development and just how can you combine model driven architecture (MDA) with test driven development and code-level refactoring.
  • Writing parsers using F#, leveraging pattern matching & Active Patterns – and integrating with other languages like C#.
  • Visual DSL’s – the good and the bad, and at what point does it become justifiable to roll your own for specific business needs?
If anyone has any topic suggestions either leave a comment or email/IM me (IM details are on the left, in the "Who am I?" section).

See you all tomorrow!

Edit: and as a late edition, I've also had a play/look into the very recently released Volta if anyone is interested - if you've got the time before xmas, I'd definitely suggest doing their quick start tutorial - interesting.

posted @ Tuesday, December 04, 2007 8:14:16 PM (New Zealand Daylight Time, UTC+13:00)    Comments [0] | Trackback |
 Sunday, December 02, 2007
So a quick observation on the alt.net conference list:

"You’ll be happy to know then that in the new WPF Composite work we are doing, the DI/IOC mechanism will be decoupled and pluggable. Actually the next version of Entlib will be the same. There’s a new Dependency Injection block that will allow you to plug-in the container of your choice."

Which was posted on the alt.net conference yahoo list by by Glen Block from Microsoft.

I think this is very good news, at least for the WPF composite work they're doing - it might make it a great deal more appealing to me then the CAB was (I was never a big fan of the CAB because it didn't integrate well with the other stacks of technologies that made me productive).

I'm fairly ambivalent about the Enterprise Libraries upcoming pluggable IoC support however - surely the overlap between it and the facilities and services already provided by the IoC container you'd be plugging into would be great ... and IoC is only part of that story... for a number of common services (i.e. logging, transactions etc.) you're going to have create appropriate wrappers and sandwich things into the containers "abstracted" view of the world, or face tightly coupling your application to the Enterprise Library, I'm not sure there is much of a value proposition there... though I'm open to being educated if any P&P Microsoft people happen to read this.

Interestingly enough has picked up on this slip from Glen and noted that it also implies Microsoft are writing yet another IoC container that will probably ship with EntLib & the WPF composite work (in whatever shape it eventually takes) and they ask the question "why oh why!" .

Personally I think it makes good sense to provide an out of the box IoC container, with it the product is far more accessible to new developers and people reviewing the technology - especially when you consider that:
  • If support was added into say the Castle Windsor container, it wouldn't see an official release until RC4 was made public - and until then would be in a state of flux as part of the castle trunk.
  • People would expect Microsoft to "suggest" an OSS container that works best with their offering - and playing favorites with the .Net OSS community could only do harm to the ecology I feel.
  • Microsoft retain consistency with their existing approach of providing an entire stack of technologies for you to get the job done, if that's what your like/want or are told you want. 
  • They can provide a set of consistent tutorials and training materials for developers to "get up to speed" with for the product, without having to provide umpteen alternative examples for different containers, or explain why the container terminology is slightly different to the product terminology.
So in short, I think it's a positive sign, not a negative one, even if another container is introduced into the mix - I'll be interested in seeing just how they do it (both the container, and the extension points to allow for plugging in a different container)... Though it could just be a hack using IServiceProvider, I wonder if perhaps they may need to go a bit further, so they can register services into the plugged in container with the appropriate lifestyle and configuration etc.

Edit: I just noticed Ayende posted about this as well...  he seems pretty well aligned with the "why oh why" viewpoint, perhaps I'm missing something - but I just don't see it being all that practical in some scenarios to provide a product that wont work without the developer going through a separate selection process to pick an IoC container, if they don't already use one from the OSS community.
posted @ Saturday, December 01, 2007 11:08:07 PM (New Zealand Daylight Time, UTC+13:00)    Comments [1] | Trackback |
 Friday, November 30, 2007
clock_stopped.png

My vista64 clock has stopped in the system tray... the funny thing is Renee (My Fiancee for those who don't know) has been asking me for the last half hour what the time is... and I've kept responding almost 11:30...

I hope they fix that in Vista SP1 - Damned if I'm getting a wall clock for my office!


posted @ Thursday, November 29, 2007 11:13:43 AM (New Zealand Daylight Time, UTC+13:00)    Comments [2] | Trackback |
 Thursday, November 29, 2007
So I'm learning F# in my spare time... I don't have much of that however.. so I kinda squeeze it in where I can, so I'm not progressing as fast I would like... None the less it's quite an easy language to get up to speed with, even as I stab at it blindly for half an hour a week... but some fundamentals can really trip you up when you're starting to learn and experiment without having developed a good mental model of whats going on... being a wannabe "expert" in the .Net framework and BCL doesn't necessarily give you much of edge when your moving from an imperative to functional programming language.

To that end this post is going to cover some really trivial observations, so for anyone that actually knows F# it's probably going to be pretty boring... and you might as well read something else ;o)

Anyway.. so, first off lets take evaluation order.

In C# I might write some code like so...


char
[] characters = new char[] { 'A','B','C','D','E'}

 

foreach (char c in characters)

    Console.WriteLine("character: " + c);


Now in F# I could write something similar...


let
characters = [| 'A'..'E' |]

 

for c in characters do

  print_endline "character: " + c.ToString()


But it wont compile... because it's evaluated/applied from left to right, so it equates to (print_endline "character:") + c.ToString() ... which can't compile because print_endline returns a result of type 'unit' (think void... though it is actually a return value)... thankfully it's a compiled language so these things are picked up immediately - but it can make for silly/confusing compilation errors when starting out.

Now, moving on from there.. past experience has also helped screw up my mental model... for example iteration related functions - if I was going to write an iteration function in C# the approach would generally be to do something like this:


public
void ForEach<T>(IEnumerable<T> items, Action<T> action)

{

    foreach (T item in items) action(item);

}

 

string[] words = new string[]

{

    "somewhere", "on", "earth", "little", "kids", "teach", "themselves",

    "a", "whistling", "sound", "to", "imitate", "bombs", "dropping"

};

 

ForEach(words, delegate(string s) { Console.Write(s + " "); });


I had the expectation of finding replicas in the F# built-in functions like List.iter etc. - in fact I even wrote code like this to start with, assuming it would work in the same manor.


List.iter words (fun word -> print_string (word + " "))


After that didn't compile I just swapped the parameters... it worked... but I saw some unusual behavior when stepping through it with the debugger... and it required further inspection... looking at the signature for List.iter revealed that it was actually a function that returned a function ...  ('a->unit) -> (list 'a -> unit)... hmmm..

So it turns out most of the built-in functions take a single function and return a function... so unlike the C# equivalent, the F# foreach would look something like the code below (though I suspect an F# guru might be able to write it in a more terse manor).


let
words = [ "somewhere"; "on"; "earth"; "little"; "kids"; "teach"; "themselves";

    "a"; "whistling"; "sound"; "to"; "imitate"; "bombs"; "dropping" ]

 

let foreach f  =

  let rec foreachInList l =

    match l with

    | head :: tail ->

      f head

      foreachInList tail

    | _ -> ()   

  foreachInList

 

let n = foreach (fun word -> print_string (word + " "))

n words

 

// or

 

words |> foreach (fun word -> print_string (word + " "))

 

// or

 

foreach (fun word -> print_string (word + " ")) words


It took me a minute or so of going hmmmm to absorb the beauty of that approach... obviously this is bread and butter of a functional programmer, but for a non-functional programmer like myself you tend to just see twice as much "work" going on (two function calls for starters).

Take a look at the second way of calling foreach... in this case |> applies the RHS as a filter on the LHS... because the function takes a single parameter we can do this easily.. but we can also chain them together... so we could alter our foreach function a smidgen:


let
foreach f  =

  let rec foreachOnList l =

    match l with

    | head :: tail ->

      f head

      head :: (foreachOnList tail)

    | _ -> [] 

  foreachOnList


So it's signature is no longer ('a->unit) -> (list 'a -> unit) but is instead ('a->unit) -> ('a list -> 'a list) ... now I can chain calls to my foreach together...


words
|> foreach (fun word -> print_string (word + " "))  |> foreach (fun word -> print_string (word.ToUpper() + "_"))


I really enjoy the elegance and simplicity of the filter syntax... if you replace the anonymous functions with functions you've already declared it suddenly becomes pretty, I think it reads nicer then chained extension method calls / fluent interfaces in C#.


let
capitalize (c: string) = c.ToUpper()

let pad c = c + " "

 

words |> List.iter (fun word -> word |> capitalize |> pad |> print_string)


At any rate, my half hour of F# exploration is up for the week.

posted @ Thursday, November 29, 2007 9:08:32 AM (New Zealand Daylight Time, UTC+13:00)    Comments [0] | Trackback |
 Wednesday, November 28, 2007
I came across this blog entry and to me at least, it just seems wrong?

To quote:

"These are two very different uses of the term that I've heard and both are explicitly not "automatically" in the true sense of that word. The point of automagically is when its not automatic at all and either you don't care (case one) or its a lie (case two). Now if people agree I'll update the wiki entry but I thought I'd first check what others had seen."


Perhaps I've been misinterpreting the use of the word, but In development circles I've always taken it to mean a process that does work automatically, as if by magic - potentially with a hint that there is definitely "magic" involved, i.e. perhaps what's happening automatically is not deterministic or a little dodgy (a hack), or is is in some way cool/extraordinary i.e. table names being pluralized automagically from their associated entity class names in an ORM, which when I first saw it done many years ago was "magic" by comparison to having to specify the pluralized names by hand.

Is this really a negative term suggesting that somethings not automatic at all? Is my whole life a lie? (Don't answer the second one ;o)
posted @ Tuesday, November 27, 2007 9:01:55 PM (New Zealand Daylight Time, UTC+13:00)    Comments [2] | Trackback |
stump
I’ve seen a few posts flying round between Ivan (1,2) and Ayende (1) re: meta programming in C# v.next and the implications of it being a statically typed / pre-compiled language...

It’s an interesting thought, but I can’t help wondering if implementation of a rich meta-programming environment in C# - allowing changes at both a class and instance level at run-time - wouldn’t go against the original spirit of the language itself, for me at least I’d be looking for a different language if I yearned for meta programming on a daily basis... one that was built from the ground up with my desires in mind.  Take a moment to consider if C# had been built with meta-programming in mind from the outset, would we have bothered with declarative attributes?... ruby seems to get on fine without them (well at least until you try to integrate ruby with Java or .Net libraries)... and what about interfaces, what’s the point of them?

Language spirit is an interesting thing – I don’t think it’s something intangible (this is science after all), but often it’s something that’s difficult to put into words, because it’s a feeling coming up from a rapid and subconscious judgement call as you work with a language (ah la Blink) – it’s also something that’s difficult to appreciate until you start sitting down and thinking about writing a programming language of your own (what you haven’t? For shame!)... and it builds an immediate appreciation for languages like C# and ruby and there founders – there are lot of difficult decisions, compromises and reasonable defaults that need to be decided on – and a massive amount of jiggling to make sure it all fits well together – so that you can finally identify the essence of the language – and worst of all you’re not just having to satisfy your internal subconscious judgement calls, but a large audience in the development community, so that your language will be adopted by people because it feels "right" to them.

I still gravitate towards programming language pragmatics as a good book for examining the spirit of languages throughout the years and guises – it's definitely a book computer science student’s should all be armed with on their first year, though I doubt many will be interested in the nuances of Fortran today.

Now, following up on that – I’d like to contrast meta programming with functional programming... are we in need of meta programming as we move towards a more functional approach by necessity (to reduce the overall complexity of software, and take better advantage of existing/emerging hardware by working at a higher level of abstraction, allowing for judgment to be made on our behalf i.e. about parallelization) and what makes more sense for a language like C#?

Personally I see C# moving more and more towards providing a pleasant bridge language between the imperative world and the purely functional word (weighed in favour of the imperative world, where as F# is weighed in favour of the functional world) ... and as such it makes more sense to me at least to draw inspiration from that domain, then dynamic languages and meta programming... just my opinion of course. 

Given the time frames between C# versions – IronRuby should be mature enough by the time c# v.net arrives that it should be a moot concern, and IronPython is already pretty capable in the meta programming stakes as well, if you can hack the whitespace sensitivity.

Funnily enough (and this a bold claim I know :) – but I think the pattern matching support and associated features in F# would prove far more valuable tools for solving many of my day to day problems in C# than meta programming would be, when I take a subjective look at the code I write and the goals it’s generally trying to achieve combined with the existing features and practices I’ve already embraced in C# (IoC/DI) it looks to "click" together in a much more cohesive manor.

Thoughts?
posted @ Tuesday, November 27, 2007 8:01:50 PM (New Zealand Daylight Time, UTC+13:00)    Comments [0] | Trackback |
 Tuesday, November 27, 2007
Just a quick note that the Architecture chat that was scheduled for this thursday is going to be postponed until Next Thursday (December 6th) because I'm unavailable this week.

I'll post about it and email the dot.net.nz user group (for you non-subscribing philistines :) next week to remind you all.

See you all next week!

posted @ Tuesday, November 27, 2007 9:15:32 AM (New Zealand Daylight Time, UTC+13:00)    Comments [0] | 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