Introduction


Introduction

As a teacher I have had the opportunity to walk students through examples in order to teach them. I have had the opportunity to hear their feedback on the texts used in the development classes. And I have always heard the same thing—if they did not have a teacher to teach them, the book alone would have been useless. And that sums up why I decided to write this book. Too many books, for whatever reason, show you how to use a piece of functionality, but they do not show you where to use the functionality, when to use it, or why to use it. This book is for all those developers who want to be able to read a book and know how to implement the contents in a real-world application. This book takes all of the pieces of the application and puts them in relationship to each other. It is not an advanced book, but it does allow an intermediate developer to step into the realm of n-tier applications. This book makes that step almost painless.

What This Book Covers

This book walks you through building an n-tier application. It takes you through a lot of the intricacies of building a distributed application including remote communication and business rules. Specifically, the book covers the following:

  • Chapter 1: This chapter briefly introduces the different types of architectures currently in use in business. It discusses the pros and cons of each of the different architectures, and it examines where and how the Microsoft .NET Framework fits into the architectural models.

  • Chapter 2: This chapter begins your development of the application that you will create throughout the book. You will start to gain an understanding of cross-process communications, and you will set up Internet Information Server (IIS) to host the middle-tier components you will create. In addition, you will learn about the use of the web.config file and set up the initial project structure in Visual Studio .NET.

  • Chapter 3: In this chapter you will examine the different decisions you need to make when designing an n-tier application and the impact those design decisions will have on your project. This chapter examines the concepts of object modeling, remoting, interfaces, and visual inheritance. Once you have an understanding of these concepts, you will begin building the application. At the end of this chapter you will see just how much time and effort the .NET Framework can save.

  • Chapter 4: In this chapter you will learn about error handling. You will examine the differences between error handling in Visual Basic 6 and Visual Basic .NET. In addition to understanding how to handle errors, you will learn how to implement a robust error handling scheme that can be used throughout an organization. Additionally, you will learn how to write errors to a database and, in the event the database is not available, how to redirect those errors to the Windows Event Log.

  • Chapter 5: This chapter shows you how to handle the heart of any application, the business rules. You will examine techniques for coding business rules and informing the user that they have violated a business rule. You will learn how to create your own application errors and incorporate them into your project. You will also create a class that keeps track of an object's state (whether it has been edited or contains any rules that have been broken). Finally, you will learn how to display a list of your object's business rules to the user so that they have a complete list of rules.

  • Chapter 6: In this chapter you will step back and work on creating a usable Multiple Document Interface (MDI) form that can serve as a host for all of the other forms in your application. You will learn how to recursively load menus, display key status (indicate the state of keys such as the Caps Lock and Num Lock keys) on the status bar, and implement a series of interfaces in your forms with which the MDI form can interface.

  • Chapter 7: This chapter takes a slightly more in-depth look at business rules as you move on to creating a second set of working objects. You will explore some advanced considerations when building relationships between objects.

  • Chapter 8: Consolidating code is the focus of this chapter. You will begin by creating a reusable base class that will serve as the base for all of the business objects in the application. And you will use this base class to streamline your application development. The second half of this chapter delves into creating an enterprise template project. Using the methods demonstrated in this chapter, you will be able to create a basic n-tier application template.

  • Chapter 9: This chapter examines advanced business rule concepts. During the course of this chapter you will create a complex business object and learn how to handle the differences between server-side and client-side business rules. Additionally, you will learn how to handle more complex object interaction and image data in SQL Server.

  • Chapter 10: This chapter introduces you to an advanced .NET topic: reflection. You will learn how to create attribute classes that contain metadata to describe your objects. You will learn one technique to reduce any application by thousands of lines of code. In addition, you will build generic methods that can consume objects based on their attribute tags and that are completely independent of the object itself. You will also learn to examine all attributes of a class through code to accomplish these tasks.

  • Chapter 11: This chapter switches to the development of a Web service based on the code that you have previously written. You will learn how to create a Web service, consume a Web service, and publish a Web service with Microsoft's UDDI Server. After that you will learn how to programmatically enumerate through an entire UDDI Server.

  • Chapter 12: Here you will create an ASP.NET application using the components you have already created. You will put a Web application frontend onto, first, the Web service and, second, the components that back the Web service. You will learn best practices for storing usernames and passwords to connect to a database, and you will learn how to store a user's username and password in the database. Finally, you will learn how to display business rule violations to the user on your Web form and how to use Microsoft's validation controls to do this.

  • Chapter 13: If you ever wanted to know how to get your application ready for a global audience, then this is the chapter for you. It introduces how to globalize and localize your application. You will localize both your Web application and your Windows application so that it is useable in English, French, and Spanish. And you will learn some techniques that can save you work if you decide to localize an application later.

  • Appendix A: In this appendix you will create a small utility so that you can incorporate Unicode characters in your application in a method similar to that used in Microsoft Word.

  • Appendix B: This appendix includes a list of valuable reference books that contain supplemental information.