Ken Williamson

Oct9

Using The Active Record Pattern With SQLite and C++

The Active Record Pattern is a popular design pattern for accessing data stored in a relational database. This pattern can be used to greatly simplify the use of SQLite in C++ applications. The concept of the Active Record Pattern is to use an object to wrap a row of data in the database. For an example, I will use the Section table from DocUMentDS, my recently released Desktop Document Manage System. Figure 1 show the UML for DocUMentDS.

The Section table has the following fields

  1. id (int)
  2. name (varchar)
  3. user_id (int) (foreign key)

One of the main concepts of the Active Record Pattern is the containment of all data access methods and business logic inside the corresponding class. For example, Figure 2 show the simplified generic UML of the actual Section class:

Notice that the class contains accessors and mutator for the class attributes, but also contains business methods save, update, remove and finders for this class. The Active Record Pattern allows us to simplify data access by placing all the needed methods inside the Section class. Therefore, the Section object contains everything we need to create, access or modify a Section objects.

This shows the code for section.h:

Read the rest of this entry »

number of view: 2625 Posted by ken under Sqlite, c++ | Permalink | 1 Comment »
Jun3

Spring MVC Tutorial Part 1

By Ken Williamson

I start from the very beginning of building a Spring MVC application and give step by step instructions on how to build and deploy a Spring MVC application. All code and configuration files are explained to give you an understanding of how the application functions.

This tutorial contains the following sections:

  • What you need
  • Building your project
  • Writing the required code
  • Deploying the application
  • Testing the application

What you will need

1. Java 1.5 or greater SDK

  • Download the latest full Java SE SDK from www.java.sun.com
  • Follow the installation instructions provided with the download.

2. NetBeans 6.8

  • Download NetBeans 6.8
  • Follow the installation instructions provided with the download.

3. Tomcat 6 or later

  • Download the latest Tomcat at http://tomcat.apache.org
  • Placed the unzipped apache-tomcat-xxxx folder in the directory of you choice.
  • Follow the NewBeans instructions on how to install application servers and install Tomcat.

Read the rest of this entry »

number of view: 7542 Posted by Ken Williamson under Spring MVC | Permalink | 1 Comment »
 
1 visitors online now
1 guests, 0 members
Max visitors today: 1 at 12:50 am EDT
This month: 4 at 05-03-2012 09:32 am EDT
This year: 7 at 03-07-2012 06:54 pm EST
All time: 14 at 10-09-2010 07:22 pm EDT