I just had this idea: sometimes I find myself traveling to a certain area, and my time there doesn’t fit in perfectly with other commitments. So I end up with gaps in my schedule, which isn’t great. In such cases I’d like to fill the gaps, but just sitting back and waiting for a customer request that happens to fit with the time and the location doesn’t usually work very well. Yes, that’s an understatement :-)
Here’s my idea now: on my new Book Me While I’m There page, I will list timeframes in my schedule where I find myself in a particular region, and I would like some additional work. If you think you’re close enough and you’d like to meet up with me one or more of the days listed on the page, let me know!
And since you’re helping me out, I’ll give you a discount on my daily rate, plus you probably save money on travel cost. Much easier this way to get me in just for one day, if you just want to get to know me etc. It’s meant to be a good deal for both sides!
Okay, now click this link and check out whether I’ll be close to you and you might want to Book Me While I’m There!
I just stumbled upon this other thing that I don’t think I know: is it possible to dispatch really dynamically through the DLR, from C#? Let me explain.
We know that we can use dynamic in C# 4.0, like so:
If you haven’t checked out code like this in Reflector, go ahead and do so. You’ll find that the C# compiler generates a rather large amount of code for each “dynamic call site", which calls into the DLR and instructs it to dispatch the calls (in the case above to the operator + as well as the DoSomethingYouCantReallyDo method) to the objects. The DLR in turn has a number of fallback mechanisms to try, basically the way dispatch happens in the end depends on the type of object you use. Fair enough.
Now, what if I know the name of a method on an object at runtime, but I didn’t know it at design time. Obviously the compiler can’t create clever code for me in that case. Basically, I’d like to do this:
The method DispatchDynamically in the last line doesn’t exist – at least I don’t think it does! That’s my question, the thing I don’t currently know – is there a method like this somewhere?
I know this is possible when talking to IronPython, for instance. In this case I can use IronPython specific data structures (PythonEngine et al.) to retrieve info on the members that are available etc. I’ve done that, no problem. Of course in Python this is ridiculously easy anyway:
The only way that might work – and I haven’t followed up on this in any detail – is to write code similar to that usually created by the compiler, but manually. Looking at Reflector, this will make for an extremely horrible “API", but I guess it’s possible. Although at the very least I’d have to use stuff out of the System.Runtime.CompilerServices namespace, which seems a bit extreme… but who knows, maybe this is the way? Not intuitive, if it is!
For some odd reason, I can’t currently find a good answer to this problem and I’m just now out of time to keep looking for it. I hope I’m missing something and somebody is going to come forward and tell me what it is.
It’s an odd fact that there are quite a few blog posts out there about how dynamic in C# 4.0 is going to be so great instead of Reflection. Weird, because none of the posts I could find takes a very simple fact into account: I’m going to use Reflection scenarios mostly when I don’t know at design time what it is that I’m going to be invoking at runtime. Surely, that’s a very important point of it. Well. Seems like that is at least as hard with dynamic, if perhaps more performant.
Gaining knowledge is most fun if you didn’t even know you didn’t have it. I guess it’s the surprise principle - the unexpected christmas gift is one of the nicest to get. Suddenly you learn something you didn’t know, or perhaps, if the subject matter is really something you’re very familiar with, it’s rather that you’re suddenly reminded of something you probably new before but had forgotten about. Great!
I just changed the project type of a library of mine to .NET 4 Client Profile. That library implements a type called Tuple. Of course, in .NET 4 they have introduced their own Tuple type, which lives in the ubiquitous System namespace, so I got lots of error messages from a code file that uses the Tuple type heavily. The compiler was wondering whether that Tuple thing in code was System.Tuple or rather FCSlib.Data.Tuple. Oh dear.
Now, it is possible that System.Tuple can be used as a full replacement for my own Tuple. I should check this out in more detail. I’m quite sure, however, that some of the API I created for my own type isn’t going to be there in the standard one, so I’d have to change this as well. Plus, I want to show how to create a Tuple type, not least for those programmers who don’t use C#/.NET 4.0 yet.
So what now? Rename my Tuple to something else? To what? Hm…. I was looking around my project for places where I use my Tuple type and suddenly I noticed that I have a file with unit tests for the type, and for some reason I wasn’t getting any error messages for that one, just for the other code file I noticed previously. Weird. Some closer inspection showed that the first few lines of both files differed in an important way.
Check it out. This is the file that was giving me errors:
And this is the file that worked without problems:
You’ve probably noticed it just like I did. In the case that works okay, the using statement for the FCSlib.Data namespace, in which my own Tuple type lives, sits inside my own namespace definition block. This is enough for that statement to have a higher priority when it comes to searching for a type – my Tuple is found before System.Tuple. Exactly what I want, because with the help of that feature, my own FCSlib code can use its own Tuple type without having to rename it or even resort to cumbersome syntax.
If I’ve known this before, I have forgotten. Perhaps I never knew. In any case I feel enlightened :-)
In a comment to my recent blog post about my upcoming Expert XPO training class, Michael Proctor, an old acquaintance from DevExpress days, asked me whether I would consider running similar classes online. In his words:
This looks great, there has been a few of your courses that would be great to attend however there is a big bloody ocean in the way.
Have you ever consider running a second online version of the course to increase your market?
I’m not saying run a massive webinar where it is impersonal, do the same as your classes except over something like live meeting. I’m not sure how your course is structured but if you are a whiteboard fan like myself I have found a decent sized pen tablet Intuos Large or Extra Large is a great whiteboard substitute.
I can tell you that I know of a couple of people here in Australia that have asked about if there are any courses on XPO and unfortunately nope.
I reckon you would fill the seats bloody quick for online delivery too, and obviously your costs would most likely be less as you don’t have the expense of a conference room etc.
Now, I had a lot of thoughts about this, and I guess these will be interesting to others as well. This is still just a blog post and as such an opinion piece - please feel free to comment if you think I’m off track with my ideas! This is written as a reply to Michael, because I originally intended to simply reply to his comment.
Thanks for the feedback. Yes, I’ve thought about something like this… I’m not sure though. I understand that there are good reasons for this request, but I’m not sure it’s really going to work. Even for a two-day class, who’s going to sit in front of their computer for two days, watching a training class? Then there’s the lag of communication connections, everything takes longer, watching somebody typing on screen is much harder, etc… in the best of cases I’m sure the outcome, as far as a learning effect for the customer is concerned, would be much worse than an actual classroom training. Not even to mention the labs, an essential part of my classroom trainings!
Of course I also like classroom trainings. It’s a much better feeling to speak directly to a group of people and watching how they learn, then to talk to your machine for a day or two without much in the way of feedback. As a result, I really think online stuff is fine for a short time, or for direct interaction in a small group (I do quite a bit of consulting work online, for instance), but not very suitable to longer events.
Perhaps I could theoretically publish a two-day class in 12 (or so) individual pieces, but then I’d have to give it away cheaper than classroom trainings, people will pay for one and watch with their entire team, or they’ll just copy everything and give it away for free, nobody will come to the classroom trainings anymore… sure, I don’t know to what extent this is going to happen, but I’ll take any bet that it would happen.
So that’s why I’m saying “I’m not sure". Perhaps I’ll make a different decision in the future, because I see that some people will never make it into my classes otherwise. Meanwhile, unfortunately, if you would like to see my training happening near where you are, we’ll have to talk about me coming there and doing it. Or of course you can book my consulting services anytime! :-)
January 27-28 2011 are the dates, the location will be London, UK (details will be announced as soons as possible), and sign-up is open right now with an early-bird discount available until November 30 2010.
In contrast to most of the other classes I’ve done on DX products so far, this is more than an introductory event. Of course, as you know if you’ve attended one of my other classes, things always mix up in the end – there are advanced questions and discussions in introductory classes, and XPO beginners are certainly welcome in this class. But because it’s specific to one product, the scope is the entire product functionality this time.
If you use XPO, or you consider using it, here’s your chance to get all your questions answered! I have been using XPO since it first became available, and in 2005 I started working at DevExpress as the Program Manager on the project, which was then just moving towards its version 2.0 (this ended up being 2006.1, I believe). I like to think that my input has helped shape some of the features that got into the product since then, and it is that background knowledge I have, coupled with the “real-world” project experience of using XPO myself and in customer projects, that I want to pass on in this class. I’m looking forward to it!
Here’s the summary text for the class:
This class is a deep dive into DevExpress eXpress Persistent Objects, short XPO. XPO is an object/relational mapping (ORM) tool with a brilliant feature set, lending itself equally well to small and large development projects. With its broad database and platform compatibility as well as support for new technologies like Silverlight and Azure, XPO is a valuable proposition for many scenarios that competing tools don’t cover. As the basis of the eXpressApp Framework (XAF) product, a business application framework also made by DevExpress, XPO has additional credibility. The class starts with the basics, but moves on quickly to advanced scenarios. As much as the two-day timeframe allows, no question about XPO shall remain unanswered!