Web Stack Series Part 4: Business Logic Programming

Today we continue our look at the web stack by explaining Business Logic Programming.

GearsWeb sites are highly complex organisms. There are hundreds of processes and actions that take place behind the scenes every time you access a single web page. Harmoniously coordinating these actions and the components responsible for making a basic web site perform flawlessly is not an easy task. At the heart of all this activity is server-side scripting, a type of “web site glue”, and it is the layer of the web stack where business logic and interactivity are added to your web site.

Server-Side Scripting

So what is server-side scripting? Server-side scripting is a process that applies business logic to data from different sources (databases, user input, etc.) in order to create output that fulfills a user’s request. In short, it is a programming language that runs on the physical server. Developers encode your business logic into scripts (literally, sets of programming commands) using this language. When a user makes a request, the data is run through these scripts and transformed based on your business logic. Once transformed, the data is wrapped with HTML and graphics and outputted to the user. Here are the steps:

  1. User makes request
  2. Webserver Software initializes server-side scripts
  3. Scripts fetch appropriate data from database based on user’s input
  4. Scripts apply business logic to data from database
  5. HTML web page is generated by scripts and returned to the user

Let’s use an example to clarify. Imagine that you own a company that sells widgets online. These widgets have a number of configurations that are specified by your customers. Each unique configuration will be priced differently based on the options chosen by the user. Additionally, your widgets are made from a raw material that is only available seasonally, so you need to adjust your prices based on the season.

Here are three basic business rules:

These rules define your business logic. Your developer will take these rules and translate them into server-side scripts so that when an order is placed, the correct amount is charged. Here is are some sample orders with the rules applied:

  1. Small Widget ordered in June
    Price: $15 + $0 = $15 (Small widget, no seasonal fee)
  2. Small Widget ordered in December
    Price: $15 + $10 = $25 (Small widget, seasonal fee)
  3. Large Widget ordered in August
    Price: $30 + $0 = $30 (Large widget, no seasonal fee)

So, when a users requests to buy widget #1, your server-side scripts grab the appropriate prices from the database, add them up accordingly, and generate a web page displaying the price.

Types of Languages

There are many options for server-side scripting languages. Each language has advantages and disadvantages, but any language will sufficiently handle your needs. As a result, it is usually best to let your programmer use the language that he or she is most comfortable with. Here are the most popular server-side scripting languages:

  1. PHP - Common open source solution based on including code in its own language into an HTML page.
  2. Microsoft ASP.NET - A set of web application development technologies marketed by Microsoft
  3. JSP - Java-based system for embedding Java-related code in HTML pages.
  4. Ruby on Rails - Open source framework written in the Ruby programming language.
  5. Adobe Cold Fusion - Cross platform tag-based commercial server side scripting system.

The business logic layer of the web stack is where everything comes together. Information from disparate sources is combined and transformed into something useful and valuable to the end user. It is important that you find a good developer to handle this part of your web site, as it will ultimately determine the quality of your site.

Our journey through the layers of the web stack is now moving away from the server side of things and into the realm of the end user. Make sure to subscribe so that you don’t miss the next installment!

Like This Article?

Subscribe Subscribe to the RSS Feed

Related articles:
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • StumbleUpon
  • Digg
  • Reddit
  • del.icio.us
  • Technorati
  • Ma.gnolia
  • Furl
  • Simpy
  • Netscape
  • YahooMyWeb

Tagged:
, , ,

Comments

One Response to “Web Stack Series Part 4: Business Logic Programming”

  1. Web Stack Series Part 5: HTML and Markup » Solo Signal on July 17th, 2007 9:53 pm

    […] used to arrange those images around the content of your site. If you have a dynamic web site, the business logic programming will wrap the dynamic content with HTML so that it is displayed correctly in […]

Leave a Reply