From Source Code to EXE
Now you know pretty much everything there is to know about .NET except for that pesky programming thing. Before delving into some actual code, let's take a little snack break and examine the lifetime of an application, from start to finish (see Figure 1-5).
Figure 1-5 The real Visual Basic development process
So here's what happens, step by step:
- You, as the programmer, are responsible for preparing the basic ingredients (a) of the application. For Visual Basic programs, this means creating one or more source code files with a ".vb" extension. Your ingredients may also include other support files, such as resource files (text and graphic files, often used for multi-language support).
- Your application is cooked by the Visual Basic compiler (b). The result is an assembly, complete with a manifest and metadata. The output is actually semi-compiled IL and includes ready-to-execute versions of the original source code's types and members, including all member and type names. All this content can be "decompiled" (returned back to full IL, although not to full Visual Basic) using a tool named ildasm.exe (the Microsoft Intermediate Language Disassembler), which is included with the .NET Framework. Because you probably don't want just anyone disassembling your application and looking at the code, Microsoft (and other third parties) also supplies an obfuscator, which sufficiently scrambles the content of your code to make it just difficult enough to discourage prying eyes.
- The assembly (c) is deployed to the user's workstation. There are a few different methods used to deploy the application, including (1) generating a standard Windows Installer setup package, (2) generating a ClickOnce deployment, which is new with version 2.0 of .NET, or (3) performing an xcopy install, which involves nothing more than copying the EXE assembly itself to the destination machine. No matter which deployment method you choose, the .NET runtime (d) must also be installed on the user's workstation.
- The user eats—I mean runs—the program (e). The CLR does a final just-in-time (JIT) compile of the IL assembly, to prepare it for use on the local platform. It then presents the application to the user, and manages all aspects of the application while it runs. The user experiences a level of joy and satisfaction rarely encountered when using other software applications.
As with the preparation of a Thanksgiving meal, the actual development process is somewhat more involved than just reading a paragraph (or a recipe book) about it. But it's not so difficult that it can't be put in a book, a book like this one.