technology
[ bamboo ] 16:41, Tuesday, 20 May 2008

When I joined Db4objects a few years ago my first assignment was to research and implement a decent solution for getting db4o to work on the .net platform.

There was already some investigation going on on using the Eclipse JDT API as the basis for a source to source translator which proved to be a wise choice in the long run.

Eventually sharpen was born and after a lot of love we finally reached a point where the translated c# code would look really good.

People would get really interested every time sharpen was mentioned but for several reasons it wasn't publicly available.

Until now. Hooray!

I'm really looking forward to what people will build on top of that.


[ bamboo ] 09:36, Wednesday, 19 March 2008

It was more than twenty years ago that Dijkstra wrote against the perils of anthropomorphism on science. And here we stand building whole industries on top of it.

But is it programming dominantly math? Or is it mainly human communication?

Maybe we swung too far to the the latter. I speculate that the current rise of functional programming can also be attributed to its  liberating effect - one is no longer expected to attribute proper intent to entities before a program can be seen to make sense.

As a constant reminder of that I'm tempted to use a different font for my programming.

Dijkstra Font
[ bamboo ] 14:34, Friday, 8 February 2008

Lots of improvements in this release including a simpler way for writing macros, support for nested functions, a better interactive interpreter, error messages that include suggestions for misspelled names, exception filters, exception fault handlers and for loop IDisposeable.Dispose integration.

With many many kudos to Avishay Lavie, Cédric Vivier, Daniel Grunwald and Marcus Griep!

What? - http://boo.codehaus.org/
Download - http://boo.codehaus.org/Download
Official irc channel - irc://irc.codehaus.org/boo

Have fun!

[ bamboo ] 09:43, Tuesday, 4 December 2007

What a great experience.

A chance to interact live with a dear friend. Free Software, Hacking, Women, Futurama, McDonalds, love spreading, Militant Atheism, Monty Python, Douglas Adams and the French Way.

Had lots of interesting exchange of ideas with Massi, ranging from "extensible parsing through composeable PEGs with  optimal performance" to Carlos Castañeda, Jesus Christ, meta-physics, religion and Pink Floyd. The Cryptonomicon really got me.

Got to put a face on Joachim and see how really cool Unity is.

Jeroen IKVM Frijters is a funny guy!

On Thursday I got to talk about db4o which led me to meet a few db4o users hanging around the conference.

Pedro Santos had an interesting question, how to monitor and control the usage of computational resources in a managed client/server application? In other words, how a sysadmin can make sure a specific client won't DOS the application?

For .NET servers running on Windows there are performance counters, what about Mono servers running on Linux?

I've also got to spread the gospel about boo for which I got a hugely positive response.

Thomas "Gaia" Hansen seemed to really get it and so we had lots of interesting discussions on how to take over the world boo style.

Jackson wants to hack on better nullable type support for boo!

Mark wants an extensible language where NullReferenceExceptions are impossible.

Miguel reassured me once again mcs won't be rewritten on top of the boo compiler infrastructure :)

The presentation material is here.

Looking forward to the next one.

[ bamboo ] 06:22, Monday, 26 November 2007

Following Carl's steps I'm also claiming my blog by publishing a link to my Technorati Profile.

[ bamboo ] 14:54, Tuesday, 13 November 2007

So it's official now, I'll be speaking at the Mono Summit 2007.

It will be great to see you there!

Many thanks to the great folks at db4o for sponsoring my trip.

[ bamboo ] 11:56, Wednesday, 24 October 2007

Yeah, I won't be playing Halo 3 unless I get one for free (hint, hint).

[ bamboo ] 14:19, Thursday, 20 September 2007

This is a Lisp tutorial worth reading.

[ bamboo ] 23:24, Monday, 17 September 2007

This is so nice.

[ bamboo ] 11:19, Thursday, 21 June 2007

I had the privilege to attend to Lessig's talk at the FISL some time ago. It really moved me.

I wish him the best of luck on his new crusade.

[ bamboo ] 13:24, Tuesday, 5 June 2007

I am impressed.

[ bamboo ] 11:48, Sunday, 3 June 2007

Oren asks:

   "Assuming that you have no access to tooling, and you don't have the resources to built NHibernate-sque framework, how would you approach building a Domain Driven application on the naked CLR?"

The most interesting part of the question for me is "and you don't have the resources to built NHibernate" because it immediately goes to the seemingly basic assumption most people have these days that "Persistence => SQL".

While it might be certainly true that a relational backend is a given for most enterprisey scenarios it is certainly not true that all persistent applications have to go through the pain.

Once upon a time a team with 4 people (2 developers, 2 web designers) built the web content management system for the 3rd largest TV station in Brazil on top of System.Runtime.Serialization using the Object Prevalence architecture.

Yeah, skin naked CLR.

If your specific application can't afford keeping all its objects in memory all the time and you don't mind putting a little clothes on, there's db4o.


[ bamboo ] 07:58, Monday, 21 May 2007

Around 4 years ago (!) there was this discussion about how to support some dynamic language features on top of mono. One of the topics was optimizing dynamic dispatching and apparently my suggestion was redirected to nul.

4 years later here I am finally implementing the idea in order to take boo's dynamic dispatching performance to the next level.

Before the optimization:

$ build/booi performance/duckoperators.boo
int*int: 1.101584
list*int: 29.0217312
dynamicDispatch: 51.9484224
staticDispatch 1.4921456

Each line reports how long it takes to execute the described operation with dynamic dispatching 5_000_000 times (except the last line which executes the same operation as the line before it but with static dispatching).

The first line tells us that it takes 1.10 seconds for boo to multiply two integer objects using dynamic dispatching.
The second line says boo takes 29.02 seconds to multiply a List instance by an integer using dynamic dispatching (dynamic dispatch over static methods).
The third line which is the most interesting one for our purposes here says that boo takes roughly 52 seconds to dynamically dispatch 5_000_000 instance method calls.

We can see a huge overhead over static dispatching.

After the optimization:

$ build/booi performance/duckoperators.boo
int*int: 1.101584
list*int: 27.755072
dynamicDispatch: 4.055832
staticDispatch 1.4821312

Niiiiiice.

So this first stab got it from 52 seconds down to 4 seconds. Not bad at all. A few changes and we'll have the same benefits for dynamic dispatching over static methods.

I hope this will have a huge impact on environments that rely heavily on dynamic dispatching such as Brail.

Unfortunately though this optimization is only available when building for the .NET 2.0 profile.

Soon in a source code repository near you.

[ bamboo ] 17:36, Tuesday, 14 November 2006

Feel the love!

[ bamboo ] 15:32, Sunday, 20 August 2006

I'm finally reading Free Play again. Always a pleasure.

I've also been pair programming a lot. Another pleasure:

"Some jobs are too big to handle alone, or simply more fun when done with friends. Either case leads us into the fruitful and challenging field of collaboration. Artists working together play out yet another aspect of the power of limits. There is another personality and style to pull with and push against. Each collaborator brings to the work a different set of strengths and resistances. We provide both irritation and inspiration for each other - the grist for each other's pearl making.

We need to remind ourselves here of what is obviously true but not often enough said: that different personality styles have different creative styles. There is no one idea of creativity that can describe it all. Therefore, in collaborating with others we round up, as in any relationship, an enlarged self, a more versatile creativity."

I could quote the whole chapter but hey, do yourself a favor and get the book.

[ bamboo ] 22:14, Tuesday, 29 November 2005

I've just finished updating the cecil repository with our latest contributions:

  • Cecil.FlowAnalysis
  • a very humble but functional test suite

Have fun!

[ bamboo ] 16:18, Wednesday, 23 November 2005

Martin Fowler blogged about in memory databases and I could not help reading the excerpt about Prevayler at the end as FUD:


Prevayler got a lot of attention for taking this kind of approach. People I know who tried it found it's tight coupling to the in-memory objects and lack of migration tools caused serious problems.

There are two assertions there, let me take them apart:

  • "People who tried it found its lack of migration tools caused serious problems." I can definitely understand that. Object prevalence and related native object persistence technologies enable you to be so agile in your development that the lack of proper migration tools is irritating. That's why Bamboo.Prevalence includes a simple but effective migration tool out of the box.

  • "People who tried it found its tight coupling to the in-memory objects caused serious problems." Well, tight coupling to in-memory objects is also called OOP in some circles. That's the single most important reason I would choose object prevalence technology whenever allowed by the project requirements. Ah, the things you are allowed to do when you get that intimate to your objects.

[ bamboo ] 11:14, Thursday, 17 November 2005

We are having a discussion about NativeQueries on castleproject-devel and I decided to wrap up the discussion here by describing some of the details and shared goodies of our implementation.

> Can I assume that you're using the new GetMethodIL (or something like that)?

We are using the Mono.Cecil API not the reflection API.

Simply because Cecil's version of GetMethodBody is so much better and it already worked on most platforms we support. One of our first contributions was to get Cecil running on the Compact Framework. After some conditional compilation fun (among other things) Cecil now works on mono, ms.net 1.1, ms.net 2.0, cf 1.0 and cf 2.0. Pretty cool.

> This is just freaking cool. And the idea is awesome.

Yeah, we think so too! (:

> If you cache the > execution plans, I suppose you can get a very good performance out of it. >

Currently we are not even caching the execution plans and the performance it's pretty close to the raw query execution performance one would get from the underlying query api.

But, yes, caching the execution plans (or transformed expression trees in our case) is the next logical step.

> This is a whole different way of thinking about how to mess with the > code...! > I've only heard about Cecil until now, wasn't aware that it was operational > on this level. Are there are docs yet, or is it read the code to find out? >

The Cecil object model is pretty self documenting.

The code we are contributing to cecil is a little more involved but still easy to follow if you stick to the public API.

It basically allows you to get high level control flow graphs out of method definitions. These high level cfgs can also contain decompiled expression trees (an expression tree is a structure pretty similar to a bound boo ast).

Here's a simple but complete example that uses Cecil and our contributed code (Cecil.FlowAnalysis) to dump the body of a method:

import System
import Mono.Cecil
import Cecil.FlowAnalysis
import Cecil.FlowAnalysis.ActionFlow
import Cecil.FlowAnalysis.CodeStructure

class Address:
    [property(State)]
    _state as string
    
class Customer:
    [property(Address)]
    _address as Address
    
class Predicate:
    def Match(c as Customer):
        return c.Address.State == "SP"

def GetMatchMethod():
    asm = AssemblyFactory.GetAssembly(typeof(Predicate).Module.FullyQualifiedName)
    return asm.MainModule.Types["Predicate"].Methods.GetMethod("Match")[0]

cfg = FlowGraphFactory.CreateControlFlowGraph(GetMatchMethod())
// a cfg is at the IL instruction level it is good for
// low level IL optimization and simple analysis

afg = FlowGraphFactory.CreateActionFlowGraph(cfg)
// an afg is at the statement/expression level
// good for code analysis

// print the interesting blocks
for block in afg.Blocks:
    expression as IExpression = null
    
    if block isa IReturnActionBlock:
        expression = (block as IReturnActionBlock).Expression
        Console.Write("return ")
    elif block isa IAssignActionBlock:
        expression = (block as IAssignActionBlock).AssignExpression
        
    continue if expression is null
    
    // expression is an ast like expression tree
    // which supports visitors
    // it is more like a bound ast (with all references
    // pointing to the right Mono.Cecil entities)
    //

    // ExpressionPrinter is a handy visitor
    print ExpressionPrinter.ToString(expression)

The code above will print:

    local0 = string.op_Equality(c.get_Address().get_State(), "SP")
    return local0
Going from that to a high performant query native to the underlying engine is a fun ride!
[ bamboo ] 23:23, Tuesday, 15 November 2005

Ubuntu breezy installed without a hiccup on my AMD64. Then jdk 5, eclipse and skype.

Fingers crossed to install vmware player... What a nice surprise!

I simply ran the installer script and it worked!

So now I'm back to having linux as my main environment with Windows virtual machines.

What a nice day! Let's see how mono goes...

[ bamboo ] 22:52, Saturday, 15 October 2005

Thank you Lessig!

[ bamboo ] 17:26, Tuesday, 6 September 2005

Count me in.

[ bamboo ] 11:22, Monday, 4 July 2005

Byecycle is an auto-arranging dependency analysis plug-in for Eclipse. Its goal is to make you feel sick when you see bad code and to make you feel happy when you see good code.

Visit the Byecycle home page for more details.

[ bamboo ] 01:36, Friday, 13 May 2005

Yeah. This got me thinking. Thanks.

[ bamboo ] 14:44, Saturday, 19 March 2005

I had to write an eclipse plugin some time ago. I just can't live without TDD. TDD with eclipse plugins is a pain in the neck because of eclipse startup and execution times. In my old development machine (a PIV 2.2Mhz notebook), the entire test suite takes 125 seconds to run. After weeks of intensive development I figured I had two options either buy a faster workstation or go nuts.

I bought myself a AMD64 3200+ workstation.

Here's the time figures for the different development environments I tried:

Notebook, Windows XP Home, Eclipse 3.1, jdk 1.5.0_01 (client vm): 125.7s
Workstation, Windows XP Pro, Eclipse 3.1, jdk 1.5.0_01 (client vm): 57.8s
Workstation, Windows XP Pro, Eclipse 3.1, jdk 1.5.0_01 (server vm): 61.3s
Workstation, SuSE 9.2 64bit, Eclipse 3.1, jdk 1.5.0_01 64bit (server vm): 61s
Workstation, SuSE 9.2 32bit inside VMWare running on SuSE 9.2 64bit, jdk 1.5.0_02 32bit (client vm): 59.2s

I find absolutely amazing that running eclipse inside a 32bit SuSE 9.2 VMWare under SuSE 9.2 64bit runs at the same speed of eclipse under Windows XP Pro.

These VMWare guys really know what they are doing.

Quick update: I've just tried running the smae SuSE 9.2 32bit inside a VMWare running on Windows XP Pro 64bit and the full test suite took only 57s!!!! So it seems that I've finally found my development enviroment setup.

[ bamboo ] 11:30, Monday, 31 January 2005

"You have to understand that most of these people are not ready to be unplugged. And many of them are so inurred, so hopelessly dependent on the system, that they will fight to protect it.

...

Yet, their strength and their speed are still based in a world that is built on rules.
Because of that, they will never be as strong or as fast as you can be."

Yes, Klaus is finally blogging.

[ bamboo ] 08:18, Tuesday, 23 November 2004

From the looney who came up with prevayler: Sovereign Computing.

Are you ready to join the crowd and make it happen? Too scared?

Sovereign Computing

[ bamboo ] 09:17, Thursday, 11 November 2004
I did fell in love with java once.

I guess that after years of reinterpret_cast<void**>(&spUnk.p), java seemed like nothing but a beautiful sunday morning.

Reading a char array from a file the java way
    public static char[] readChars(File file) throws IOException {
        FileInputStream stream = new FileInputStream(file);
        try {            
            // HACK: assume 1 byte per char
            char[] buffer = new char[(int)file.length()];            
            InputStreamReader reader = new InputStreamReader(stream);
            reader.read(buffer);
            return buffer;
        } finally {
            stream.close();
        }
    }


Reading a char array from a file the .net way
def readChars(fname as string):
    using reader=File.OpenText(fname):
        return reader.ReadToEnd().ToCharArray()


[ bamboo ] 09:37, Wednesday, 10 November 2004

Q. How do you get a list of files matching a specific wildcard?
A. java.io.File.listFiles(FilenameFilter)

FilenameFilter??? What's wrong with Directory.GetFiles("*.boo")?

And by the way we don't even have a java.io.Directory, it's everything on java.io.File. F#?%#!a a...

Ok, let's just breath... I'll need my yoga classes more than ever now that I'll be doing lots of java.

[ bamboo ] 17:39, Tuesday, 5 October 2004

Webdesigning me? Nah... Just the old javascript/CSS/XHTML reality check every now and then.

So here it goes to Leonardo:

   1:<html>
   2:<head>
   3:<style>
   4:.body
   5:{
   6:    font-family: verdana;
   7:    font-size: 10pt;
   8:}
   9:
  10:.menuItem, .menuItemHover
  11:{    
  12:    background-color: blue;
  13:    font-weight: bold;
  14:    padding: 5px;
  15:    color: white;
  16:    display: inline;
  17:    cursor: pointer;
  18:}
  19:
  20:.menuItemHover
  21:{
  22:    background-color: lightblue;
  23:}
  24:</style>
  25:
  26:<script language="javascript">
  27:document.onmouseover = function(ev)
  28:{
  29:    var element = getEventTarget(ev);
  30:    if ("menuItem" == element.className)
  31:    {
  32:        element.className = "menuItemHover";
  33:    }
  34:}
  35:
  36:document.onmouseout = function(ev)
  37:{
  38:    var element = getEventTarget(ev);
  39:    if ("menuItemHover" == element.className)
  40:    {
  41:        element.className = "menuItem";
  42:    }
  43:}
  44:
  45:function getEventTarget(ev)
  46:{
  47:    return (ev && ev.target) || window.event.srcElement;
  48:}
  49:
  50:</script>
  51:</head>
  52:<body>
  53:
  54:<div id="menuBar">
  55:<div class="menuItem">
  56:<img src="images/arrow.gif" />
  57:About US
  58:</div>
  59:<div class="menuItem">
  60:<img src="images/arrow.gif" />
  61:Products
  62:</div>
  63:</div>
  64:
  65:
  66:</body>
  67:</html>


The same old few conclusions:
  • CSS has really nice features, how can be people not using it more?
  • tableless html is easier to read, easier to write, easier to change (at least if you are using jedit such as myself)
  • tableless html is easier to relayout (think skins)
so again, why do we still have deeply nested tables everywhere? Dreamweaver?

[ bamboo ] 22:41, Friday, 10 September 2004

What ever happened to C++?

[ bamboo ] 11:35, Monday, 9 August 2004
Nice essay on Patents and Linux.
And just in case you are wondering I totally agree.
[ bamboo ] 12:48, Thursday, 29 July 2004

The 0.6 version of IronPython was just released. I still don't know how to feel about Jim being hired by MS though.

Anyway, I've just played a little with it and it looks great!

The distro comes with a System.Windows.Forms example that I decided to translate to boo just for the fun of it:

import System.Windows.Forms from System.Windows.Forms
import System.Drawing from System.Drawing

f = Form(Text:"Windows fun with boo",
         HelpButton: true,
         MinimizeBox: false,
		 MaximizeBox: false,
		 FormBorderStyle: FormBorderStyle.FixedDialog,
		 StartPosition: FormStartPosition.CenterScreen)		 

b1 = Button(Text:"Say Something", Location:Point(30,30), Size:Size(100,30))
b1.Click += callable:
    l = Label(Text:"boo is Alive!", ForeColor:Color.Red)
    l.Location = Point(30, 50+f.Controls.Count*25)
    f.Controls.Add(l)

f.Controls.Add(b1)
f.ShowDialog()



The future seems brighter on .net land.

[ bamboo ] 11:52, Thursday, 29 July 2004

If you haven't read it yet here's another great essay by Paul Graham.

Graham says:

The programmers you'll be able to hire to work on a Java project won't be as smart as the ones you could get to work on a project written in Python.

s/Python/boo/ and it is still true! :)