Boo

Why I HATE editing?

I have just finished 2nd pass editing all the chapters and appendixes for my DSL book. This has been, I think, the 1,390th time that I had gone through the book since I finished writing it. Luckily for me, this appears to be the end, there is the final printer proofs stage, and then I’ll truly be free. One of the things that I wasn’t told about when I agree to write the book is just how many times I would have to read it. I think that I am good writer (God knows that I get enough practice),...

posted @ Saturday, October 31, 2009 12:00 PM | Feedback (6)

Building Domain Specific Languages with Boo – Full book now available

Building Domain Specific Languages with Boo Another big milestone, early access subscribers can now read the entire book, all 13 chapters and both appendixes. Not edited yet, but much closer to completion.

posted @ Monday, March 02, 2009 2:22 AM | Feedback (11)

Boo Lang Studio 1.0 Alpha it out!

Jeffery Olson has just made the first release of Boo Lang Studio available. This one comes with a "Yes, Dear" installer. Yeah, we have Boo installed! Let us create a new project: And take a look at the code: And intellisense works as well, whew! Jeffery Olson and James Gregory: THANKS!

posted @ Friday, August 22, 2008 9:14 PM | Feedback (10)

Nicer Linq

A few days ago I posted about Ugly Linq. Ever since then, I kept thinking about how ugly it is to handle this by hand. Suddenly, it hit me that I don't have to do it that way. Boo already has the facilities to take a compiler AST and translate that into the code that would recreate this AST. In particular, this makes the code we previously had to write to this: public class ConditionMacro : AbstractAstMacro { public override Statement Expand(MacroStatement macro) { Expression serialize = new CodeSerializer().Serialize(macro.Arguments[0]); var body = new Block(); body.Statements.Add(new ReturnStatement(macro.Arguments[0])); return new ExpressionStatement( new MethodInvocationExpression( AstUtil.CreateReferenceExpression(typeof(Condition).FullName), new BlockExpression(body), serialize ) ); } } And what...

posted @ Thursday, August 14, 2008 5:43 PM | Feedback (4)

Ugly Linq

One of the things that always bothered me with Linq was that it is actually not an interesting idea from the compiler perspective. I just had to implement a very simple expression to expression tree converter, which only served to strengthen my opinion. Here is the (ugly, proof of concept, horrible) implementation, using the Boo AST: private static Block Linqify(Expression expr) { var block = new Block(expr.LexicalInfo); ReferenceExpression condition = AddCondition(block); Parse(block, condition, expr); block.Add(new ReturnStatement(condition)); return block; } private static ReferenceExpression AddCondition(Block block) { var condition = new MethodInvocationExpression(new ReferenceExpression("Condition")); var expression = new ReferenceExpression("condition_" + CompilerContext.Current.AllocIndex()); block.Add( new BinaryExpression( BinaryOperatorType.Assign, expression, condition) ); return expression; } private static void Parse(Block block, Expression condition, Expression...

posted @ Tuesday, August 05, 2008 2:02 AM | Feedback (3)

Simple State Machine

Nathan has posted Simple State Machine to CodePlex, it is the first project that I am aware of that uses Rhino DSL and the techniques that I am talking about in the book. What is impressive about this is the level of professionalism that is involved in the project. It is a full scale DSL, with all the supporting infrastructure. I spent half an hour or so going through the entire thing, and I am impressed. Put simply, this is how I think state based work flows should be defined. I could easily see myself extending this a...

posted @ Saturday, May 31, 2008 12:15 AM | Feedback (10)

BooLangStudio: Boo in Visual Studio

A few days ago, the BooLangStudio was announced in the Boo mailing list, bringing Boo support into Visual Studio. Below you can see several screen shots. And you can find out more about it here. This is a very promising move, especially since I soon have to write my tooling chapter :-) Of course, this is still very early in the game, but it is good to see progress in this area again.

posted @ Friday, May 30, 2008 11:16 PM | Feedback (7)

The magic of boo - Flexible syntax

when I am writing DSL, I keep hitting one pain point. The CLR naming conventions, which are more or less imprinted on my eyelids, are not really conductive to clear reading in a DSL. Let us take these entities, and see what we get when we try to build a DSL from them: The DSL is for defining business rules, and it looks like this: when User.IsPreferred and Order.TotalCost > 1000: AddDiscountPrecentage 5 ApplyFreeShipping when not User.IsPreferred and Order.TotalCost > 1000: SuggestUpgradeToPreferred ApplyFreeShipping when User.IsNotPreferred and Order.TotalCost > 500: ApplyFreeShipping The main problem with this style of...

posted @ Tuesday, May 27, 2008 11:30 AM | Feedback (12)

Zero friction IoC: Auto registration is mandatory

This is the entire Binsor config file for a real application: import Castle.MonoRail.Framework import Castle.MonoRail.WindsorExtension import Rhino.Commons.Facilities from Rhino.Commons.ActiveRecord facility MonoRailFacility facility RhinoTransactionFacility facility ActiveRecordUnitOfWorkFacility: assembly = "HibernatingRhinos" for type in AllTypesBased of IController("HibernatingRhinos"): component type.Name, type for type in AllTypes("HibernatingRhinos").WhereNamespaceEq("HibernatingRhinos.Services"): component type.GetServiceInterface(), type And I am pretty confident that I am not going to have to do much in the future with those. And yes, you can do it with the fluent registration API as well.

posted @ Tuesday, May 13, 2008 4:08 PM | Feedback (6)

Binsor & Auto Registration - Making it even simpler

Here is the syntax that I am getting at... for type in AllTypesBased of IView("Rhino.Commons.Test"): component type for type in AllTypesWithAttribute of ControllerAttribute("Rhino.Commons.Test"): component type for type in AllTypes("Rhino.Commons.Test") \ .WhereNamespaceEq("Rhino.Commons.Test.Binsor"): component type for type in AllTypes("Rhino.Commons.NHibernate") \ .Where({ t as System.Type | t.Name.Contains("NHRepository") }): component "nh.repos", type.GetSeriveInterface(), type And this seems to cover just about any scenario that I can think of. Combine that with Binsor's extend facility, and we are more or less done.

posted @ Tuesday, May 13, 2008 8:21 AM | Feedback (3)

Setting up MonoRail Windsor Integration with Binsor

I think I'll let it stand on its own: facility Castle.MonoRail.WindsorExtension.MonoRailFacility for type in AllTypesBased of Controller("HibernatingRhinos"): component type.Name, type Done. I didn't believe it, to be fair.

posted @ Tuesday, May 13, 2008 7:17 AM | Feedback (2)

Course: Building Domain Specific Languages in Boo

You can register here for a two days course in building DSL with Boo. It is going to take place two weeks from today, in Austin. (19 - 20 May) I know that this is short notice, but it wasn't something that was planned well in advance. It came out of the ALT.Net conference. Topics: Creating Domain Specific Languages The Boo Language Flexible compiler and malleable language Creating applications with embedded DSL Management, tracing and debugging Tooling support Testing and maintainability concerns There are ten seats open for that. I hope we would have fun. I would also like...

posted @ Tuesday, May 06, 2008 4:33 AM | Feedback (5)

DSL Article on InfoQ

My DSL article has been published on InfoQ! You can get it here

posted @ Monday, April 21, 2008 7:10 PM | Feedback (13)

Loop unrolling in Boo

// We create a class for the macro, the class name is // meaningful, [macro name]Macro allows us to later refer // to the macro using just [macro name]. // Note that we inherit from AbstractAstMacro class UnrollMacro(AbstractAstMacro): // Here we perform the actual compiler manipulation // the compiler hands us a macro statement, and we have // to return a statement back, which will replace it. override def Expand(macro as MacroStatement) as Statement: // define a block of code block = Block() // extract the second parameter value end = cast(IntegerLiteralExpression, macro.Arguments[1]).Value for i in range(end): // create assignment statement, using the block: trick // and add it to the output statements = [| block: $(macro.Arguments[0])...

posted @ Wednesday, April 02, 2008 1:05 PM | Feedback (3)

The quote generation DSL

I am doing some work on the DSL book right now, and I run into this example, which is simple too delicious not to post about. Assume that you have the following UI, which you use to let a salesperson generate a quote for your system. This is much more than just a UI issue, to be clear. You have fully fledged logic system here. Calculating the total cost is the easy part, first you have to understand what you need. Let us define a set of rules for the application, is will...

posted @ Monday, March 31, 2008 1:51 AM | Feedback (7)

A web server in 30 lines of code

Just found myself writing that, and it was amusing. import System.Net import System.IO if argv.Length != 2: print "You must pass [prefix] [path] as parameters" return prefix = argv[0] path = argv[1] if not Directory.Exists(path): print "Could not find ${path}" return listener = HttpListener() listener.Prefixes.Add(prefix) listener.Start() while true: context = listener.GetContext() file = Path.GetFileName(context.Request.RawUrl) fullPath = Path.Combine(path, file) if File.Exists(fullPath): context.Response.AddHeader("Content-Disposition","attachment; filename=${file}") bytes = File.ReadAllBytes(fullPath) context.Response.OutputStream.Write(bytes, 0, bytes.Length) context.Response.OutputStream.Flush() context.Response.Close() else: context.Response.StatusCode = 404 context.Response.Close()

posted @ Sunday, March 30, 2008 10:35 PM | Feedback (5)

Short yet interesting: in search of a sample

One of the feedback points that I got about the book was that there need to be a fully working Boo program, before we start to introduce the DSL ones. The problem? I can't think of anything that will be both interesting and short enough to put into a book. My limit is at about two pages, and I don't want a tedious example. Any suggestions? One major point, it should have as little background assumptions as possible.

posted @ Thursday, March 06, 2008 6:38 PM | Feedback (7)

From BooBS to Bake

Okay, I renamed Boo Build System to Bake. Now you can cut the jokes and actually integrate it into a PC environment. The repository is here, although you can just grab the binaries.

posted @ Saturday, January 26, 2008 11:11 PM | Feedback (7)

Boo: Design By Contract in 20 lines of code

Now, before Greg hurls a modopt on me, I want to be clear that this isn't the same thing that Spec# is doing. But it is a very cool way to specify constraints that must always be valid when a method exists. Here is the code: [AttributeUsage(AttributeTargets.Class)] class EnsureAttribute(AbstractAstAttribute): expr as Expression def constructor(expr as Expression): self.expr = expr def Apply(target as Node): type as ClassDefinition = target for member in type.Members: method = member as Method continue if method is null block = method.Body method.Body = [| block: try: $block ensure: assert $expr |].Block And the usage: [ensure(name is not null)] class Customer: name as string def constructor(name as string): self.name = name def SetName(newName as string): name = newName Now, any attempt to set...

posted @ Saturday, December 22, 2007 2:08 AM | Feedback (11)

Meta Methods

A meta-method is a shortcut into the compiler; it is a method that accepts AST nodes[1] and returns an AST node. Let us implement this very simple scenario, the assert statement. Now, because Boo already has that, we will use “verify” as the method name. Here is the full method implementation:[Meta] static def verify(expr as Expression): return [| unless $expr: raise $(expr.ToCodeString()) |] We are using quasi quotation to save us typing. This is a static method decorated with the [Meta] attribute, and accepting an AST expression. This is all you need in order to create a meta-method. When you have a meta-method, you can...

posted @ Friday, December 21, 2007 3:30 AM | Feedback (1)

If it walks like a duck and it quacks like a duck

Then it must be an IQuackFu. IQuackFu is Boo’s answer to the Method Missing / Message Not Understood from dynamic languages. Since Boo is a statically typed language[1], and since method missing is such a nice concept to have, we use this special interface to introduce this capability. You are probably confused, because I didn’t even explain what method missing is. Let us go back and look at an example, shall we? We want to look at the following xml: <People> <Person> <FirstName>John</FirstName> </Person> <Person> <FirstName>Jane</FirstName> </Person> </People> Now we want to display the first names in the xml. We...

posted @ Friday, December 21, 2007 2:54 AM | Feedback (8)

How to get around in Boo

When you are not sure how to do something in Boo, try doing it like you would with C# (with the obvious syntax changes), in most cases, it would work. It may not be the best way to do something, however. Keep this a secret, I may get thrown out of the Boo Associated Hackers community if that would happen, and where I would be without my BAH! membership?

posted @ Tuesday, December 18, 2007 10:49 AM | Feedback (2)

What makes Boo a great language

I really like the CLR. It is a great platform, it has a rich set of libraries, it has a lot of power and flexibility, and it was designed with multi language support in mind, which means that what you can do on the CLR vs. what you can do in your language are two different things. It is just too bad that the default CLR language is C#. Now, that probably raised a few brows, and definitely some hackles. C# is a great language, I can hear you saying. Well, yes, sort of. If you thinks that holding...

posted @ Tuesday, December 18, 2007 10:20 AM | Feedback (16)

The Boo Language

So, what is this Boo language anyway? I am talking about it fairly often, but I never explained, and I am going to assume that people aren't following links :-) Boo is an object oriented, statically typed language for the common language runtime with a Python inspired syntax and focused on language and compiler extensibility. Boo is an Open Source project, released under the BSD license. This means that you are free to take, modify and use the language and its products in any way you want, without any limitation[1] . Rodrigo B. de Oliveira started the project, and...

posted @ Monday, December 17, 2007 9:51 PM | Feedback (11)

Domain Specific Language: Losing the original language

Here is an interesting question, at what point you drive away so far from the original language that you lose the benefits of an internal DSL? The following examples are several ways to represent the same thing, going from the extreme DSL to the no DSL to C#. I think that they all have value, and neither cross that line, but I believe that they will help make the point. The example here is a a simple MonoRail Controller: #1: controller Field:    action Tag:           @defaultTags = [ "green", "trees", "growth" ] #2: controller Field:    def Tag():         @defaultTags = [ "green",...

posted @ Saturday, November 24, 2007 12:45 AM | Feedback (4)

Misconceptions

I was explaining to a couple of team members about our stack (NHibernate, Castle, Boo, Rhino) and how the different pieces are hooked together. When I got to talk to Boo, I explained that it is just like Brail, which we are using for the views. One of the guys then asked if Boo stands for Brail, Object Oriented

posted @ Monday, November 12, 2007 11:28 PM | Feedback (1)

Mocking Boo

Okay, I built it to relax a bit, because I am extremely annoyed at the moment. I apologize in advance for the code quality, it is POC only, but still, I wouldn't generally release it like this. What is this? Do you see the highlighted bit at the bottom? This is Boo code that invokes a Macro on compile. It will generate an adapter and an interface, so you don't have to do it manually. The implementation code is below: class AdapterMacro(AbstractAstMacro):       def Expand(macro as MacroStatement):             if macro.Arguments.Count != 1 or not...

posted @ Tuesday, October 30, 2007 10:30 PM | Feedback (2)

Boo does Java

Which bring a lot of interesting ideas to mind... You can read about it here and here

posted @ Saturday, October 27, 2007 11:35 AM | Feedback (2)

Binsor 2.0

All credit should go to Craig Neuwirt, for some amazing feats of syntax. He has managed to extend Binsor to include practically all of Windsor's configuration schema. This is important because previously we had to resort to either manual / ugly stuff or go back to XML (see: manual & ugly). This is important because some of the more interesting things that you can do with Windsor are done using the facilities, and Craig has made sure that Binsor will support the main ones in a natural manner, including out of the box support for the standard configuration model. Let...

posted @ Thursday, October 25, 2007 1:54 AM | Feedback (13)

Analyzing a DSL implementation

You were just handed a strange DSL implementation, it does stuff, and it may be cool, but you have no idea how it works. Craig Neuwirt recently did a major overhaul of Windsor ( I am going to post soon with the details of how cool it is now ), but I am now faced with the question, how do you grok such a thing? I thought that it would be useful to put a list of what I am doing to understand how the internals now works. It goes without saying, but the nitpickers will ask, that a...

posted @ Thursday, October 25, 2007 1:19 AM | Feedback (1)

Pattern Matching in Boo

Looks like it is a good thing that I picked that Erlang book, Boo just got Pattern Matching, I am looking at the code, and but for the grace of Erlang, I would be completely lost.

posted @ Tuesday, October 16, 2007 11:06 PM | Feedback (5)

By the DSL, guess what I am reading

I am toying with this DSL: recieve: message msg as ChangeAddressMessage if msg.AddressId is null: transaction: address = Address.FromMessage(msg) address.Create() message msg as ChangeAddressMessage: transaction: address = LoadAddress(msg.AddressId) Address.FromMessage(address, msg) address.Save() message other: raise MessageNotUnderstood() What book am I reading now?

posted @ Sunday, October 14, 2007 12:43 PM | Feedback (9)

Evaluating languages for building internal DSLs

Michael Dorfman presents an interesting question about building internal DSLs. [You should] point out for those of us who have not (yet) tasted the Boo koolaid exactly what makes this language more suitable to DSLs than VB9, C#3, F#, IronPython or IronRuby.It's not enough to say "You can't build DSLs in C# / VB, they aren't flexible enough (at all)", you need to mention which language features are missing. So, why am did I say that C#/VB/Java/etc are not flexible enough to build usable DSLs out of? Let us consider what we want to achieve when we are thinking...

posted @ Sunday, October 14, 2007 1:18 AM | Feedback (7)

Book Idea: Writing Domain Specific Languages in Boo

I know that I am asking the question from a self-selecting group, but what the hell. I am considering the idea of writing a book about writing domain specific languages, with Boo as the implementation language. This has two distinct topics: Theoretical knowledge: DSL Usages How to create the syntax How to integrate into an application Testing Versioning Patterns Implementation strategy - how to actually build a useful DSL that can do all of the above using Boo. I certainly like the subject, but I wanted to know what you think about it. Do you find the...

posted @ Friday, October 12, 2007 8:44 PM | Feedback (44)

Boo Imports & New Usages

Okay, since I have started thinking about using: import file from anotherFile.boo It occurred to me that there are plenty of reasons to want to do similar things. And boo is flexible enough to make some interesting things with it. What about bringing in WSDL definition at compile time? import webservice from "http://localhost/who/is.there" as WhoIsThereService And then writing a small compiler step that does all the rest. Usually the first twenty or so lines of my my Windsor.boo file are just import statements, they really make it harder to read, why not split them to another file? ...

posted @ Wednesday, October 10, 2007 11:46 PM | Feedback (7)

Multi file DSLs

While a DSL can really cut down the amount of code that you need to write, putting everything in one file is not a good idea. But I like my DSLs to be script  like, without the need for an explicit compilation step. I have thought about it for a while now, and yesterday ago Craig Neuwirt* asked how it can be done using Binsor. My default language is Boo, obviously, which is a static, compiled language that pretends that it is dynamic and scriptish, giving the best of all worlds. One of the cool things about Boo is...

posted @ Wednesday, October 10, 2007 11:38 PM | Feedback (4)

Redefining If

I had time today to sit on several Brail bugs. I keep getting more and more and more amazed by the power that Boo is giving me. In order to fix some of those bugs, I had to literally change the meaning of the if statement. (I defined my own nullable propagator, which I had to implement deeply into the language). Damn, I love this language. Oh, and FYI, if 2+2 == 4 will not do the expected thing anymore :-) 

posted @ Thursday, October 04, 2007 8:37 PM | Feedback (9)

BooBS Sample

Here is the first such script that I am going to use: import Boobs.IO.Extensionsimport Boobs.Compiler.ExtensionsTask "default", ["build"]Task "build", ["clean"]:      MsBuild("MyApp.sln").Execute()Task "clean":      MsBuild("MyApp.sln", "/target:clean").Execute()Svn "ContiniousIntegration":      SvnUpdate      Execute("default") Note that this is probably incredibly primitive consider what rake can do, but it amuses me to be able to do this. The commands are probably even more fun: Tools\BooBuildSystem\boobs -f:default.boobs -t:ContiniousIntegration The Svn task will only be run if the repository is more recent than the working copy, so this is something that makes it very easy to build CI scripts. In this case I need to do something a distributed...

posted @ Wednesday, October 03, 2007 2:17 PM | Feedback (9)

Writing Domain Specific Language in Boo

The slides & code from my JAOO talk can be found here.

posted @ Monday, September 24, 2007 11:11 PM | Feedback (7)

Introducing Boobs: Boo Build System

I hate XML, a long time ago, I also hated XML, but I also had some free time, and I played with building a build system in Boo. To match NAnt, I called it NUncle. It never really gotten anywhere, but Georges Benatti has taken the code and created the Boo Build System. I am just taking a look, and it is fairly impressive. It has the concept of tasks and dependencies between them, as well as action that it can perform. Here is a part of Boobs' own build script: Task "build boobs", ["build engine", "build extensions"]: bc = Booc( SourcesSet...

posted @ Saturday, September 22, 2007 12:05 AM | Feedback (7)

Playing with Boo's DSLs

Boo has gotten a lot better in terms of flexibility lately, a lot better. I was able to churn this little DSL in about an hour: OnCreate Account: Entity.AccountNumber = date.Now.Ticks OnCreate Order: if Entity.Total > Entity.Account.MaxOrderTotal: BeginManualApprovalFor Entity From the perspective of the DSL, it is very easy to use, and from the implementer perspective, this was ridiculously easy to implement. The only half-way complex thing here is the introduce base class action, which is usually the first approach that you take, which is why I don't consider...

posted @ Friday, September 21, 2007 11:50 PM | Feedback (0)

ReSharper for Boo

Well, it has not gotten to that level, but I just hit ALT+Insert in #Develop, and I got this dialog: Wow!

posted @ Friday, September 21, 2007 11:47 PM | Feedback (6)

Boo trick: Even Nicer Hash Literals

Boo has the concept of Has Literals, and it can really make a difference in a lot of cases. It makes some things possible to write. Even leaving aside common things like dictionaries constants, consider this signature:public void Configure(IDictionary options) { // do work } In Boo, I can call this method like this:config.Configure({ "connection_string": "data source...", "batch_size": 15 // etc }) This  is much clearer than the C# option, but we can do better.public class UnknownHashLiteralKeyToStringLiteral : ProcessMethodBodiesWithDuckTyping { public override void OnReferenceExpression(ReferenceExpression node) { IEntity entity = NameResolutionService.Resolve(node.Name); //search for the left side of a key in a hash literal expression if (node.ParentNode is ExpressionPair ...

posted @ Monday, June 11, 2007 10:08 AM | Feedback (9)

Binsor: Native Facilities Support

Okay, I intended to post about this in more details, but I want to wrap up this day, I added support for native facilities in Binsor. By native I mean facilities that expect to be configured by Windsor XML configuration. Since I am mostly the only one that is writing Binsor based facilities, this has been a problem when people wanted to use the standard facilities. You can see the syntax here, very Yaml like, I think :-) I am going to post soon about how I managed to get this syntax to work.Facility("loggerFacility", LoggingFacility, loggingApi: "Log4net", configFile:...

posted @ Monday, June 11, 2007 1:18 AM | Feedback (3)

Boo's DSL

Yeah, better support for DSLs in Boo! I am using Boo as my programming language of choice, and I really like the ability to just drop off and build new syntax any way I want to. This new change make it even easier, hence more approachable, so this is very cool.

posted @ Thursday, June 07, 2007 7:58 AM | Feedback (2)

Tools are not Evil (but needing them is an indication of a problem)

Chris Holmes commented on my thinking for tools, but I think that he missed a crucial distinction that I made (but not clear enough). If you require a tool in order to work effectively with something, this is an issue. By requiring a tool I mean something beyond VS + R#, which are the bare minimum stuff that you need to be effective in C# (it does says something on C#, doesn't it?). The Entity Framework Designer is a good example for something where I think that the dependence on the tools indicate a problem. I have been corrected about requiring...

posted @ Tuesday, May 29, 2007 7:54 AM | Feedback (13)

Booish fun

Booish is a command interpreter for the Boo language, this means that it gives you the full power of Boo and the .NET framework at your finger tips. I just needed to find the number of methods in mscorlib: import System.Reflection mscorlib = typeof(object).Assembly ...

posted @ Thursday, May 10, 2007 10:59 PM | Feedback (3)

Bumbler: NHibernate Dynamic / Interactive Shell

After reading a bit about Jasper, I decided that I would like to see what it would take to build it with NHibernate and Boo. I am going to implement it and write the post at the same time, so you would get near real time documentation of the process. 18:05, decided that I want this syntax: ...

posted @ Friday, May 04, 2007 9:50 PM | Feedback (12)

By foul moon

Because I know that I will need it... # Not very accurate, but apperantly good enough for most purposes # source: http://www.faqs.org/faqs/astronomy/faq/part3/section-15.html def IsFullMoon(dateToCheck as date): ...

posted @ Friday, April 27, 2007 12:44 AM | Feedback (5)

Processing invalid patches

I just got a patch file that SVN couldn't handle. I handled the issue with this piece of code, here for future reference: import System.IO   ...

posted @ Tuesday, March 20, 2007 10:07 AM | Feedback (2)

Code vs. ASCII Art

From the Boo's mailing list (talking about adding implicit parameters): As much as I enjoy ASCII art I don't think it's a good medium for code. ~Rodrigo I am still chuckling about it :-)

posted @ Wednesday, March 07, 2007 8:18 PM | Feedback (0)

Hanselman vs. Boo

Scott Hanselman has an amusing post about working with the .Net OpenID library, which is written in Boo. I suggest that you would read it, but a few of notes first: I had to go through a similar process when porting Brail from Boo to C#. I have to say that the code afterward has a lot more cruft than before. Scott is making a reference to my Boo.Reflector project, I...

posted @ Friday, February 23, 2007 2:31 PM | Feedback (1)

NHibernate In Action

Looks like Ben Scheirman have found the big secret. Just one question, what is this picture or? Aside from that, I can say that Hibernate in Action is a the best for anyone developing NHibernate. With the advent of NHibernate in Action, it is going to be even easier (no need to mentally translate from Java and EJBs anymore). I am looking forward to July 1th, when this book is coming out.

posted @ Sunday, January 28, 2007 9:30 AM | Feedback (5)

On debuggable configurations

Tomer Gabel commented on my post about debuggable configuration:This may be debuggable, but it sure as hell doesn't look like configuration to me. Configuration should be declarative and should not contain complex logic (what you show above definitely falls under that category in my book). This sort of script is, as far as I'm concerned, tantamount to collating all your configurable properties into one external, dynamically-compiled class -- in other words, hardcoded. Let me just point out what I tried to do when I started using this approach: ...

posted @ Thursday, January 11, 2007 4:51 AM | Feedback (7)

Debuggable Configuration

Now try to do that with an XML Configuration File.  

posted @ Monday, January 08, 2007 9:42 PM | Feedback (1)

Rant: CSC Is Stupid

Like I said, I just had the pleasure of moving a small codebase (less than 2,000 lines of code) from Boo to C#, and I can tell you, the C# Compiler is really stupid. I sometimes feel as if I had to speak to an idiot. You do A, and then do B, and then do C, and then... Argh! Perhaps the biggest compliment that I can give to Boo is that I flat out refuse to work for any length of time with C# without Resharper. I often write Boo code in...

posted @ Tuesday, December 05, 2006 8:09 AM | Feedback (0)

Fighting the Evil XML, Take 2

David Haydem posts about using Windsor, I thought that I would take a shot at duplicating his configuration using Binsor.  You can check his post for the XML configuration, but that was 25 lines of code. The Binsor code is 6 lines :-) import BlogDataServices import DatabaseServices ...

posted @ Saturday, October 14, 2006 1:24 PM | Feedback (0)

self.Post("Boo is love") if Boo is Love

I miss working with Boo. Even with the hurdles of not being able to use VS and most of my shortcuts (#Develop is good, but can't compare to VS + ReSharper). I just wrote this: return parent.GetParameter(name) if parent is not null And it was such a pretty statement that I had to blog about it.

posted @ Friday, October 06, 2006 7:19 PM | Feedback (0)

The Executable Configuration (Anti Pattern?)

You probably know that I am sick of XML configuration, and I devoted some time to allow myself use a real programming langauge (Boo) for my configuration. (See my posts about Binsor for the details). This tend to reduce configuration cruft by an order of magnitude. That said, having a programming language at my disposable for configuration opens up some interesting possibliites. For one thing, the line that divide the application setup responsability is becoming blur. What do I mean by that? Well, I got an application that for...

posted @ Sunday, October 01, 2006 8:54 AM | Feedback (1)

More On Binsor: Natrual Component References

Well, I just added the last piece in what I consider the major features to Binsor, which is component references. I'm a big fan of decorators and chains of responsabilities, which mean that I tend to create a lot of references between objects. In Binsor, it is as natural as this: import Rhino.Commons ...

posted @ Saturday, September 16, 2006 6:07 AM | Feedback (2)

Introducting Binsor: The Boo DSL For Windsor

On the on-going battle between yours truly and XML, there has been a score on the good side! I just finished implementing most of the usable functionality in Binsor, which is a Boo DSL* that is directed at configuring Windsor. Before I get into the details, take a look at the most minimal xml configuration possible for Windsor: <?xml version="1.0" encoding="utf-8" ?> ...

posted @ Saturday, September 16, 2006 5:09 AM | Feedback (2)

Reflector Boo 4.2

About a week ago I recieved a really nice email, which contained updates to Reflector's Boo for 4.2, you can get it here.  You can find the source here. The code donator is (let's see if I get it right) 李歆涛, so thanks you very much. And sorry for taking so long.

posted @ Monday, August 21, 2006 7:31 PM | Feedback (0)

If a tree falls in a forest and there is no one there to hear it fall does it make a noise?

According to my code, it doesn't. Here is the scenario, the scenario is supporting on the fly view updates for Brail. Recent changes in MonoRail meant that loading the view is now the responsability of the framework, and not the responsability of the view engine. This, however, presented a problem. Brail's view are compiled classes, but I want to allow edit & refresh cycles, so I can't force the develop to restart the application every time a view change. So far, I handled it with a FileSystemWatcher that took care of...

posted @ Saturday, June 17, 2006 7:19 PM | Feedback (3)

Boo Reference

It seems like this is a wiki-is-a-page about Boo. It looks promising, so check it out if you want to learn Boo. I made a quick scan through it, and it looks like very good info.

posted @ Sunday, March 26, 2006 9:21 PM | Feedback (0)

Typing: Static, Explicit, Implicit And Dynamic

Another note about typing. In my opinion, people are often confused about the meaning of static typing vs. dynamic typing and explicit typing vs. implicit typing. The two are not neccearily connected. In general, a programming langague will fall into one of this categories: Staticly typed, explicit typing - Java, C++, C#, VB.Net, etc Staticly typed, implicit typing - Boo, C# 3.0, VB.Net 9.0 etc ...

posted @ Tuesday, February 28, 2006 11:32 PM | Feedback (2)

Castle Demo App: Let There Be A New User

Before we start with our regular content, a couple of bug fixes, the ValidateLength on the Name and Email properties of the User class should looks like this:  [ ValidateLength(0,50)] Specifying just one number means the exact length of the string. Okay, so far we have seen how to edit users and then save them to the database, but we haven't seen yet how to actually create the users. For myself, I think...

posted @ Wednesday, February 22, 2006 10:59 PM | Feedback (1)

Boo just got a whole lot better

One of my wishes just came true today, Boo just got a new feature that I wanted for a long time. It's not something that you're likely to find in any way useful unless you mess with the guts of Boo. The new feature is adding @,$,? prefixes to the Boo Parser. Why is this a good thing? Beacuse it let me, and any other Boo Macro Developer, has more ways to get infromation from the user without it being a true pain in the ass. For instance, I can have this: ...

posted @ Wednesday, February 22, 2006 8:34 PM | Feedback (0)

.Net 2.0 Code Conversion

This one is Cool. The Sharp Develop folks has a code convertor out that works for .Net 2.0 (including generics!) and it works for C# <-> VB.Net and VB.Net / C# -> Boo! You can get it here, and there is even a web service you can call to do it automatically from your code. I like the design of only converting to Boo, obviously once you've got your code in Boo, you never need to move it to another language. This convertor uses the NRefactory library, so it's pretty robust, and...

posted @ Saturday, January 07, 2006 12:25 PM | Feedback (1)

Boo & DotNetRocks

Fact: DotNetRocks makes you a better programmer.Boo makes you a  great programmer. What happens when you combine them together? The entire dot net rocks archive!I keep going to the Dot Net Rocks site for more stuff, but because I listen faster than they record (except during the road trip {Hi, when is the next one due :-)}), I've started to dig into their archives. But they are lots of shows, and there doesn't seem to be any torrent for all of the files. After downloading a single show for the tenth time, I decide to put some code into action, instead...

posted @ Sunday, January 01, 2006 9:35 PM | Feedback (0)

Watching the PDC: Scripting and Dynamic Languages on the CLR

I'm currently watching the Scripting and Dynamic Languages on the CLR session from the PDC. Rodrigo (creator of Boo) is there, and it's a very interesting discussion. I still think that Boo is the best language on the CLR, mainly because I, as a user, can write what I want, and not how I want it. Rodrigo mentioned the IReflect interface, which was new to me. Any idea what is it used for in the CLR right now, beside Type? On adding keywords to the language: VB.Net & C# took different approaches....

posted @ Saturday, November 05, 2005 10:17 AM | Feedback (1)

Boo's Design By Contract Update

I didn't have a lot of time recently to finish the Design By Contract for Boo. I did manage to push it forward somewhat in that it actually works :-) It doesn't yet works with inheritance, so that is yet a todo. You can get the new code here

posted @ Sunday, October 30, 2005 8:52 PM | Feedback (0)

Boo Mixin

Check out this post about mixin in Boo, Mario has already implemented my idea.

posted @ Sunday, October 30, 2005 4:10 AM | Feedback (0)

Cool Boo: Code Generation Inside the Languague

Here is one more case where an open compiler architecture is a huge plus. At Mario has created an addin to Boo that gives you the ability to generate from insdie the lagnauge, this one has huge implications. I can see it as a cool way to create mixins. You code use it like this: # blog.boo [InjectCode(MixinCodeBuilder, "Mixins\Taggable.mixin")] public class Blog:     [Property] name as string ...

posted @ Friday, October 28, 2005 2:37 PM | Feedback (1)

Sharp Develop 2.0

I've had a fairly strong negative reaction to #Develop in the past, mostly because you really couldn't use if without the IDE started to throw exceptions and refusing to work (my pet peeve was the inability to create & rename new folders, an issue that often require a manual editing of the project file.) I got a couple of recommendation about #Develop 2, which is currently only available from the Subversion repository (svn://sharpdevelop.net/corsavy/trunk) (or so I understand). I'm writing this review based on revision 619. Over all, I've got a...

posted @ Tuesday, October 25, 2005 3:48 PM | Feedback (0)

Boo & Active Record makes for strange bedfellows

Just check out the syntax to declare a property that is also a primary key: [Boo.Lang.Property(UserId, Attributes:[PrimaryKey(PrimaryKeyType.Native, "id")])] userId as int The probably proper way to do it would be to ignore the magic Boo.Lang.Property attribute and do it the old fashion way: userId as int ...

posted @ Friday, September 02, 2005 5:44 PM | Feedback (4)

Seems that I learned soemthing after all

Did you ever had a problem that you simply couldn't solve? I had one such problem 8 months ago, I wanted some way to skip the somewhat tedious log4net logging approach:if (logger.IsDebugEnabled)     logger.Debug("message with "+ "expansive" +" " + "string concentration"); This is the recommended approach from the log4net documentation, and it makes sense, this way, if you don't enable logging, you don't pay for any string concentration. But it's very tedious to do so over and over again. I really wanted a clean way to do it, but at the time Boo's macros were far beyond my capabilities. Even...

posted @ Sunday, August 28, 2005 10:20 AM | Feedback (1)

The Hidden Parameter

I have a problem doing AST manipulation at run time, sometimes the code work, and sometimes it doesn't. I know what cause the error, and I can fix it for one scenario, but then the other scenario is borken. I'm pretty sure that I'm doing something nasty, but I don't know what. I'm trying to build a method and reference its arguments, but I keep getting errors when I try to test this. I'm actually reading raw IL (at least it's better than ASMx86), trying to figure out some things that aren't going well. The problem I've have is with parameter indexing. I've a piece of code...

posted @ Friday, August 26, 2005 7:09 PM | Feedback (0)

Boo 0.6 is out!

Download - http://boo.codehaus.org/Download Change Log - http://docs.codehaus.org/display/BOO/2005/08/25/boo+0.6+is+here Lots of goodies, including bug fixes for "my" bugs.

posted @ Thursday, August 25, 2005 9:01 AM | Feedback (0)

Xml for configuration, why?

Can someone please explain me why we suddenly got XML all over the place? On the top of my head, we have app.config files, nant build files, AOP configuration, NHiberante mapping files, etc. Why take an application written in strongly typed language - presumably to allow the compiler to catch your errors - and add weakly typed information that would break your application? Here is an example of using Boo to script a build file (this is very similar to how you would do it in NAnt, but NAnt is not really...

posted @ Wednesday, August 24, 2005 10:43 PM | Feedback (3)

Boo's Design By Contract

Sorry for being so silent lately, I've been struggling to get Desing By Contract working for Boo. I got myself into some problems there that I had some really tough time to crack. I'm glad to say that I passed the most major hurdle, which is to get the code to compile the output correctly. It was a touch & go for a while, but I've managed to get it to work as I wanted it. I've been struggling with this particular problem for a four days or so, trying different work arounds until I found one that work. The code is ugly...

posted @ Monday, August 22, 2005 3:55 PM | Feedback (0)

It's the asking that counts

Today I'd twice began writing a question to Boo's mailing list, after fighting with the code for several hours (each time), only to realize that I already know the answer. To be rather exact, it was to process of formulating the problem so other people could understand it was what mattered, the moment that I did that I suddenly had an insight to the problem at hand. I spend a log of time lately smacking my forehead because I brute force my way through something only to figure out a...

posted @ Monday, August 15, 2005 10:38 AM | Feedback (0)

Reflector Plugin for Boo's Langauge

For the last five days or so I've been working on a Reflector plugin for Boo, so you could view the disassembled code in Boo. It's not perfect yet. That is a very big subject and I probably made many mistakes in the process, but it is functional and should hopefully make people more open to Boo. The plugin is built against Reflector 4.1.8 and is available here. Here is a short list of the stuff that need special attention: ...

posted @ Tuesday, August 09, 2005 5:15 AM | Feedback (1)

Proposal: Implementing contracts in Boo

(This is a suggestion I'm making for the Boo's mailing list, about a proposed syntax for Eiffel's like contracts for Boo) [This proposal require inherited Ast attributes, which provides some challanges in the implementation. More on this in a moment.] The idea is to...

posted @ Sunday, July 31, 2005 5:43 AM | Feedback (3)

Damn, Damn and double damn

I'm currently investigating a sweet little language call Boo. I've been totally blown away by it's abilities. It's so cool that I just can't belive that I didn't know that such a thing exist. It totally blows away C# in terms of ease-of-use. There are some cavats currently, mainly due to the fact that the language is still in beta, but already it has some great potential. The double damn is that I just spent three or four hours coding, and lost it all just as I was about to finish because of #Develop.

posted @ Friday, January 21, 2005 7:50 PM | Feedback (0)

Boo!

I'm interested in learning dynamic languages, but I don't want to leave the CLI, so I decided to investigate IronPython. I started reading about it, then I got (somehow, no idea how) to Boo. Read the manifest. After reading this, and considerring that this is the first non C-derived language that I'm planning to learn (VB & Pascal aren't really that different. Different syntax, same way of thinking) it looks way cool.   "Stewardesses is the longest word typed with only the left hand." -- Fact of lifes ...

posted @ Wednesday, January 19, 2005 9:48 PM | Feedback (0)