C/C++

XL Dev Con – Writing addins in C – Charles Williams

I was looking forward to this one. Charles has huge respect in the Excel commuitely, and has a list of achievement’s as long as I am tall. Charles is talking about how hes getting on with writing addins in C. This is proper C  not that C# rubbish!

Charles first makes the case for why he’s moved over to C, 64 bit and speed beign high on the list.  Next its in to VS2010 and Planatech XLL+ with a walk through of how to do it, and some of the gottas for a VBA to C convert. I’ve done a few Pure C XLL’s, using such tools a WXL it works well, but  XLL Plus sure looks nice, I like thoses wizards!!!

image

Synonymous with Speed Charles Williams at the helm

It was an insightful talk, not only for the how, but also for the, – it takes me longer, but is that because I have worked with VBA for 20 years? – I’ll ask if the speed gap has come down next year Charles!

XL Dev Con – Portable Code – Mike Staunton

Dr Mike Staunton author of such modern classics as Advanced Modelling in Finance Using Excel and VBA (The Wiley Finance Series) and Advanced Modelling in Derivatives Using VBA and C++/CLI (The Wiley Finance Series) and Triumph of the Optimists: 101 Years of Global Investment Returns and a few other ones as well, gave a entertaining talk about making code portable.

I just save my code to a USB, and that’s as portable as it get, but that not what Mike was talking about!! ;-) [Hilarious that one Ross!!!]

Mikes suggestion, or if not a direct suggestion then at least the offer of a alternative method, should portability be of interest was to limit the typing conventions, and to avoid where possible the use of function structures or orators  inherent to language type – for example Square Root can be taken as SQRT(A ), or A^int(b) and so on.

Dr Mike Sutton, don't mind your language

After this its a case of editing the file, what Mike referred to as Find and Replace, but what programmers call re-factoring, because their cleaver like that!

The benefit of of all of this was a speed up in the running of the code “for free”, by allowing it to be implemented in a different language, in Mikes case XL DNA, but also as he pointed it at this point it not that far away from C++ if that floats you pointer…

Thanks Mike, who’s next?

The MIE Podcasts – Govert van Drimmelen

In this podcast we caught up with Excel DNA author Govert van Drimmelen. Govert is a Mathematics lecturer at the University of Johannesburg, in South Africa. Excel DNA has had some attention from the Excel blog sphere in the past few months, Simon, Mike, and Mathias have all posted about it. I’ve been using it for a while now, and it’s brilliant. Here we talked about how Excel DNA came about, the basics of how it works, some of the new features and what’s planned for the further.

Govert van Drimmelen, famous for his Tom Selleck impression

If you don’t know what Excel DNA is, well then listen to the podcast, but in short it’s a free and easy way to get .Net code into Excel.

I’m sure you will all join with me in thanking Govert, not only for making time for the podcast, but also for all the hard work he’s done  in getting Excel DNA out of the door – well done Govert!!!

And remember if you’d like to see more of Excel DNA, I’m giving a talk about it at the UK Excel Dev Con, in a weeks time!!!

A Devlopers Tool of Choice?

When we talk about which language to use we often, if not always get talking about the technical advantages of a given tool, XLL’s are faster than VBA, VBA is easier to deploy than VSTO, VSTO is more secure than VBA, and so on and so on. Simon has some information here and I have some .Net stuff here. But one aspect that’s over looked is what each offers the developer.

Let’s consider an example. I’m writing a adding for the users in my department, it needs to contain some UDF’s, apply a custom formatting option to a selected range, help import a strangely formatted XML file, and link to a database and pull back some data. What are you going to write that in?

Well from a technical point of view you might like to used an XLL for the UDF’s, a Com adding for the formatting and database stuff and make use of some .Net classes for the XML processing. Nice!

For 90 percent of us, we will solve every problem using VBA, simply because that’s the only tool we have. But what if?

Here’s what I think different technologies offer the developer, not the technological advantage, it the things that make the developer’s live more enjoyable!

VBA: For simple stuff it’s quickest. As things get more complex and or the difficulty of what you are trying to do gets harder VBA becomes more of an effort (think of userform stuff, VBA, vs .Net?!). If you need something that needs constant changes, or something that you expect to grow in size over a period of time it might be worth doing it VBA.

VB6 (Com addins): If the UI you need is a bit more complex, than it might be time to switch to VB6, the more powerful forms and use of active X components means that you can have more choice when designing them. Also from a deployment POV, you have to worry less about the thing being installed on the PC, as you can compile them into the DLL

As the size and complexity of the project increases, switching to VB6 can be a help. Functionality can be complied in to different parts, external libraries can be used and packaged easily, source code can be shared with other developers – although this is rare for Excel projects.

Another good reason for a developer to pick VB6 com adding over VBA ones is that, although generally VB6 code can be changed with little effort to run in VBA, there are times when VBA does not quite have the same feature set, and dropping some code straight in to a VB6 com addin is just easier than messing around trying to convert it to VBA.

VSTO: Well its IDE isn’t 100 years old, thats a big plus! But the most compelling reason why an Excel dev would want to use VSTO, would be to make use of the framework. Forms are incredibly powerful in .Net (form namespace), but so too is all the functionality that the framework provided, like the threading name space, or the services name space. When we start to try and do really grand stuff, .Net is brilliant.

C/C++ [XLL]: Purely from an easy of development POV, I can only really think of 2 things XLL would over. One would be a situation where you need to deploy is a “hostile” environment, so the extra work in the coding would be repaid in the effort saved deploying. The other would be if there is a C library with some complex functions in it, a bit like with the VB/VBA issue, it might just be easier to keep the C code and wrap it up in a XLL.

VSTA: What’s VSTA?!?!

So there you go that’s my take on it, disagree?

Is C# like Robby Williams?

When Take That first came on the seen Robby Williams was a young sexy super stud, loved by all, women wanted to be with him, men wanted to be him (ok, maybe the analogies not perfect). Now he’s a slightly overweight widero who chases flying saucers.

And so C#. When it came out (easy!) developers flocked to it, hailing it’s development speed over C++, and hoisting it’s strongly typed compile time error detection pants up the flag pole of integrity. Now, with C# 4 around the corner, those panties have slid down the pole a bit, as MS have seen fit to invite a bloshy Dynamic Runtime Library sorry, Dynamic Language Runtime (- what every it’s called!) to the party.

What am I going on about? Well, MS have stated that they want to bring VB, and C# much closer, so that new features in either language (read C#) are deployed at the same time in both. Other stuff that’s coming with the new release of .Net is the Dynamic Runtime. I’m no expert – in fact what I am is a Luddite on a soap box – but for this to work (with out having to write 10 million lines of code), C# has to have much of the features of VB, basically dynamic types. This is not necessarily a requirement at the developer code level, but required to make the language work with external object. This in turn means that .Net can work more directly with Office and all other components developed in other languages! – cool!. Hence why they can get rid of the dreaded PIA’s.

Along with this MS are making other changes, like named arguments and not having to write ref missing 10 billion times to fill out all the optional parameters. Also in VSTO deployment is getting better too.

So the point? well 2 things really:
1. In both VB and especially C# it’s getting easier to develop,… for Office.
2. C# and VB are getting even more alike, expect to see “with {}” some time soon. Why an organization would invest in developing 2 languages that both have the same strengths and weakness is for Stevie Bulmmer to debate, but I can’t see the point can you?

As always, M.I.E will be the 5th or 6th to bring you slightly wrong information about the latest developments in the world of Office and .Net.

Some links worth reading if you want to find out more:
The Future of .NET Languages
Office client developer enhancements with VS 2010
VSTO news