Andres Aguiar's Weblog

Right here, right now

Stories

November 2003 - Posts

Optimistic locking strategy

When a user gets an optimistic locking exception, his usual behavior is to confirm the changes he made overwriting the existing ones.

This behavior seems to imply that a 'last wins' approach is better, because what will really happen is that the last one will win.

This could be true if not for the fact that there are some fields in the database that have redundant information, for example a Customer balance. In this case, if two users read the current balance, increment it, and perform an update a 'last wins' approach will make one of the users to lose the changes and the balance will be inconsistent.

We are thinking on provide a better alternative. In DeKlarit you write the logic that updates the balance with declarative rules, something similar to:

CustomerBalance = CustomerBalance + Amount if insert;
CustomerBalance = CustomerBalance - Amount if Delete;
CustomerBalance = CustomerBalance - Amount.PreviousValue() + Amount if Update;

This means we know which fields have redundant information. If we agree that the user will always overwrite the changes, what we need to do is to overwrite all the fields but the CustomerBalance, and for the CustomerBalance, read the current value and apply the business rules.

This also solves a common scenario where the CustomerBalance is updated very frequently, and using a pure optimistic locking strategy will imply that you'll have a big chance of getting a conflict each time you try to update (i.e., the Coke inventory in Wal-Mart).

I'm not saying this would apply to all cases, but it's seems to be a much better approach than the usual optimistic locking (and of course than the 'last wins' approach) in a lot of situations.

Redmond and notebook batteries

I'll be in Redmond next week. As each flight to SEA-TAC is a long one, and the time I spend in planes is good for coding because noone interrupts me, and most of the times I get an upgrade to Business Class in United the seat does not have a notebook plug, I bought a Valence N-Charge battery.

It lasts 10 hours if you don't try to install the Longorn SDK from your DVD drive in a Virtual PC VM, in which case it lasts about 5 hours ;).

Recommended.

 

ObjectSpaces PDC Mapping Utility
ObjectSpaces PDC 2003 Samples and Mapper Utility This is the ObjectSpaces samples and tools that we distributed on the ADO.net samples CD at PDC 2003. Requires the PDC release of Visual Studio.
[via GotDotNet: Samples]
 
These are the tools Luca Bolognese used during his presentation on ObjectSpaces. One of the tools lets you create a database schema based on a set of classes. The other lets you create the XML files to map an existing schema to a set of .NET classes.
Managed LDAP

Managed LDAP binding for Mono and .NET

Sunil Kumar at Novell has announced the availability of a fully managed implementation of LDAP for Mono and the .NET Framework. You can obtain the library from Novell Forge's CSharpLDAP module.

[via Mono Project News]
Improving DataSet Serialization and Remoting Performance

There's a new KB article on the subject.

I still did not compare the performance with my previous solution, but this solution is much more general than mine so I expect the performance to be worse but it can be applied to more scenarios.

 

 

WinFs, Aero and Hailstorm

Remember Project Hailstorm (later called My Services)?

It was that MS project that suggested having all your personal data (documents, contacts, calendar, etc) aggregated in centralized servers so it would be accessible from anywhere, and that was cancelled because everyone got worried about having their data in Microsoft's servers (even if this was not required).

WinFS/Aero seem to target the same problem but from a different perspective. Instead of having that data in a server, you have it in your own box, so everybody feels better. What they did is to have a central local storage for that data instead of having each application provide its own.

If you add WinFS synchronization to the picture, then it's pretty much the same as Hailstorm. You will be able to keep all your data in a server and synchronize it to your local machine. I guess we'll see some activity in this area when Longhorn is released, like MS providing a way to store that information in their servers, in third party servers or in your own corporate servers.

 

Solving the Object -Relational impedance mismatch the other way

Ted Neward suggests solving the object-relational impedance mismatch by adding relational features to languages, instead of mapping relational databases to objects.

I like that.

 

 

Avalon is a Luxury item

Let's face it.

Everyone needs WinFS. Searching for data in Windows is a pain.

Most developers need Indigo. The ASMX/EnterpriseServices/Remoting thing is too confusing and selecting one is hard, and we need better tools to move distributed computing forward.

We really don't need Avalon. I love it, but we can live with our gray Windows Forms. Avalon is like driving a Ferrari. It's quite high in the 'computing Maslow pyramid'.

Avalon is a luxury item. In some countries you'll need to pay more taxes for using it ;).

Update: I probably mean Aero and not Avalon. I'm referring to the supercool-looking UI.

VSIP Extras - VSIP Extensions in managed code.

Now you can write VSIP code in C#! I hope this will reduce the number of times I hear 'it was an extra AddRef' ;)

http://www.vsipdev.com/extrasbeta/default.aspx

 

Object Relational Mapping BOF

When you have a booth in a MS conference, you get 3 'Exhibitor Staff' badges and one 'Attendee' badge. I usually get the Attendee one, but as this time we wanted to be present in most conferences, and I needed to be in the booth when the Exhibit Hall was opened, someone else from the DeKlarit team got the Attendee badge.

I was able to attend to all the BOFs with my purple badge, but when it was the turn of the O/R mapping BOF, the guy in the door did not let me in. He was probably right, but it was really a shame, as Scott, who was hosting the BOF, asked at the beginning if there was someone from DeKlarit and it would have been great to be there.

So, I went to the Smart Client BOF, and at the end I waited for Scott and invited him to go to the DeKlarit booth on Wednesday to exchange ideas. We had a good conversation, he is a very open guy, and I tried to explain him why DeKlarit is not an O/R mapper as it tries to build the Business Logic layer, not the Data Access Layer (and you usually use a O/R mapper inside the Business Logic Layer). I'm don't think I fully convinced him on the DeKlarit approach, but I think he got intrigued enough to give it a try.

More Posts Next page »