My new Powershell project

February 20, 2007 on 12:33 pm | In .NET Coding |

Ok, here’s what I’m going to do… Before I had written a compiler for my own query language that is designed to do object persistence on an associative database… I have found now that it would be nice if I could write full fledged ’stored procedures’ and shell scripts that would allow me to encapsulate all of my data code entirely within the realm of a script, including all of the turing complete features of a programing language, like looping constructs, if statements, block level variable scoping etc. As a result, I had first considered implementing a full language from the bootstraps, but instead, I’ve decided that since the Data access business is what I really need, then I’m just going to extend an existing one. I’ve looked at IronPython, and Ruby.CLR, both of which are good candidates, but they are totally different syntactically from anything C based, so I’ve decided to go with something of the C language lineage. Enter Powershell. Powershell is great here, it’s dynamic typed, it allows me to use multiple hash structures to represent object graphs, and it allows me to write new commands that integrate directly into scripts without being first ‘reparsed’ by something else.

I want to do object persistence, and the majority of my objects aren’t two dimensional, and I don’t like ORMapping to represent them, because it’s a ton of unnecessary overhead, and really it will have to flatten, and unflatten them — for what?! ORMapping is for relational data anyway, and this is Associative data, which is natively n-dimensional, and can represent graph structures without requiring silly things like JOINs… so I’m going to go all out on JSON, which also can represent graph structures in its normal format. I will have to either a) find a JSON parser for powershell, or B) write one. I may be able to use the stuff from the new asp.net ajax framework fed into a cmdlet but maybe not… we’ll see about that one. I might be able to use Newtonsoft, and possibly Jayrock, but neither one works exactly how I’d like, for example in the way they handle date parsing, and neither is aware of the structure of existing objects. I’m pretty sure that the ASP.NET ajax JavascriptSerializer IS aware of objects in real life, so I’m hoping all I have to do is wrap that up as a component.

Wish me luck?

2 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Would be great if you could elaborate on a few of parts:

    “neither is aware of the structure of existing objects”

    What do you exactly mean?

    “for example in the way they handle date parsing”

    How would you handle it?

    > JavascriptSerializer IS aware of objects in real life

    What are “objects in real life?”

    Meanwhile, check out the following for some fun JSON fun from within PowerShell:

    Jayrock + PowerShell

    Comment by Atif Aziz — July 1, 2007 #

  2. Ah, sorry I didn’t see this comment till today…

    Anyway ‘real life’ I mean as in the real CLR way of representing them, not a meta-data representation of them or a fake type system (I already wrote one of those once and it was a nightmare)

    I have seen the Jayrock thing before as well as Json.NET. I suppose what I meant by aware of them in real life as being able to deserialize them to the actual objects instead of a JavaScriptObject or somekind of hashtable.

    That’s why I was opting for the one they have in the framework.

    I still haven’t got to this yet, though I have some nice half written archive code staring me in the face in my repository. I have actually been working on stuff for production, which leaves my ‘nice to have list’ pretty long.

    Comment by Dave — July 12, 2007 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^