Andres Aguiar's Weblog

Just My Code

December 2002 - Posts

Boowa and Kwala

I have a two year-old kid that loves Boowa and Kwala, two characters that 'live' in www.uptoten.com. It's a Flash site, and has content in English, French, Spanish, Italian and Dutch.

It's a great site for kids.

 

Stored Procedures Myths

I have to admit I don’t like stored procedures. I understand their advantages, but I still don’t like them, so it’s probably irrational thinking.

Anyway, I think SQL Server programmers have an equally irrational love for stored procedures, and I’ll try to explain why, so I do not feel alone in my irrationality ;)

There are several reasons to use stored procedures. My focus here is in the ‘it has better performance/it scales better’ argument.

The SQL Server best practices suggest writing a T-SQL stored procedure for each sentence you want to execute. There was a good discussion in the developmentor CLR list about this some time ago. 

Oracle programmers code in PL/SQL, but it’s not very common to see ‘one-sentence-stored-procedures’ in PL/SQL. I’m not an Oracle expert, but in the Oracle developments I was involved, there was no PL/SQL, or complex PL/SQLs, but not the kind of stored procedures you see in SQL Server.

There are a lot of Oracle applications that have high performance and scale, and that are not using stored procedures ‘a la SQL Server’, they are probably using ‘Prepared Statements’ from the middle tier.

Java programmers seldom use stored procedures. They are not portable, it breaks the ‘write once run anywhere’ motto, and it means to not to write in Java, and we know Java programmers just code in Java (this is a joke, I can explain it upon request).

Java programmers build high performance applications that scale.

So, the theory that if you don’t use stored procedure your applications won’t have good performance or scale does not seem to be right.

Anyway, SQL Server programmers insist to make their lives more complicated and write stored procedures. I think this is for the combination of two reasons:

First, in SQL Server, you cannot have two SQL commands/sentences executing at the same time. If you want to have two open cursors, you cannot do it. If you want to have an open cursor and do an ‘Update’, you cannot do it. The way to be able to do this kind of thing was to use ‘server cursors’. There are a set of stored procedures that work with server cursors. One lets you create a cursor and returns a handle, other lets you fetch the next block of records, another lets you close it. So, if you work with ‘server cursors’, you are really executing stored procedures, so you do can have any number of open cursors. ODBC/OleDb/JDBC drivers usually mask this behavior with their cursor support. Server cursors impose more load in the server, so they should be avoided if you want to have good scalability.

Second, in VB apps/ASP pages that used ADO, it was very easy to use server cursors, you could do it without noticing it, so naively written ADO apps usually had bad performance and do not scale well. The best way to fix this was to convince the developers to use stored procedures instead of doing SELECT statements in the client. This way, there was no way to use server cursors, and the apps will scale better.

In my opinion these are the reason why some SQL Server developers always use stored procedures. It was the way Microsoft found to discourage the use of server cursors.

Some other facts that seem to be in line with my thoughts:

  • ADO.NET has no support for server cursors. This way naive programmers can't go wrong. ADO.NET applications usually have good performance/scalability without the use of stored procedures.
  • Microsoft’s latest implementation of the .NET PetShop application does not use stored procedures.

 

Post OO

Graham posted some thoughts about operations being first-class entities instead of objects being first-class entities.

I agree with Jason in that the advantage is not very clear for a String class, but I think Graham is absolutely in the right track if we are talking about ‘domain data’. The idea of having domain data as ‘plain objects’ with public data, that was discussed in the blogsphere some time algo, it’s a perfect match for this approach.

We should have ‘Actions’ that work with an Invoice instead of Invoice methods. It decreases the coupling, it’s a perfect match for today’s stateless components, it makes easier to design message based applications, and it works great with WebServices.

 

Application Architecture for .NET: Designing Applications and Services

A new MSDN document:

This guide provides design-level guidance for the architecture and design of .NET Framework applications and services built on Windows 2000 and version 1.0 of the .NET Framework. It focuses on partitioning application functionality into components, walks through their key design characteristics, explains how security, management and communication apply to each layer, and provides information on how the components should be deployed

More reading for the holidays...

And the 'hack of the year' prize goes to...

Exchange Blog

Exchange Server 2000 rocks. Within a couple of hours, I've been able to render my weblog posts directly from an Exchange public folder. Rendering is done live with an ASPX page whereas the page caching mechanism saves the server from getting overloaded. Here's how it looks like: ExchangeWeblog.gif (60kb).

Now, it's time to generate an RSS feed and import the posts from Radio (which fortunately allows the posts to be exported to XML)

Today's favorite technologies: ASPX output caching, Exchange 2000, CDO

[via Ingo Rammer's DotNetCentric]
 
This is really cool. As soon as Ingo releases the source code for this, I'll give it a try!
 
Newzcrawler

Does anyone use Newzcrawler?

I just checked out Jeremy Allaire's Radio blog, and he pointed me to an interesting application called Newzcrawler. The screen shots look really good. It's got a pretty nice interface for managing my RSS feeds, and it also has the advantage of having built-in blog posting software.

I suspect that once my Powerbook arrives I'll be using Brent Simmons' most excellent looking NetNewsWire reader, but I still need something for my Windows boxes. Any opinions out there?

[via IUnknown.com: John Lam's Weblog on Software Development]
 
I've been using it for a while, it's really good. It is the best aggregator I know, I use it all the time, and it's my primary browsing tool.
 
The only feature I miss is support for https or NTLM. In my company there are a couple of internal RSS feeds I would like to consume and I can't.
 
 
COM was not love II

At the tomb of the IUnknown Interface

As COM is dragged kicking and screaming towards the airlock, a strangely dry-eyed COM warrior celebrates its demise.

[via sellsbrothers.com: Windows Developer News]
 
 
Windows Forms DataBinding

Win forms databinding: so much promise, so much complication, so much confusion.
Two excellent resources:
DataBinding Chapter (free) by James Henry.
How databinding really works. Quite depressing, really.

[via Dot Net Dan]

Founders as CEOs
about a month ago i made the decision to bring in a seasoned CEO to run the mind electric. it's always tempting as a founder to stay in the CEO role, but if you're a technologist such as myself, there is absolutely no way to run a company and continue to play a lead technical role. in addition, i'm the first to admit that michael broderick's CEO skills are way beyond my own! it is really great to be able to focus 100% on my lead architect role.
[via graham glass' Radio Weblog]
 
Congratulations Graham... I really admire company founders that are able to do that.
 
 
Web Services Enhancements 1.0 for Microsoft .NET

Here's the big announcement: Web Services Enhancements 1.0 for Microsoft .NET (WSE) provides advanced Web services functionality for Microsoft Visual Studio .NET and Microsoft .NET Framework developers to support the latest Web services capabilities. Enterprise ready applications can be developed quickly with the support of security features such as digital signature and encryption, message routing capabilities, and the ability to include message attachments that are not serialized into XML. Functionality is based on the WS-Security, WS-Routing, WS-Attachments and DIME specifications.

Web Services Enhancements 1.0 for Microsoft .NET is the released and supported version of the Web Services Development Kit Technology Preview (WSDK).

Download Web Services Enhancements 1.0 for Microsoft .NET Leaving MSDN and XML Web Services Developer Center

The articles below explain how to use the WSE in conjunction with Microsoft ASP.NET to build more sophisticated Web service applications. If you haven’t used the WSE before, start with Programming with Web Services Enhancements 1.0, which describes the kit’s basic architecture and programming model. If you want a more general conceptual understanding of the specifications the WSE implements, see Understanding GXA.

[via Sam Gentile's Radio Weblog]
More Posts Next page »