Haybale web design, development, and online marketing for Kalispell, Bigfork, Whitefish right here in Montana!

DATABASES, PROGRAMMING LANGUAGES, AND FRAMEWORKS

If HTML, CSS, and Javascript give a website its structure, appearance, and behavior, what gives a website its brain? How does a website remember who we are when we sign up for, or sign into, an account? What tools are available for creating websites which exhibit this sort of characteristic? The answer is databases, programming languages, and frameworks. With the following we will describe what they are, why we use them, and how to give a website a mind of its own.

Database Logo

Databases

A database is both the software and hardware responsible for storing and managing data. A database file consists of rows and columns of data. A database "object", or entity, has a name, and any number of attributes. The name is a row in the database, and the attributes are the columns for that row. For example, an entity named User might have the attributes 'first name', 'last name', 'username', etc.

figure1a: shows the rows and columns for the database table "Users". When queried the data returned shows two records on file.

mysql> select * from users;

  +----+------------+------------+-------------+
  | id | first_name | last_name  | username    |
  +----+------------+------------+-------------+
  |  1 | john       | kline      | johnnyboyd  |
  |  2 | lauren     | dixon      | laurenipsum |
  +----+------------+------------+-------------+
  2 rows in set (0.01 sec)

A database can represent multiple entities, can store multiple instances of an entity (an object), and objects can be related to other objects through the use of keys and foreign keys. Once the objects are related, one can form a variety of "database queries", which allow one to retrieve sets of related data from this matrix of objects, to be displayed in any order we like. For instance, display all Users who placed an order for item x over the period y to z.

All databases can have their data manipulated through the use of SQL, or Structured Query Language. There are a variety of database brands to choose from, but they each do the same thing, that is Create, Read, Update, and Delete rows of data. A database can be as simple or as complex as you like, but it is the thing which allows an application to store, retrieve or modify information about a particular object. There is virtually no limit to the sort or amount of data an application can have. Now there is a heavy piece of information.

Language Logo

Programming Languages

A programming language is the code that gives a computer its ability to think and act based on certain conditions. With programming languages, one can set variables, define functions, and write conditional logic, or statements which tell the computer, "If a is b, then do c, else do d."

figure2a: shows the flow of logic in determining a customer's price of admission. The cost varies depending on the customer's age.

data flowchart

There are thousands of programming languages to choose from. If you learn one programming language, you learn them all, in part. They are each alike in that they give a computer its ability to think and act based on certain conditions. They differ by the type of problem they were created to solve, and in syntax, or, the way in which the language's code is written.

figure2b: shows figure2a expressed in Ruby code. This program retrieves information from the user, sets variables based on the response, then makes a decision to be reflected in the response.

  # get customer age
puts "enter your age: "

  # store age in an integer variable
age = gets.to_i

  # set cost variable based on age
if (age < 13)
  cost = 10
else
  cost = 20
end

  # respond with determined cost of admission
puts "tickets are $" + cost.to_s

Javascript is a programming language, though it is commonly used for 'client side' scripting, or for carrying out those instructions which inform the behavior of the browser receiving the web documents. Languages like C, PHP, and Ruby are programming languages which sit on the 'server side'. Server side languages carry out those computer instructions which inform the data and documents to be sent to the user by the server.

Framework Logo

Frameworks

Often, programming languages come with "frameworks", or utilities written in that language, which allowit to serve a particular function "out of the box". A web application framework, for example, contains all of the low level plumbing that needs to be done before one can use that language to build web applications. Web application frameworks let you create and configure all of the needed components for a web application, such as creating and setting up a database, or generating html, css, and javascript files that contain 'dynamic' data, or information specific to one user of a website.

With databases, programming languages, and frameworks, a developer can give a website its own form of intelligence, and with it, the ability to remember and respond uniquely to its visitors. With this ability, a website can grant full access to its administrator, all the while restricting the general public from the same. With memory and discernment, users can manage and update a website's content, create and modify its records, and be recognized when they return. When a person updates their status on social media, for example, they are actually updating that site's content by creating a record in the database. All thanks to the help of databases, programming languages, and frameworks. Excellent!

COMMENTS