tions should be general; with added interpretation notes saying things like; “If dog is stubborn; repeat。” Converting this into puter…speak; the two sets of instructions are for two different processors or processors used in specific situations。 For example; there are server puters and client puters。 Each type of puter has different requirements。 A server puter needs to process data as quickly as possible; whereas a client puter needs to show data on the screen as quickly as possible。 There are pilers for each context; but to have the developer create multiple distributions with different piler(s) or setting(s) is inefficient。 The solution …………………………………………………………Page 42…………………………………………………………… 20 CH AP T E R 1 ■ R E A DY ; ST E A DY ; G O ! is to create a set of instructions that are general; but have associated interpretation notes。 The Framework then applies these instructions using the interpretation notes。 The Framework piles to instructions (CIL) that are then converted into processor specific instructions using notes embedded in the Framework。 The architecture is illustrated in Figure 1…10。 Figure 1…10。 architecture In Figure 1…10; Visual Basic Express is responsible for converting the Visual Basic source code into a CIL package。 The converted CIL package is a binary file that; when executed; requires a mon language runtime (CLR)。 Without a CLR installed on your puter; you cannot run the CIL package。 When you installed Visual Basic Express; you installed the CLR in the back ground as a separate package。 Visual Basic Express is an application that allows you to develop for the CLR; but it also uses the CLR。 The CLR has the ability to transform your instructions in the CIL package into something that the operating system and processor can understand。 If you look at the syntax of patible languages; such as Visual Basic; C#; and Eiffel; you will see that they are not similar。 Yet the CLR can process the CIL package generated by one of those languages because a piler; regardless of programming language; generates a set of instructions mon to the CLR。 …………………………………………………………Page 43…………………………………………………………… C H AP TE R 1 ■ R E AD Y ; ST E AD Y ; G O! 21 When using the Framework; you are writing for the CLR; and everything you do must be understood by the CLR。 Generally speaking; this is not a problem if you are writing code in Visual Basic。 The following are some advantages of writing code targeted to the CLR: Memory and garbage collection: Programs use resources such as memory; files; and so on。 In traditional programming languages; such as C and C++; you are expected to open and close a file; and allocate and free memory。 With ; you don’t need to worry about closing files or freeing memory。 The CLR knows when a file or memory is not in use and will auto matically close the file or free the memory。 ■Note Some programmers may think that the CLR promotes sloppy programming behavior; as you don’t need to clean up after yourself。 However; practice has shown that for any plex application; you will waste time and resources figuring out where memory has not been freed。 Custom optimization: Some programs need to process large amounts of data; such as that from a database; or display a plex user interface。 The performance focus for each is on a different piece of code。 The CLR has the ability to optimize the CIL package and decide how to run it as quickly and efficiently as possible。 mon Type System (CTS): A string in Visual Basic is a string in C#。 This ensures that when a CIL package generated by Visual Basic talks to a CIL package generated by C#; there will be no data type misrepresentations。 Safe code: When writing programs that interact with files or memory; there is a possibility that a program error can cause security problems。 Hackers will make use of that security error to run their own programs and potentially cause financial disaster。 The CLR cannot stop application…defined errors; but it can stop and rein in a program that generates an error due to incorrect file or memory access。 The benefit of the CLR is allowing developers to focus on application…related problems; because they do not need to worry about infrastructure…related problems。 With the CLR; you focus on the application code that reads and processes the content of a file。 Without the CLR; you would need to also e up with the code that uses the content in the file and the code that is responsible for opening; reading; and closing the file。 The Important Stuff to Remember This chapter got you started working with Visual Basic in an IDE。 Here are the key points to remember: o There are three major types of Visual Basic programs: Windows applications; console applications; and class libraries。 o A Windows application has a user interface and behaves like other Windows applica tions (such as Notepad and Calculator)。 For Windows applications; you associate events with actions。 …………………………………………………………Page 44…………………………………………………………… 22 CH AP T E R 1 ■ R E A DY ; ST E A DY ; G O ! o A console application is simpler than a Windows application and has no events。 It is used to process data。 Console applications generate and accept data from the mand line。 o You will want to use an IDE to manage your development cycle of coding; debugging;