Saturday, June 06, 2009

There are a number of very significant drawbacks in the O/R Designer that have no reasonable work around.

  • The Visual Studio 2008 LinqToSql O/R Designer is fine for a database with ~5 tables, no views, no stored procedures, and no functions, but it doesn't scale well much beyond that.
    • If the database changes, it's very difficult to manually update the O/R Designer properly.  As database complexity increases, this becomes near impossible.
    • When you need to remove an existing object from the O/R Designer to force it to update, it can be difficult to find that object.
  • It is overly difficult to diff the generated files from one version to another since the files are rewritten in a different order than they were read in when changes are made.  Even if the files can be sorted in a reasonable way, diffing the files is still not an effective solution for managing changes.
  • There are bugs with how the O/R Designer generates code.  In general, it is difficult to evaluate if the O/R Designer is working properly since it is difficult to diff the generated files before and after generation.  There are cases where the O/R Designer output is different than the SQL Metal output and in some of those cases, it could be a bug in either or both of the tools.
  • If two or more developers are working under an edit/merge/commit style of source control, it is difficult to resolve conflicts in the LinqToSql O/R Designer files during the merge phase.
  • It is not effective to try to diff O/R Designer generated files against files generated by SQL Metal as they don't use the same underlying code generation techniques and file sorting.  The two tools also have meaningfully different feature sets which negatively impacts the ability to diff the underlying files.

Once you start down the path of the O/R Designer, it gets increasingly harder to migrate away from it the farther you go.  This is a significant hidden risk as many of the scalability issues with the tool don’t present themselves right away.

It's not clear if any of these problems will be addressed in Visual Studio 2010.

This is not to say that the O/R Designer doesn't have very interesting and useful features.  It does have interesting and useful features.  They just aren't packaged in a way to make them at all usable for anything but very tiny databases.

Are there alternative LinqToSql code generation tools?

The main alternative tool is SQL Metal, which has quite a few drawbacks of its own.  While SQL Metal can scale up to much larger databases than the O/R Designer, it still can't scale effectively past a certain point.

Another free alternative is Damien Guard's LinqToSQL T4 Template.  Since the T4 template is not an official product of Microsoft and was built by a developer in their spare time, you'll have to judge for yourself whether it meets your criteria for "production worthy".

I may write a future blog entry with additional details on SQL Metal and the T4 templates.

There are non-free alternatives to the O/R Designer as well, but in many cases it is just not possible to get software tool purchases approved as part of the software development project budget.  It would be surprising if LinqToSql adoption hinged on the success of commercial third party tools.

Updated 2009/09/16 - Related blog posts:

The drawbacks of adopting Linq To Sql
.NET and ORM - Decisions, decisions

6/6/2009 4:02:30 AM (Central Daylight Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 
 Friday, May 29, 2009

LinqToSql does offer benefits to corporate IT organizations.  Microsoft marketing has helped spread that message.

It's less clear what the drawbacks of Linq To Sql are, yet I believe the drawbacks are important to consider before adopting such a large disruptive change into a software development environment.

Here are some of the downsides to LinqToSql that I have identified so far:

  • There is a significant learning curve.  The technology is deceptively approachable.  On the surface, for instance, LinqToSql takes a SQL Server database table and generates .NET source code for a .NET CLR class.  This appears to be a nice abstraction.  However, there is a significant amount of complexity involved.  The abstraction leaks.  Something doesn't work as you expect, so you start searching and reading and the reading seems to go on a lot longer than expected.  We are still early enough in the adoption cycle that many common issues and questions are under documented.
  • There is immature documentation.  As technologies mature, the documentation improves.  This is especially true of the documentation of more obscure issues available through things like google searches.  Right now, there are "gotchas" that remain hard to find clear discussion around.
  • There is a requirement for "seasoned" developers on the team.  The development team needs one or more developers who can learn new things quickly, handle significant amounts of complexity, and do the right thing without micromanagement.  These developers likely need significant SQL Server, ADO.NET, and object relational mapping expertise.  There is a limited quantity of these seasoned developers to go around.
  • There is significant competition.  There are a lot of players in the object relational mapping (ORM) world.  LinqToSql, other than being included free in Visual Studio, arguably doesn't add enough value (yet) to the space.  Many of the highest traffic parts of LinqToSql can be (and have been extensively) emulated with ADO.NET.
  • There is a significant amount of FUD and confusion around the future roadmap (i.e. version 2 and beyond) for Linq To Sql.  Microsoft is actively de-emphasizing Linq To Sql while maintaining that they will continue to support it for the foreseeable future.  While the Entity Framework may some day be a clear and straight-forward migration path for current Linq To Sql users, that is not the case today and Microsoft is having trouble with damage control around their confusing and mixed messages.  I wish I could link to something worth reading on this topic, but as I've said, Microsoft has really botched the communication on this issue.
  • There are significant bugs.  That is a normal course of business with anything that is basically on version 1 (and since VS 2008 SP1 has been released, LinqToSql could possibly be called version 2).  Here's an example of a bug that is likely to hit a decent portion of the LinqToSql user base.
  • There are significant tooling issues.  The O/R Designer and SQLMetal tools that come with VS 2008 are fairly blunt objects with fairly significant limitations.  While some commercial products have stepped in to fill some of the gaps, there are very limited free options available.  I hope to write a future blog entry with more details on the limitations in the VS 2008 LinqToSql tools (for one, see Do not use the Visual Studio 2008 LinqToSql O/R Designer).

LinqToSql will appeal to many people for many reasons and I think its momentum is likely unstoppable.

As with adopting any new technology, it's important to go in with your eyes open. 

Your mileage may vary.

Update 2009/09/16 - Here is a somewhat related follow-up blog post discussing where Linq2Sql matches up against other .NET ORMs: .NET and ORM - Decisions, decisions

5/29/2009 6:22:38 AM (Central Daylight Time, UTC-05:00)  #    Disclaimer  |  Comments [3]  | 
 Saturday, May 09, 2009

Here's a fairly nasty error message with a (sometimes) pretty subtle solution.  Let's say you want to insert a null value into a nullable database column with ADO.NET using parameterized SQL.  The insert statement could look something like this:

INSERT INTO TableName (ColumnName) VALUES (@NullableValue)

Let's say I setup my SqlParameter array as follows:

SqlParameter[] sqlParameterArray = new SqlParameter[1];
SqlParameter oneSqlParameter = new SqlParameter("@NullableValue", SqlDbType.Int);
oneSqlParameter.Value = null; // I want to insert the value null

If I ran the insert using the SqlCommand.ExecuteNonQuery method, I would get this exception:

--
System.Data.SqlClient.SqlException

Prepared statement '(@NullableValue int)INSERT INTO TableName (ColumnName) VALUES (@' expects parameter @NullableValue, which was not supplied.
--

What's wrong?  Apparently, "null" is not a valid value for the Value of a SqlParameter.  You need to do this instead:

oneSqlParameter.Value = DBNull.Value;

Is that error message helpful?  I don't think so.

There are plenty of other reasons why that exception could be thrown, but I've been using ADO.NET for a while and I still stumbled upon this particular under documented problem recently.  Very, very subtle.  Crystal clear error messages from software are so important, yet so uncommon in the real world.

5/9/2009 6:44:29 AM (Central Daylight Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 
 Sunday, May 03, 2009

More and more software products are including a feature that allows using the Lua programming language to author addons that add additional features to the base software product.

One of the most notable of those products is World of Warcraft.

World of Warcraft players can write Lua addons to modify and enhance the user interface in many useful ways.

As a player of World of Warcraft for three years, I've enjoyed using many of these addons and even started to create my own.

The addon I developed seemed useful enough that I thought other players may be willing to purchase the addon for real money, even though the large majority of World of Warcraft addons at the time were free.

Long story short, the company that created World of Warcraft turned on their addon developers and effectively outlawed addon developers from making a living from addon development.

In the process of trying to commercialize my lua addon, I wrote a code obfuscator for lua.  That obfuscator doesn't have much use to me at the moment, so I put a web front end on it and I'm publishing it to see if other people can get any meaningful use out of it.

This version (v1.0.0.4) is free to use with limitations on how many text characters can be processed per day and per IP Address.

Click here to: Obfuscate Lua

There is a feedback page as part of the lua obfuscator application that allows you to submit feedback of any kind.  Please let me know what you think!

5/3/2009 8:20:31 AM (Central Daylight Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 
 Saturday, April 25, 2009

If you launch an xbap file from the file system (i.e. Windows Explorer), the xbap web application will get cached in the ClickOnce cache (as opposed to launching the application from Visual Studio, which does not affect the ClickOnce cache).  You will always get that version of the application from then on no matter how you try to change or rebuild it in Visual Studio.  There are two workarounds:

1) Run "mage -cc" to clear the ClickOnce cache (this affects the entire ClickOnce Cache, not just this one xbap file).
2) Use the publish wizard in Visual Studio, which increments the version number of the xbap file, which causes ClickOnce to separately cache that version.

(This information is relevant to Visual Studio 2008 Service Pack 1 / .NET 3.5 SP1.)

4/25/2009 8:01:07 AM (Central Daylight Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 
 Thursday, February 12, 2009

Quick background: I used to hate Microsoft and love Linux.  Now, and for the last 9+ years, I have made a living almost exclusively as a software developer on the Microsoft development platform.

Every now and then, I check back in with the non-.NET world to see how things are progressing. (I actually have a decent amount of first hand experience with Java and Perl.  I don't really have first hand experience with Ruby or Python or many of the other flavors currently getting a lot of press.)

There is still a lot of ignorance, which exists everywhere.  There is a lot of Microsoft hate and Sun hate and even some Ruby on Rails hate.

Here's the thing:

If you are given a set of well written business requirements, and you are a competent developer on the relevant platform, you can bang out a relatively easily maintained solution on various technology platforms without much problem.

However, if you are on a team of incompetent people, you will likely fail regardless of the technology platform.

If the business requirements are not written well, you will likely fail regardless of the technology platform.

So, the question in my mind is: how much of an obstacle to project success is the technology platform compared to the people and the requirements?  I think the answer is "not much".

So, why is so much time wasted with the angst and religious discussions about technology platforms?  I would rather see developers do the following with their time:

1) choose jobs with good people
2) learn to hire good people
3) learn how the business (of your customers) works so you aren't so dependent on requirements written (almost exclusively) by people who don't understand the technology platform being used to implement the solution

In my humble opinion, developers spend way too much time debating things (like technology platforms) that have minimal impact on project success.

I guess it should go without saying, but moving toward project success is pretty high on the list of goals for almost anyone, anywhere.  The technology platform of choice has very little impact on project success.

So, how did I choose a technology platform for me personally?  I made a bet.  I gambled.  I guessed that expertise in .NET would translate best into an income stream.  In the end, I may be horribly wrong, but so far it's working out okay for me.  As long as I/you can feed my/your family, any technology platform of choice is good enough.

2/12/2009 3:22:30 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
 Thursday, September 18, 2008

I did not attend the Business of Software 2008 Conference this year, but I spent some time tracking down write-ups done by people who did.

There is a Business of Software 2008 Wiki with some notes (and hopefully more to come?).

Cary Millsap wrote up some notes.

Steve Jones wrote up some notes (and there may be more still coming).

Cliff McCollum wrote up some notes (and it appears there is more coming).  I just linked to his business tag, so that link will not necessarily be as useful a month or so from now.

That's what I was able to find in a few minutes of googling.  There is probably more out there.

I came close to going this year, but cost and timing weren't great for me.  I'll probably consider attending this conference next year.

9/18/2008 1:27:54 PM (Central Daylight Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, September 17, 2008

TheLadders.com is a job website for $100k+ jobs:

http://www.theladders.com/

They apparently don't understand how to store multiple versions of a resume in a database though.  You can have one resume that you either type by hand or upload (and they will parse it... poorly).  If you hand edit the resume either before or after uploading, it gets stored.  However, if for some reason you upload the resume again for any reason, all the hand editing (except the Professional Overview section) is lost.

I chose not to upload my resume as I didn't want to waste a lot of time fixing whatever mess their parser made.  I spent hours hand editing my resume into their custom user interface, which is honestly not too great.  When recruiters see your resume, it's actually generated from the data in their database into a Microsoft Word document that looks semi-horrible (my two page resume became four pages with major white space and formatting issues).

I then went to submit my resume for their "free resume critique" (assuming you are a paying customer, which you pretty much have to be to get any value from the website).  If offered me the option of using what I hand edited or uploading a Microsoft Word document.  I thought my two page, nicely formatted resume would do better in a resume critique then their ugly four page thing, so I uploaded a Word version.  It did not take long to figure out what I stated above: that upload deleted all the data I hand entered and replaced it with their parsed garbage.  Multiple hours of work lost because I was tricked into believing that they might have a clue on how important it is to treat user entered data with high regard and not delete it without the user's knowledge.

So, I clicked their "Live Chat" button to talk to a support representative where I learned that the only thing they could restore was the Professional Overview section.  The support person was pleasant, but evasive: she appears to have had this conversation multiple times before.  I was not pleased.  She offered two additional weeks on my monthly subscription.  I said I honestly wasn't getting much, if any, value from TheLadders and said I'd rather cancel my subscription and get a refund, which she did without a hiccup.

I've been using web applications for a long time and I honestly can't remember having a website delete my data without asking me first, yet now it's happened to me twice in one day by two websites that should have known better.  Users beware.

9/17/2008 3:48:27 PM (Central Daylight Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  | 

Stack Overflow is a new Q&A website for developers, which is still in beta.  You can read more about it here:

http://www.joelonsoftware.com/items/2008/09/15.html

The URL to access Stack Overflow is here:

http://stackoverflow.com/

I love the idea/theory/vision behind this.  I have been reading Joel Spolsky and Jeff Atwood's blogs for years and I really enjoy and respect them.

The execution of the idea leaves a lot to be desired.  My expectations were probably way too high.  Joel and Jeff blog extensively about usability, yet the usability of Stack Overflow drives me crazy.

Here is specific feedback on what I would like to see changed with the implementation of Stack Overflow:

Let's start at the beginning:  Login.  If you go to login to Stackoverflow (login is optional, but required for the vast majority of the features of the web site), you run into something called OpenID.  For some people OpenID is probably a non-issue.  For me, it is an issue.  You can Google OpenID and read more about it, I'm not going to try to describe it.  Here are my issues with OpenID:

1) I immediately have to make a hard choice:  Do I trust some third party with my OpenID information or do I roll my own?  I don't like either option at all.  Rolling your own OpenID is non-trivial and under-documented.  I don't have any trust for any of the third party OpenID providers.  So, I of course threw up my hands and chose the path of least resistance: I just arbitrarily chose an OpenID provider and I pray it doesn't hurt me later.  I'm still upset about this.
2) I have to read extensively to understand what OpenID is.  Honestly, I don't care what it is and I don't care for it.  It's solving a problem I don't have now and I don't foresee ever having.  Why does Stack Overflow force me down this path?
3) I now have a really long, difficult to remember, user name.

Okay, that's a pretty horrible way to start off, but I'm now logged in.

I find a question I like, so I try to upvote it.  Oh, I can't do that until I have 15 reputation.  Earning reputation is either really easy or really hard, depending how good you are at that "mini-game".  Honestly, I don't care to play the mini-game.  So my ability to contribute to StackOverflow is limited, I can live with that.  Usage of the site over time will eventually unlock most of the reputation based features automatically as long as you are logged in while using the site.

So, I'm looking at questions and answers and I see these little bronze and silver badges by people's names.  I wonder what that is about.  Well, unless you happen to click on the badges button at the top of the page, it's actually fairly difficult to find out.  Search is unhelpful.  The official FAQ is unhelpful.  The unofficial FAQ is unhelpful.  This is the best part: You are not supposed to ask questions on StackOverflow about how to use StackOverflow.  Seriously.

Okay, so the usability leaves a lot to be desired so far.  I don't think my "new user" experience is so different from other people, but that's how I've been made to feel so far.

So, if you have a question about how to use StackOverflow, what are you supposed to do?  Use Uservoice:

http://stackoverflow.uservoice.com/

What is uservoice?  It's a third party feedback web application.  The usability of user voice is much, much worse than Stack Overflow itself.  You get dumped on a webpage with very little clue where you landed, why you landed there, or what you are supposed to do.

Let's go through the exercise of trying to figure out what the badges by people's names mean here.  I type in "badge" in the "I suggest you..." box.  I get 5 matches, none of which look like what I want.  So, at this point I guess I should "create new idea".  I get a tiny little popup box to type in.  I can't edit or delete it once I submit it.  I can't comment on it unless I login.  Comments can't be longer than 400 characters.  When I try to login to UserVoice, I can't use my StackOverflow (aka OpenID) credentials.  If I need to include my StackOverflow user name in my Uservoice comment, I need to type it out as the two systems aren't really integrated with each other (although you might get the impression that they are integrated with each other due to the fact that StackOverflow is displayed much more prominately on the UserVoice site than UserVoice is).

At this point, I'm mostly hate the user experience.  Let's look at some of the other comments on UserVoice about the user experience:

Here's a problem that new users are having that got an admin response that I think is dismissive:

http://stackoverflow.uservoice.com/pages/general/suggestions/25645

Here's what I would agree is a very valid point about the FAQ confusion (in fact, I would criticize the FAQ situation much more heavily):

http://stackoverflow.uservoice.com/pages/general/suggestions/26292

Here's a "feature" that I hate, but has been declined by the administrators as not going to be fixed:

http://stackoverflow.uservoice.com/pages/general/suggestions/24812

Users hate when they spend time entering data into your system and it disappears with zero indication why.  That is a horrible way to treat users.

In general, the tone of admin responses I see on User Voice is horrible and makes me not want to contribute there.

--

As a new user I posted a question on StackOverflow about what badges were and the next day that question disappeared, so I asked another question which will likely also disappear.  While this link remains valid, you can read more of the details of my non-wonderful StackOverflow experience:

http://stackoverflow.com/questions/82208/yesterday-i-posted-a-question-and-now-its-gone-where-did-it-go-how-do-i-view-it

Right now, I have to say "thumbs way down".  I'm pretty upset with how I was treated as a new user and I'm not sure if I should give the site another chance if/when it moves out of beta.  Maybe the site will take off and everyone will love it and I won't have a choice.

--

Updated 08/22/2009: Why I'm Using Stack Overflow

9/17/2008 10:59:24 AM (Central Daylight Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  |