Paul Vick and Erik Meijer - Dynamic Programming in Visual Basic
- Posted: Sep 16, 2005 at 2:10 PM
- 159,985 Views
- 33 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
messagebox.show(person.(Form1.textbox.text))
(this assumes you a have a person, and a form1 with a textbox)
In other words you can incorporate runtime results back into sourcecode - effectively eliminating the need for things like a select case block(in certain situations). Of course you would have to validate, or limit the value of, the textbox.text to insure the existence of that member in the calling type.
am i making sense?
The changes they have made to VB.NET allow you to take advantage of dynamic programming without having to write a ton of System.Reflection code and turning Option Strict On or having to turn Option Strict Off.
Writing System.Reflection code and turning Option Strict On to do dynamic programming in VB.NET requires writing a lot of code every time you want to do something dynamic.
Turning Option Strict Off lets you do dynamic programming, but you lose the benefits of compilation, taking performance hits (runtime type resolution) and reducing the ability of the compiler to detect coding errors.
Oh and trying not to be rude here, but maybe next time have someone familiar with dynamic programming and VB.NET do the interview. That way, you can spend more time in the interview actually showing what improvements they made to the new version of VB.NET to enable better dynamic programming and not spend so much time educating the interviewer on why it is important.
Unless that was the intention, in which case, ignore my advice. I guess I was expecting a 300/400- level video, not a 100/200- level one.
I doubt turning off Strict eliminates strong typing, I believe that point was made. What it does is allow late-bound operations in addition to early-bound ones. This would actually improve the productivity of the programmer, because using the bulky explicit reflection approach requires a great deal more source code to be written and debugged in cases where dynamic object use is desired.
Clearly late binding has costs, including performance penalties. That's why one doesn't use it except where warranted. A sort costs resources too though, but you don't forego sorting just for that reason. Instead you avoid sorting lists that are properly ordered to begin with. Perhaps an oversimplification but the same concept, more or less.
It is good to see how .Net is working to integrate the best things from both programming worlds, as well as extending some of these concepts even further.
Ken, thanks for the reply.
I guess the funny looks Paul and Erik shot you at some of your questions at the beginning of the interview gave me the impression that they thought the talk was going to be an advanced talk, too. Once you guys got on the same page though, the interview went better. I viewed the video before the downloadable version was available so I couldn't skip ahead to the parts that interested me. That's no one's fault.
Unfortunately, this probably served to perpetuate the stereotype that VBers are not the sharpest knives in the drawer. (Compare this video to the recent Anders/LINQ interview, for instance.)
As someone who uses VB & VB.NET (as well as C#) for a living, here's hoping that we'll see a better representation of VB in future Channel9 videos! Although I guess it's hard to complain - this content is free after all…
His questions were so painful!!! This is really cool stuff, but it comes off pretty clumsy when you have a terribly uninformed interviewer. Do a little homework before the interview please!
Some advice:
1. Keep your questions short and simple. The most common mistake rookie interviewers make is talking a lot. The interview is about the people being interviewed, not the interviewer.
2. Have some fallback questions. You shouldn't script all your questions, but if lulls develop, have something to ask to resume the flow of conversation.
3. Ask Scoble and other experienced interviewers for advice on interviewing.
I took a look at Erik and Paul's blogs. One of them mentioned not being able to cover XLINQ in these videos so maybe you could talk about XLINQ and VB.NET in a future video. Talk to Erik and Paul about topics that make sense to cover in future videos. They're the domain experts, not you or me.
It was? Did the 2 guys know that?
They were just demo'ing and you kept injecting such weird
questions, that they didn't answer and kept looking at you
strangely.
You didn't even sound like a coder to me, and when I read
that you do a lot of Fox Pro I was stunned. Your Fox Pro
videos are great and you sound really intelligent, but it
seems with VB, that you are not that experienced, so you
come off...ah, less than polished.
Let your subjects speak! Just sit back and let the tape roll
until they look to you for the next subject.
I've never met scoble but I know:
He reads above 1500 RSS feeds every day.
He spends 14 hours a day in outlook (yea, he's reading RSS feeds).
He wants every piece of software MS makes, his washing machine, jeans, and car to all have an RSS feed (I guess 1500 feeds a day isn't enough for him!).
He wants to read his washing machine on his bic pen RSS reader.
He loves MS, his job and reading RSS feeds, oh he loves his wife too.
He has a somewhat obnoxious laugh, espesially when he is the closest one to the mic!
All kidding aside Robert Scoble, keep up the good work with Channel9!
BOb
I do have a performance question. Let's say you go the reflection route, and the performance is X. Now if I go the late binding route, the VB compiler is just doing reflection behind the scene, right? So my perfromance is still X?
first i want to apolygize if i'm wrong entering room
to all friends, i want to ask :
I develop an application using Microsoft Excel 10 Object Library in Microsoft .NET environment, But it's not fully succesful
because,while my application was running, i opened the task manager i still saw EXCEL proccess running there fiuhhh... it drive me crazy [C] .. whereas i add the (XL.Workbooks.close and XL.quit) line everytime i've done using the object
does anyone experience that problem and know that problem? please let me know...
thank u so much
God Bless U All
Ferry Avianto
ferry@aisin-indonesia.co.id
PT. Aisin Indonesia
We want Chris & Ari and the Head!
Now, that i see this type of programming, i could think to stay a couple of years more with vb.net. This type of examples helps to contruct Object Oriented clases, same as Java (familiared with).
I could see a scenario were this type of declaration , would help you to define a runtime type of variable, and prevent exceptions, threads that will conduct to a system crash.
Now the other things that boders me is that, vb wont be around, cause we all know that csharp it´s a better language.
Do you see this as an alternative?
I am from Mexico, excuse my spelling. (No time for editing)
The extreme latebinding was and is still missing from VB.Net and it's good to know that the next release (after 2005) will have this feature. This feature is available in Visual Foxpro since it's origin.
A) Those who know reflection backward and forward and all the technical mumbo-jumbo about how the compiler works.
B) Those who do not know anything about reflection.
In my experience, it seems that A) and B) cannot and do not know how to converse with each other in plain English. I think A) was just born that way, for they often fail to know how to instruct others in their godly ways.
As it was, I ended up using stuff like:
CallByName(Me, "Method" & integerVariable, CallType.Method, parametersArray)
just to call:
Method1(param1)
Method2(param1, param2)
or Method3(param1, param2, param3)
I took me about 7 full pages of written dialouge back and forth between about 20 so-called "experts" to discover even this!
With the next release, I hope that this becomes an easier task. I am excited about things such as:
obj.(obj.InterestingProperty)
as well as the dynamic interface options.
Although this info could have been relayed in about 5 minutes, I really appreciate you approaching the subject in "real English" terms!
' any thoughts?
Thanks.
The first poster mentioned the possiblility of something like:
> messagebox.show(person.(Form1.textbox.text))
Ouch! this feature is a hackers dream. External data should be assumed to be untrusted the last thing you want to do is blindly execute whatever the user types in.
For example say your textbox is on a web form and the web application has access to a database that with a little insider knowledge or trial and error he uses the web applications credintials to connect to the local database on the web server and deletes some data such as.
New SqlCommand("Delete * from CustTable", New SqlConnection(...).ExecuteNonQuery()
After deleting all your customers (and all cascading relations) you'll probably get an exception such as the method or property 1238 (the result of executenonquery ie number of records deleted from the table) on person does not exist. Even if this were perhaps a query from some xml meta data about person object the application must be extreamly careful to ensure that whatever gets evaluated in the () is safe to execute. Assuming you knew what it was you were executing between the () they why not just put it there if you don't know what will be in the () then you probably shouldn't be executing it. It might be useful in some ad-hoc one off scripting such as and administrative WMI query or something like that but I would never ever use it in a production code.
- Kurt
I'm not giving up my fully compiled, native code enviroment until it's ripped out of my hands. I have no interest in joining the Open Source market... which, is exactly what apps are that are written in dotNet. It doesn't matter if you spend 5 grand on an obfuscator (needing such a tool is ridiculous, in itself) your code is free to anyone that owns a tool such as Remotesoft decompiler http://www.remotesoft.com/
...and, I find it disgusting that tools like this are available, especially since their opening line says "Think your code is safe, think again"
Quick... someone find a similar tool for VB6. Ain't gonna happen.
For your infomation, i am beginner in learning visual basic 6.0 and i have a problem in coding for how to get the value of "d" in the equation below by using VB6.0??? lets say:
d3+2d2+3d+4=0
Am i going to use the looping in VB6.0 to loop up untill d is equal 0?..but how to display the value of d when equation is =0?? i really need ur help...and i am really happy to hearing from you soon..thanks.
http://www.buccaweb.com/Download.aspx
Thanks to Microsoft and VB team providing this in VB.
This is a very useful feature, but why is not supported in vb.net CF?
Remove this comment
Remove this thread
close