Today I read this book as I was waiting for my project compiling. This book has been laying on my desk since last Friday. It used to be in laying on one of my colleague desk (untouched! hehehe …. 😀 ). Anyway, she left my company last Friday, so she passed the book to me (Okay, I did volunteered to provide the book a space in my table 😀 ). I did first hesitant to receive the book as I am more fond to MSDN Class Library 😀 You know, just browsing here and there when you stuck at a particular problem.
So while my computer bogged down by the compilation process, I gave the book a peek. I skimmed through the pages looking for things that might attract my attention. Unsurprisingly (well.. I did surprised 😀 ), I realized that I haven’t really dig down all the knowledge (read: language features) about Visual Basic 2005. Here are the things that I learned today:
- AndAlso, OrElse keywords. These keywords will help you to short circuit the logic statement. Consider “foo1() AndAlso foo2()”. So if foo1() already returned false, the foo2() statement will not be evaluated. Thus, you increase the execution speed by the complexity of foo2(). And if you use OrElse, foo2() will not be evaluated if foo1() is true. Of course you cannot short circuit the logic statement if your foo2() is doing some kind of processing that you will need to use the result later on.
- <Obsolete(“This_Is_Your_Warning_String”)> method attribute. This method attribute helps you generate the compilation warning. So if your colleagues are using your obsolete method, they will see the warning in the compilation log or Visual Studio (Yes my friends, please look at all those warning signs before that Runtime Exception bites your honor in the production server)
- My namespace. There are quite many of them. You could check them out HERE. Before today, I don’t know that to download from Internet and save the content to a file can be done just by using this single line of code
My.Computer.Network.DownloadFile _ ("http://www.cohowinery.com/downloads/WineList.txt", _ "C:Documents and SettingsAll UsersDocumentsWineList.txt")
without all the complexity of dealing with Stream Object.
- And many more … (my brain short term memory capacity is limited to only three interesting things 😀 )
After this shocking proof of ignorance wake up call, I think I have been slowing down in my learning process. I am still far away from reaching the top. I am motivated to do better, so should you 😀 Have a nice reading!
PS:The book is good if you’re just started programming in Visual Basic.NET (or thought that you know enough about VB.NET, but apparently you’re not 😀 ). The flow is structured in such a way that it’s easy for you to either taking a close detailed look, or just skimming through the pages.
loading...
About Hardono
Incoming Search
.net, vb.net
Personally, I always use short-circuit operators (&& and || in Java) on conditionals. As for this part:
“Of course you cannot short circuit the logic statement if your foo2() is doing some kind of processing that you will need to use the result later on.”
If we really need both foo1() and foo2() to always be run, perhaps it’d be clearer to have the invocations separated from the conditional:
boolean a = foo1();
boolean b = foo2();
if(a && b) {
….
}
Maybe it’s just me… but my opinion is having conditional which has “side effect” of modifying something in the code seem a bit risky. If next time the (another?) programmer wants to remove one of the conditions and either forgets or is unaware of the side effect, he/she may end up introducing subtle bugs 🙂
Hmm.. funny.. I think in Java I always use && and || without even realizing that it’s a short-circuit 😀
Hi, your articles is very good and useful for me. You can promote your article (news/video/image) at our site infogue.com to all of people. Regards.
Hardono: Nice Digg-style website in Bahasa Indonesia 🙂