What is state management, What state management options are available, Questions to ask before writing your application – Pitney Bowes MapXtreme User Manual

Page 105

Advertising
background image

Chapter 6: Understanding State Management

What is State Management?

MapXtreme v7.1

105

Developer Guide

What is State Management?

Many types of web applications need to perform state management—the process of saving and
restoring information about what state, or condition, each user's session is in. For example, when a
retail web application provides a shopping cart, the application must remember the state of each
user's shopping cart.

In a web mapping application, if your application allows the user to click the map to zoom in, your
application needs to remember that one user might be zoomed in on Europe while another user is
zoomed in on Australia. The code that remembers each user's map state is referred to as state
management code.

What State Management Options are Available?

MapXtreme provides you with these options for how you manage state:

You can use InProc state management, which is easy to code; however, it is not appropriate for
all applications because it taxes server resources.

You can use a Pooled architecture with automatic state management. This model is easy to
code, but the resulting application may not be fast enough, depending on your needs.

You can use a Pooled architecture with manual state management. This model requires more
coding on your part. You must write code to save and restore the appropriate MapXtreme
Session objects that comprise the user's state. However, this model produces the most scalable
applications, so it is the best choice for applications that have large numbers of users.

Thus, there are trade-offs associated with each option. You must consider many factors when
designing web applications using MapXtreme. Some factors are MapXtreme design decisions and
others are Microsoft technology design patterns. This chapter will walk you through some of the
decisions you must make and show you how to make the correct choices for your type of
application.

It is strongly recommended that you think about state management before you write your web
application. The type of state management that you choose will affect how your write your
application. If you write a web application, and then later decide to adopt a different type of state
management, you may need to rewrite significant parts of your application.

Questions to Ask Before Writing Your Application

If you want to create a simple MapXtreme web application, you can do so quickly and easily - just
create a new web application using the Visual Studio template provided with MapXtreme
("MapXtreme 7.1.0 Web Application").

However, for a more complicated web application, before you invest significant time and effort
coding the business logic for your web application, there are several questions that you should think
about, as the answers to these questions will help you decide which type of state management is
right for you.

How Many Users Will Access Your Application?

The most important question you can answer is: How many people will access this site?

Advertising