Day 3

This is the day 3 page for object oriented programming course 102, an introduction to object oriented programming. On day 3 we're going to explore creating a program using only objects without writing any code.

Below are the topics and course materials we are learning today.

Creating a program using only objects

To highlight the power of object oriented programming we're going to create a complete application in a few minutes using only objects. This example program will be created purely by dropping objects on a design surface, setting properties, and connecting the objects to one another.

Our example program

The image on the right is a what our completed application will look like. The goal of the program is to maintain a remote database that drive our personal blogging website.

When we're done with the program we'll be able create, view, and edit personal blog entries. Those blog entries resize in a remote database and will be able to be read by our web site.

Download the example from here.

Recreating the example

These are the steps to follow to create our example.
  1. Open Lazarus and create a new visual application called "weblog".
  2. Add the following components to the form
    •  
    • 1 TMySQL57Connection
    • 1 TSQLTransaction
    • 3 TSQLQuery
    • 3 TDataSource
    • 2 TDBEdit
    • 2 TDBMemo
    • 2 TDBLookupComboBox
    • 1 TDBDateEdit
    • 1 TDBNavigator
    • 1 TDBCheckBox
    • 7 TLabel
    •  
  3. Set the options on all queries to: sqoKeepOpenOnCommit, sqoAutoApplyUpdates, sqoAutoCommit.
  4. Rename the controls and components.
  5. Arrange the controls to look like in our sample using the mouse.
The instructor will provide you with the information to configure the connection. The tables we are going to use are named blog_article, blog_topic, and blog_user. We will use those names to write SQL statements to receive information from those tables.

A look inside

The example program we've built is connecting to a remote database over the Internet. This system is a RDBMS or relational database management system. Although the inner workings of an RDBMS is complex, our program interfaces it using objects. These objects greatly simply the tasks involved in working with most RDBMS.


Homework

There is no homework for day 3.

See also