Coding Techniques for Microsoft Visual Basic. NET
Authors: Connell J.
Published year: 2002
Pages: 21-23/123
Buy this book on amazon.com >>

Nothing but .NET

Well, that was intense . Let's review what we learned in this chapter. First, from our stroll down memory lane, you now know the business and technological reasons why .NET is here to stay. You also were introduced to the components of the .NET technology. I covered key terms such as the assembly , metadata , Microsoft Intermediate Language , just-in-time compiler , and common language runtime . You saw how to write a simple Visual Basic .NET program and examined the code and files that were created. We also checked out the IL disassembler and even peeked into the assembly manifest. And finally, we looked from on high at the pieces of our first Visual Basic .NET program and examined what was happening and why. And through all of that, we didn't write a single line of code!

Before pressing on, I'd suggest spending a few minutes reviewing the diagrams in this chapter. When you feel comfortable with the structure of the .NET Framework and how Visual Basic .NET fits into the picture, you'll be ready to start learning more about object-oriented programming in Chapter 2.

Chapter 2

Object-Oriented Programming in Visual Basic .NET

As you read in Chapter 1, "Visual Basic .NET from the Ground Up," you really can't do anything in Visual Basic .NET without coming face to face with objects. When you create a standard form in a new project, you have access to the code for the form's class. While this code was present in classic Visual Basic, it was hidden from a programmer's view. Now it is presented to you in the integrated development environment (IDE). A solid understanding of object-oriented programming is a prerequisite for getting the most from Visual Basic .NET. If you are new to object-oriented programming (sometimes abbreviated OOP) or up till now have tried to avoid using it directly, this chapter will make you a believer, and you'll see that it's pretty straightforward, which wasn't the case at first for me.

An Object Lesson

When I started to learn object-oriented programming about 10 years ago, I found its concepts somewhat difficult. I read every book I could get my hands on and thought about all that I'd read, but it still didn't make sense. I performed due diligence and put in the time, but for some reason OOP didn't click. "What's this business about creating a class and calling methods ? After all, didn't I do the same thing with C math libraries for years ?"

Then one day I had a revelation! All at once I realized how simple the concepts of object-oriented programming really are, and I became a believer. I spent time reflecting on why I took so long to understand a concept that turned out to be so simple and realized that the reason was twofold. First, the authors of the books I read seemed to obfuscate OOP by using terms such as overloading, encapsulation, inheritance, and polymorphism all over the place before they were clearly defined (at least for me). While I might have muddled my way through this terminological maze, the knockout punch was the examples the authors provided, which were contrived and never about anything that could be used by a programmer to solve real problems. Although I tried to match alien concepts with contrived and overly difficult examples (again, at least to me), OOP didn't sink in. I had pictures of cookie cutters, stars, and rectangles dancing in my head. These images were the hands-down favorites of every author discussing object-oriented programming. To me, they hadn't made any sense.

To save you the time I spent scratching my head and thinking about objects until my brain hurt, I'll use prefabricated objects such as a Windows form and a few control objects to illustrate object-oriented concepts. By working with something that you already use in your programming, the jump to thinking about objects is much, much easier. Over time, I've found this approach to be the clearest way to illustrate the principles of OOP.

I'll cover objects and classes, properties, methods, inheritance, overloading, polymorphism, and sharing, all within the context of what you know. In Chapter 3, "Writing Your First Class" when you start to write your own classes, you'll fully understand the concepts and you'll be able to concentrate on the code.

Coding Techniques for Microsoft Visual Basic. NET
Authors: Connell J.
Published year: 2002
Pages: 21-23/123
Buy this book on amazon.com >>

Similar books on Amazon