Home > Articles

Exploring the Code

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

In this chapter, we are going to pick apart the code of the online community application, seeing how it works. We will not be covering every last code file in this chapter (it would be a very long chapter indeed if we did). However, we will cover all the fundamentals here and will return to the other code in later chapters.

We will look at

  • Terminology that is used to refer to parts of the application

  • The overall structure of the application and its code

  • How the application uses a persistence service to make data access simpler and more efficient

  • The basic code that executes with each page request to the application

  • How the application provides a flexible search system

  • An overview of how security is handled


Before we get started with the code, it is worth defining some terms that are used throughout the code and this book:

  • User—Any human who is viewing the online community.

  • Member—A user who is logged in as a member of the community.

  • Visitor—A user who is not logged in.

  • Administrator—A member who has permission to access administration options.

  • Module—A collection of controls and database tables that provides a feature of the site. The modules in the starting-point application are Blog, ImageGallery, and News. Modules are key features of the application. It is the modular approach that makes the application easy to extend. Using modules also enables us to offer members choices about what features they use.

  • Module instance—A particular example of a module, created by a member. Each member can have many module instances, even more than one of the same module. For example, I might have an ImageGallery and a News module, whereas you might have two ImageGalleries. All the instances of a particular module will share the same basic functionality but will have their own data.

  • Global instance—A module that is being displayed without a specific instance. Data is collected from all instances of that module that are marked for inclusion in the global module. The global instance of each module enables the community application to collate the information that all the members have added. Therefore, the information from my News module might be combined with all the other news that members have added to create a set of headlines for the home page.

  • Module view—A way of displaying a module. For example, the News module includes views for Latest Headlines and Latest Summaries, and the ImageGallery includes views for Latest Images and Random Images. Module views enable us to offer options to members about how their information is displayed.

  • Section—An area of the community, created by a member. (The term section, rather than page, was used to avoid confusion with ASP.NET pages.) Each member can have a number of sections. Each section can contain a number of section items.

  • Section item—A combination of a module instance and a module view, placed in a section. The module instance defines which data to display, whereas the module view defines how it should be displayed. A section item without a module instance will display the global instance of the module the view is for.

Don't worry if you are not totally clear about all of these terms right now; we will look at each of these things in more detail later in this chapter.

  • + Share This
  • 🔖 Save To Your Account