Why Use VSTO?
Today someone in the VSTO newsgroups asked a good question about "Why Use VSTO?" He was genuine in wanting to know why someone would use it, especially since he is writing a book that might cover the subject. For some reason I started writing a response and couldn't stop. I've been wanting to express these opinoins for a while, so I'm reposting my response here. If you have been around VBA for a few years, it should be good for a chuckle.
MY RESPONSE --------------
The ONLY advantage is the .NET Framework and VS.NET. (Please add a tinge of sarcasm to the word ONLY as you read it).
1. It's Only Version 1, We Must Be Patient
It's important to remember that this is a version 1.0. This only means there will be a version 2.0 and 3.0 and so on. The type of solutions that will be possible will expand well beyond the current Word & Excel Document centric universe of VSTO 1.0. Someday, we will be writing managed code in all the office apps. When? I don't know. But this is a good start and is preparing us for the future. It tells us that managed code is the future.
2. There is Always a Start
Many years ago, I was programming in WordBasic, AccessBasic and some weird thing called Excel 4 Macro language. Those were good and simple days, though I don't miss them in any way. Then Microsoft said the future would be something called VBA. Excel 5.0 was the first office app to ship with VBA and none of the others did (kind of sounds like VSTO 1 doesn't it). We kicked and screamed because we wanted VBA in every application and did not want to wait. However, we signed up and started learning VBA. It helped us with Excel 5.0 and prepared us for future VBA enabled applications. Today we've reaped the sweet rewards of VBA bliss.
3. VBA (and big daddy Visual Basic) Retirement Party @ My House
Yes, our beloved VBA has many wrinkles and lots of gray hair. I saw VBA packing up the things in her office the other day, taking the pictures down from the wall, and hugging everyone good-bye. Yes, that sweet old lady has done her job and is ready to ride off into the sunset.
On a more serious note, have you used the VBA Editor lately? (Circa 1994) -- See Point 4
VBA and VB are useful languages but lack the sophistication and elegance that modern day applications need. -- See Point 5.
4. VS.NET is About Productivity
The VBA editor is simple and does the job. Even so, it hasn't been updated in years. It lacks important productivity tools, doesn't scale, doesn't support source code control (or not very well), and did I mention hasn't changed in a longtime. Visual Studio.Net on the other hand takes the cake. It is a great environment that focuses on the individual productivity of the developer with robust tools needed in the enterprise. Granted VBA had the VS.NET editor, things would be so much better. But not as good as it is already. See next point
5. Framework Baby! It's all about the Framework!
Don't even get me started comparing the VBA & VB function and class and control library to .NET. There is no comparison. There is a staggering amount of benefits the framework brings to the table for every developer: Great form controls, hundreds of useful classes, granular security, server scalability, object oriented features, multiple languages support, and a thriving community.
:-) Its Friday evening, I needed to unwind.
Richard, if I were buying your book, I would hope it would be helping me advance my knowledge and career for today and for the future, not for yesterday. You don't have to tell your readers that VSTO is the solution to all things. ITS NOT! It fits certain types of solutions well and is a step toward the future.
So if I'm building a Word or Excel documented based solution, why would I use VSTO? It gives me a direct hook into the document or workbook. No longer am I limited by the small VBA function library. No longer am I limited to the MS Forms package. No longer am I limited by the limited controls of MSFORMS or activeX controls, the libraries comes with many and if I want I can easily build my own user controls. No longer am I limited to limited object oriented programming capabilities. No longer do I have to worry about fragile references to libraries like ADO or MSXML that often break. No longer am I bound by the limits of the Editor. No longer do I have to work with VB only, now I can use C#. I no longer have to deal with the limited security model of Office.
Beyond that, I don't feel strongly about it :-)