Sunday, 24 June 2007

FreshReports intro

I began to plan for FreshReports when I tried in vain searching for an open source printing framework. I, of course, used Crystal Reports a lot, but when I switched from Datasets to ORM (I'm using Neo), I was wondering if it is possible to print data coming from the object-oriented dimension.

Actually, Crystal can do it, but in a very awkward way. Since the engine is relational-oriented, the business object printing ability is a nice add-on rather that a main idea, so you treat your objects as somewhat crippled data rows, with all consequences.

Some other frameworks are presumably better with that, but I realized that all of them (well, all I have seen) are trying to be a sort of MS Access reports for .Net. All are trying to get past the business layer straight to the database. All are presenting the same section structure: you have your main data source, sort of a table, and you group it by some field, just like an SQL query. And none are open source.

FreshReports is a totally different idea. Let's see it one by one.
  • It's open source. I wrote in in VB.Net with a little bit of LINQ (from the May CTP). Why VB not C#? Because I know it better (I still think that C# would work better here). I do plan to make a commercial editor, but for now there's a vary simple standalone editor that just allows you to edit the source manually and preview it with a predefined data source.
  • It's extensible. You can add your own elements, aggregates, even sections. After I add layout rules and adapters, you'll be able to customize them, too.
  • You have a simple xml format for the layout. So, in fact, you can program your own editor, or you can have it autogenerated.
  • You have no predefined layout. You can have sections inside sections, or sections after sections.
  • You can have any object structure. Your data source doesn't have to implement any interface, even IEnumerable.
  • You can have any number of independent (or interdependent) data sources. Each section can pick an external data source, or a property of the containing data item.
  • It's testable. From the beginning, I've been developing it in a TDD fashion (however, as I was a novice, I actually did integration tests, and only recently I started to write unit tests, but I understood a lot in the process). And I do plan to add a testing framework later. All testing is done with TypeMock, and I'd like to thank the guys again for the great tool. Without it, it would be impossible to test the calls to the Graphics object which is in the core of all printing.
So, the first uploaded alpha version is, sort of, functional, and I even uploaded a small demo. I do hope that you try it and let me know.

No comments: