Frans Bouma's blog

Generator.CreateCoolTool();

Syndication

News




    Add to Technorati Favorites

About me

Fun stuff I created

My work

October 2003 - Posts

DB2 will get .NET integration!

(via Randy's blog). Infoworld reports that IBM will enhance DB2 with .NET integration. Read the infoworld article here.

For me, this is the best news in months and for .NET this is one of the best things that could happen to .NET: other big corporations see the importance of supporting .NET in their software. DB2 will be able to host the CLR, but the article doesn't say if this means that for example an AS/400 will be able to run stored procedures in C#, because at the moment there is no CLR for OS/400 (DB2 now generates C from stored procedures which is compiled).

IBM will also release a native .NET provider for DB2 which is great, since their DB2 database can now only be accessed through OleDb from .NET (or you have to be brave enough to use the beta provider ;) ). All in all, great news, and I hope this action from IBM will trigger that other database vendor, Oracle to follow its path: include functionality to host the CLR inside the RDBMS.

Posted Sunday, October 26, 2003 12:27 PM by FransBouma | 3 comment(s)

Short list of non-obvious things determined from the C# 2.0 draft

A short list of things I could determine from the C# 2.0 draft which was released yesterday which are not a topic of much discussions but are good to know. I've added page numbers to the items, so you can go back to the C# 2.0 draft yourself and look them up (page numbers are the actual page numbers on the page). I've skipped the features: Generics, Anonymous methods, Iterators and Partial types, because these are the obvious items discussed in the draft :)

  • No support for multiple similar overloads with different returnvalues (Page 18)
    Sometimes you want to specify different overloads which have the same method declaration (method signature) but differ only in return type. There was speculation that support for this would be added to C# (Eiffel has it). However on Page 18, an example shows us that it will not be added:
    class G1<U>
    {
    	long F1(U u);	// Invalid overload, G<int> would have two
    	int F1(int i);    	// members with the same signature
    	// ...
    }
  • Support for Nullable types (Page 27)
    A very nice thing that will be added to .NET is the support for Nullable types. In .NET 1.1, you can't use an int variable in a situation where you want it to be null as well. You could use SqlTypes.* but these are not serializable. LuKa has programmed Nullable types for .NET, but that requires that someone using your code includes a reference to that library. A native FCL version of Nullable types is a welcome addition.
  • Type inference reduces typing, increases complexity for the reader (Page 30)
    Type inference is the mechanism the compiler will use to determine which constructed type to use by looking at the type of the parameters passed in. Example:
    class Util
    {
    	static Random rand = new Random();
    	static public T Choose<T>(T first, T second) {
    		return (rand.Next(2) == 0)? first: second;
    	}
    }
    will result in different types in the method when called using different types:
    int i = Util.Choose(5, 213);		// Calls Choose<int>
    string s = Util.Choose("foo", "bar");		// Calls Choose<string>
    
    While this saves the developer some typing, it is less readable code, IMHO, because when used with parameters, it is harder to determine by simply reading the code which constructed type the method will have.
  • Properties, events, indexers or operators may not be generic (Page 32)
    This may be a big item for some people and I fail to see why indexers and properties aren't among the elements which can be made generic. Especially properties and Indexers are extremely important for generic collections. But perhaps I'm mistaken and I didn't read the draft correctly.
  • Partial types must be compiled together (Page 70)
    I quote: "All parts of a partial type must be compiled together such that the parts can be merged at compile-time. Partial types specifically do not allow already compiled types to be extended.". It is understandable from a compiler's POV, it can be confusing perhaps when starting with Partial Types. Partial Types are extremely useful for code generators, and I can't wait to implement them :) The only fear I have is that Partial Types will not be part of VB.NET, so code generators which target multiple .NET languages are not helped by it in some cases. However I read somewhere that ASP.NET 2.0 uses partial types so VB.NET should support them as well.

I haven't looked deeply into iterators and anonymous methods yet, plus I'm sure I've overlooked some non-obvious gems so when you have any extra info, post them in the comments :)

Posted Saturday, October 25, 2003 3:13 PM by FransBouma | 5 comment(s)

Filed under:

On Microsoft's new Security Bulletin release scheduling

I read The Inquirer every day through their RSS feed, and although its often amusing, they now have a very valid point: Microsoft's new release policy according to security fixes/bulletins is completely irresponsible.

Microsoft has now decided to release security bulletins and fixes only once a month, to make it more predictable when they are released and sysadmins can now plan upgrades easier. When I read that the first time, I thought: "WTF!? What are they thinking?". And it is still my opinion about the matter. This is serious stuff, people: when the Thursday after the security fixes are released a flaw is discovered and posted on the security focus forums, you have to wait at least another month before you get the fix, instead of the old situation where you could expect a fix perhaps within 2 days.

I simply don't see how a company that thinks security is its top priority, leaves customers in the dark by not handing out fixes when they are available, but waits until a scheduled release date is reached. How does that help security? It only helps crackers and scriptkiddies to enter our servers because we can't patch the software with a patch that is already done. It is easier for sysadmins because they can now schedule downtime and patch the systems with an easy one-exe-for-all-the-fixes-download but it comes with a cost: it leaves systems vulnerable while patches are done.

Sorry Mr. Ballmer, you can shout as hard as you can how much effort Microsoft is putting into security, there is still one thing that you don't understand after all these years: when you make security your top priority, it is then thus more important than usability, however up till today, usability seems to be more important than security. We're talking sysadmins here, for crying out loud. Monthly patches? Great idea, but at least offer the patches as separate downloads also for the people who want to patch their systems when the patch is released. Thank you.

Posted Wednesday, October 22, 2003 11:39 AM by FransBouma | 6 comment(s)

Filed under:

Oracle 9i is already generations ahead and shows a .NET flaw.

I'm a database purist. This means that I like, no, adore database theory and the technology behind databases. Databases are one of the most high-tech software systems we all work with today, although not a lot of people will recognize them as such. As a developer using Microsoft software for years, I used SqlServer, starting with v6.5 till today with SqlServer 2000. Lately, I had to work with Oracle 9i to write the Oracle driver for LLBLGen Pro. This required me to learn more about Oracle than the usual SELECT * FROM Foo material. What I discovered was something I didn't expect: Oracle 9i is amazing.

Some people I talked to about Oracle were all telling me the same things: the tools were crap, the documentation sucks, it's a pain to work with, the run-time optimizer is not up to par with SqlServer 2000's and so on and so on. For the tools and the documentation, I agree. But are these mandatory for judging a database's value? I don't think so. For the run-time optimizer, I don't think that the 9i optimizer is really that bad, about as good as SqlServer 2000's. I wasn't impressed by these "but Oracle is not that great"-FUD. What impressed me was Oracle's feature set. Looking at that feature-set you can only conclude: what Oracle 9i offers today is generations ahead of SqlServer 2000 and we (that is, the .NET developers) can only hope Yukon gives us what Oracle 9i already offers. Oracle 9i also showed me a severe flaw in .NET which can only be solved by Yukon which is a year away.

The reasons why I find Oracle generations ahead are listed below. Keep in mind that I'm a database purist and you're probably a database pragmatist. I'll write about the differences between purists and pragmatists in another article.

  • Sequences. Oracle doesn't have 'Identity' columns. It has sequences. Sequences are objects which control a sequence of numbers in an atomic way. Although the Identity functionality can be seen as a sequence, it is not, for the reason that the 'sequence' of numbers an Identity column creates is bound to the table instance the column is in. Re-create the table, the existing 'sequence' of Identity values is gone. With sequences as Oracle defines them, you don't have that problem. Another problem with Identity columns is that they're part of the DDL of the table. A sequence in Oracle is an object in the database and is not part of the table. This means that the DDL is portable because the values for the column(s) that are supplied by the sequence are retrieved from an object outside the table, i.e. the sequence, and thus can be replaced by another object outside the table, for example a stored procedure, a trigger.
  • MVCC. Multi-version-concurrency-control (MVCC) is a feature that is something a good database needs to have however SqlServer doesn't have it. In short, it modifies data in a table field completely outside the table field and replaces the data in the table field when the transaction is committed. For other threads working with the same table field it is completely transparent how many transactions currently are working on that table field. This has the advantage that no thread is blocked by a lock from another transaction. In SqlServer this isn't possible without specifying NOLOCK as select hint or simply starting a transaction that allows uncommitted reads, which is bad (because what to do when the transaction rolls back? A read of uncommitted data might have happened). When you don't do all this, you can run into dead locks.
  • Schema driven. Oracle doesn't know the 'database' concept as SqlServer does. When you have only worked with SqlServer and are then confronted with Oracle, you probably will be very confused with Oracle's different view of the world. "Where are the databases?". Oracle is the database. You have schema's and these schema's are bound to a user, the user you login with. This is amazingly simple and yet very powerful: when you log in as user U, you see the objects you are allowed to see. That's your world. This way you can work with 'views' on the data in a pragmatic way: application A needs table A, B and Z. Create a schema and add these tables to that schema (using synonyms, see below). Login with the user equivalent to the schema and you're done. No requirements of cross-database references. To me this is what database systems are all about: offering different views on the data they contain and maintain. Database systems should extend this further and offer multi-paradigm views on the same data as well: relational and Object Oriented.
  • Synonyms. One truly great feature is synonyms. Synonyms are used to hide away the real objects you work with. This can be very helpful when you want to construct a new schema for a new user. Just create synonyms and you're set. It also helps with maintenance, because when objects are renamed/moved you just have to alter the synonyms, not the programs targeting these objects.
  • Truly user definable types. We now come to the core of this article: user definable types (UDTs). UDTs are what makes Oracle truly generations ahead of SqlServer. UDTs in Oracle are not just silly redefines of existing native types, but are true new types, with properties and methods. If I'm not mistaken, Yukon doesn't support these, it will fall back on XML. UDTs are limiting portability of the DDL, but are extending the DDL inside Oracle with great power. This power really shines when you take into account that you can use these types as real objects inside Oracle by using Java. No more external check constraints, you can define these right inside the UDT and access the UDT using Java (or PL/SQL!) which is called from your Java application. .NET can't work with these UDTs. It simply can't work with them. No current .NET provider for Oracle (ODP.NET nor MS' Oracle provider) can work with tables with UDT columns. The reason for this is that for example the DataSet can't deal with custom types: a DataColumn has to be of a type in a range of a select group of native .NET types. This is a serious flaw. Because the DataSet can't cope with UDTs, why bother implementing UDT support in the .NET provider? This however limits Oracle usage from .NET and not because Oracle lacks some functionality, but .NET does.

Support in .NET for UDTs is important. Not because everybody needs them, but because when .NET has support for UDTs, the framework's design is flexible enough to face the future and that design is done with that future in mind. In Java this problem is non-existent: an n-tier application can be implemented inside and outside of Oracle (or DB2 for that matter), using the full potential of Oracle (and DB2). On .NET we never will because the design of .NET is not targeted on flexibility, but on integration. Integration of Microsoft software: .NET will offer somewhat the same functionality as Java will with .NET 2.0 and Yukon, however this still doesn't make it possible to target Oracle and DB2 with full power. I hope I don't have to remind the reader what the total market share of DB2 and Oracle is compared to SqlServer.

As a database purist, that makes me sad and I'm sorry to say it, but all those hail and praise stories about .NET compared to Java... forget it. .NET is great, but it has a lot to learn when it comes to databases and I only hope it is not too late.

Posted Monday, October 20, 2003 11:48 AM by FransBouma | 39 comment(s)

Eric Sink's crabbyness

One of the blogs I would recommend to everyone is Eric Sink's blog. Not only are the blogs insightful and full of knowledge, they are very well written and most of the time great entertainment for the geek's eye and mind.

Today's blog about two bugs Eric and his team ran into (in other people's software) is highly recommended: for the great illustration about how stupid some developers can be, for the style the blog is written in and for the way Eric manages to crank in a lot of humor into his texts without effort as it seems. Eric: more blogs please :)

Posted Saturday, October 11, 2003 12:40 PM by FransBouma | 2 comment(s)

More Posts