Oren Eini

CEO of RavenDB

a NoSQL Open Source Document Database

Get in touch with me:

oren@ravendb.net +972 52-548-6969

Posts: 7,627
|
Comments: 51,249
Privacy Policy · Terms
filter by tags archive
time to read 2 min | 349 words

Well, when the wheel is a square, of course:

© Performance Management Company, 1993 
Square Wheels® is a registered trademark of Performance Management Company

Adi asks about my seemingly inconsistent behavior regarding when to roll your own, and when to use the stuff that is already there:

I find it difficult to understand Oren. Sometimes he'd rather write his own code from scratch (Rhino mocks), but he keeps preaching the use of known OSS solutions, such as Rails, NHibernate, or the Castle project.

What can I say, I have a Pavlovian conditioning with regards to software, I tend to avoid software that cause me pain. Let me quote David Hayden about the CAB and SCSF:

I have never had the pleasure of working with the Composite Application Block ( CAB ) or Smart Client Software Factory ( SCSF )

That is quite telling. And I don't think that anyone can say that David is not very well familiar with the CAB/SCSF.

Why do I promote OSS solutions such as NHibernate, Castle?

  • Those solutions are (nearly) painless. In fact, they are often elegant and fun to work with. As an example, I worked with a team member today, introducing him to NHibernate Query Generator, he was very happy about it. Talk about painless persistence.

Why did I decide to write my own Mocking Framework instead of using the standard one (at the time)?

  • NMock, the mocking framework that I used at the time (2005), was annoying as hell for the agile developer. Bad support for overloads, no way to Lean On The Compiler and No ReSharper. It was a pain to use. I wrote my own, and I like using it. Incidently, it looks like a lot of other people are liking it, but that isn't why I wrote it.

Removing pain points will make you a better developer, period.

Oh, and I do enjoy the discussion, although I wouldn't call it a post war.

time to read 1 min | 85 words

Right now Brail has no 1st class support for generating XML, like RoR's rxml. I just run into BooML, and it looks like a really great way to handle this issue. MonoRail doesn't (yet) has the notion of multiply DSLs, just standard templates and JS generation. Looks like that is the way I would go when I next need to support XML with MonoRail.

I knew there was a reason why I liked Boo so much :-)

time to read 8 min | 1508 words

On Castle Dev, Chris has asked the following question, how can you build the common "empty" template with Brail? NVelocity makes it very easy:

#foreach $item in $items

#each

      $item

#nodata

      No Data!

#end

But Brail makes it more cumbersome. There are solutions using view components, but they are too much, all too often. So, can we find an elegant solution to the problem?

As it turn out, yes (otherwise I probably wouldn't write this post :-) ). Brail is based on Boo, and Boo has extension methods... Another concept that Brail has is "Common Scripts", a set of helper methods that can be used across all the views in the application. Here is the script that I put in /Views/CommonScripts/extensions.brail:

[Boo.Lang.ExtensionAttribute]

static def IsEmpty(val as object) as bool:

      if val isa System.Collections.ICollection:

            return cast(System.Collections.ICollection,val).Count == 0

      end

      return true

end

Now you have extended all the objects in the application, so we can use it like this:

<%

    for item in items:

        output item

    end

    output "No Data" if items.IsEmpty

%>

I like that :-) The notion can be extended to more complex issues, naturally, such as ToXml extension method, etc. In fact, you can even forward calls to C# code, so that makes it even more powerful (I assume (and suggest against) that you aren't going to write a lot of code in the extensions).

time to read 1 min | 93 words

So I can eat it (No Scott, I will not go to that resturant again, I know they can probably serve both, but the salad scares me). Appernatly CodePlex is adding Subversion support. What I would really like to know if it would have the same integration that the TFS backend would have as well.

At any rate, I would like to take this opportunity to apologize to the CodePlex team, I would have never believed that you would do it, way to go!

time to read 5 min | 812 words

I have several ways of categorizing code. Production quality, test, demo, and utilities. When I am talking about utilities, I am talking about little programs that I use to do all sorts of small tasks. There I rarely worry about maintainability, and today there was a gem here:

public delegate Control BuildSpecialCase(TextBox textbox);

private BuildSpecialCase GetSpecialCaseControl(string name)
{
 if (name.IndexOf("ConnectionString", StringComparison.InvariantCultureIgnoreCase) != -1)
 {
  return delegate(TextBox t)
  {
   Button change = new Button();
   change.Click += delegate { t.Text = PromptForConnectionString(t.Text); };
   change.Dock = DockStyle.Right;
   change.Text = "...";
   change.Width = 30;
   return change;
  };
 }
 if (name.IndexOf("File", StringComparison.InvariantCultureIgnoreCase) != -1)
 {
  return delegate(TextBox t)
  {
   Button change = new Button();
   change.Click += delegate
   {
    OpenFileDialog dialog = new OpenFileDialog();
    dialog.Multiselect = false;
    dialog.FileName = t.Text;
    if (dialog.ShowDialog(this) == DialogResult.OK)
    {
     t.Text = dialog.FileName;
    }
   };
   change.Dock = DockStyle.Right;
   change.Text = "...";
   change.Width = 30;
   return change;
  };
 }
 if (name.IndexOf("Folder", StringComparison.InvariantCultureIgnoreCase) != -1 ||
  name.IndexOf("Dir", StringComparison.InvariantCultureIgnoreCase) != -1)
 {
  return delegate(TextBox t)
  {
   Button change = new Button();
   change.Click += delegate
   {
    FolderBrowserDialog dialog = new FolderBrowserDialog();
    dialog.SelectedPath = t.Text;
    if (dialog.ShowDialog(this) == DialogResult.OK)
    {
     t.Text = dialog.SelectedPath;
    }
   };
   change.Dock = DockStyle.Right;
   change.Text = "...";
   change.Width = 30;
   return change;
  };
 }
 return null;
}

Can you figure out what is going on?

As long as we are talking about unmaintainable code, here an example from code meant for production that I just wrote:

IDictionary<Customer, IDictionary<string, IList<Policy>>> namedPoliciesByCustomers = new ...;

But for that I have tests :-)

time to read 2 min | 363 words

Scott Hanselman has a post titled: Is Microsoft losing the Alpha Geeks?

The collective group in the discussion at RailsConf seemed to agree that Microsoft should make not just the DLR source available, but actually create a non-profit organization, ala Mozilla, and transfer the developers over to that company. They should allow commits to the code from the outside, which should help get around some of the vagaries of the GPL/LGPL licensed Ruby Test Suites. "IronRuby" should be collectively owned by the community.

In general, I would think that such an organization would be a Good Thing, but it is completely irrelevant to bring the OSS issue into the discussion.

The reason that the "Alpha Geeks" are moving (moved?) from the Microsoft's stuff is very simple. Microsoft's stuff doesn't scale. It doesn't scale for development, it doesn't scale for ease of use, it doesn't scale for elegance.

Microsoft is very focused on the creation of software, but much less focused on working with software. This means that a lot of the issues that arise from working with a large code base over a long period of time have no answer from Microsoft except starting anew. Putting stuff out as OSS wouldn't change that as long as this is the overruling mindset at Microsoft.

Most of the OSS project has a very different mindset than that, but Microsoft is basically just making the source repository public, not OSSing projects. (To be rather exact, they don't work on OSS with the same mindset that other OSS project has, which is highly constrained resources).

I think that part of the problem is that MS is listening to Big customers, which may want what they are supplying, lot of wizards == cheap programmers. By doing so, they are losing the entire Long Tail, and almost by definition, the Alpha Geeks are at the head of the long tail.

time to read 1 min | 144 words

This seems like an obvious way, but it is worth mentioning. I was reviewing the search phrases people use to get to my site, and I found some... extremely explicit ones. Not what you would expect on this site. Repeating the search in google brought me a to a post that had several spam comments of the more nasty side. That gave me the idea of trying:

site:ayende.com explicit-word-or-phrase

I found a lot of those, sadly, and I was able to remove ~50 or so spam comments fairly easily. The main issue with spam is separating the chaff from grain, google made it very easy to find the bad stuff.

time to read 6 min | 1061 words

A while ago I added Mutli Query to NHibernate, but I didn't have the time to add Multi Criteria capabilties in time for the 1.2 release. As it turn out, I managed to implement it about three weeks ago, and only now I had enough time to sit and document it.

Just as a reminder, the end goal is being able to use NHibernate to send this query in a single roundtrip to the database:

SELECT TOP 15 * FROM Customers;  SELECT COUNT(*) FROM Customers;

That is the canonical example for this feature. I think that it falls into the "optimization tricks" category, but I have run into several cases where the functionality was critical to satisfying the time constraints.

At any rate, now we can use this functionality with Criteria as well:

IList multiResults = s.CreateMultiCriteria()

     .Add(s.CreateCriteria(typeof(Customer)).SetMaxResults(15))

     .Add(s.CreateCriteria(typeof(Customer)).SetProjection(Projections.RowCount()))

     .List();

IList customers = (IList)results[0];

IList counts = (IList)results[1];

int count = (int)counts[0];

This result in a single query being send to the DB, and multiply result sets returned to NHibernate.

A more complex scenario may be a page where you have to get several types of data:

  • Policy Types
  • Insurance Types
  • Paged Customers List
  • User personalizaztion info

Now, instead of hitting the database four times, you can package this into a single query, with four results sets being returned.

Caching is supported, but only for the entire mutli criteria query, so you can't cache just the policy types and hit the DB for everything else.

Have fun, and remember the rules of optimization:

  • Don't do it
  • For experts only: Don't do it, yet.
time to read 1 min | 92 words

No, I don't intend to beat him up, I just really like the title :-)

After infecting me (and pretty much everyone else) with witty songs about development, Roy has released one of his songs: Time for Violence.

It is my favorite song of the three or four that he had performed at DevTeach, and I keep humming to myself. Probably because it reflect so well the way that I think about "some databases" that I won't mention by name.

FUTURE POSTS

  1. Introducing: RavenDB Kubernetes Operator - 18 hours from now

There are posts all the way to Jan 15, 2026

RECENT SERIES

  1. Recording (20):
    05 Dec 2025 - Build AI that understands your business
  2. Webinar (8):
    16 Sep 2025 - Building AI Agents in RavenDB
  3. RavenDB 7.1 (7):
    11 Jul 2025 - The Gen AI release
  4. Production postmorterm (2):
    11 Jun 2025 - The rookie server's untimely promotion
  5. RavenDB News (2):
    02 May 2025 - May 2025
View all series

Syndication

Main feed ... ...
Comments feed   ... ...
}