Building an RIA through Collaborative Design and Prototyping : Preamble

We’re in the midst of building an interesting Rich Internet Application for educational assessment using Flex. We’ve had a lot of success with our process thus far, so I thought it would be helpful to document it as a means of discussing it and maybe improving it for our next project.

One of the great aspects of this particular project is that we’ve done the design collaboratively with an interdisciplinary team, including technologists, instructional designers, and even a faculty member or two.

Here’s a pic of our screen designs and the application state diagram:

Rubricator Application States

I’ll break this down into detail in upcoming posts.

Next up: Iterative design.

Uncategorized

CFQUERY and autonumber primary keys

After reading a post by Ben Nadel, it occurred to me that I should write up my technique of getting new autogenerated primary key values back from the database.

It’s very common for database designers to use columns that generate a unique, artificial primary key value for every row inserted into a database table. Different platforms have different names for this type of column:

  • Microsoft SQL Server: identity column property
  • Microsoft Access: AutoNumber field type
  • MySQL: AUTO_INCREMENT column property

PostgreSQL and Oracle use an alternative method called a sequence. Sequences are easier to use in some ways, and the technique I’ll describe below doesn’t really apply.

If you have child tables in your database related to your main table with Foreign Key constraints, you’re going to need to retrieve this autogenerated value before you can insert data into these child tables.

Let’s take a typical INSERT statement that pulls data from an HTML form POST operation:



INSERT INTO tblPeople (
nameLast,
nameFirst,
emailAddress
) VALUES (



)

Although INSERT CFQUERY tags don’t require a name attribute, I make sure to add one here. You’ll see why in a moment.

One handy property of the CFQUERY tag is that it can contain multiple SQL queries if you separate them with semicolons. You can use this trick to fetch the newly-created ID in this first query. This example works with MS SQL Server 2000 or higher:



INSERT INTO tblPeople (
nameLast,
nameFirst,
emailAddress
) VALUES (



);

SELECT SCOPE_IDENTITY() AS peopleID;

Because I named the CFQUERY instance, I can now reference the autogenerated ID value in my succeeding queries as:


#insertNewRecord.peopleID#

Don’t forget to wrap your entire batch of related CFQUERY tags inside a CFTRANSACTION tag to make them one complete operation.

One final note: The SCOPE_IDENTITY() function used above only works with SQL Server 2000 and higher. Anyone on SQL Server 7 (??) and before must use the special @@IDENTITY variable to accomplish the same thing. @@IDENTITY has some limitations with regards to databases with triggers, and may not retrieve the right value in all cases. Here’s a more thorough explanation of the problem.

People using MySQL can substitute the function LAST_INSERT_ID() to accomplish the same thing.

Uncategorized

FlexBuilder 3 for academia

Since FlexBuilder 3 was released last week, I decided to hunt around for the ‘free to academics’ offer and see if it applies to FlexBuilder 3. Here’s where it lives now:

http://www.flexregistration.com/

Interesting things to note:

  1. It apparently does apply to staff too (woo!)
  2. You can request more than one license if you’re using it for a class or a lab. That will be a real time-saver.
  3. You have to scan your ID and submit it with the form. Uhh… scan? paper? I don’t have a scanner hooked up anywhere, so I took a photo of my ID with the iSight on MacBook Pro and tried that, thumb included free of charge.

The action page tells you to allow a few weeks for processing the request, but mine was approved the next day…. that’s service!

Uncategorized

Heading to CodeMash ’08

I’m really looking forward to CodeMash. The slate of speakers and topics looks fantastic; It’s really nice to look at a conference schedule and see a lot of topics that are totally new to me.

One thing I’m curious about is Scala. I’ve been working with a research group lately on a project using Intelligent Agents, and through that was introduced to the idea of Functional Programming. Somehow I missed seeing this in my undergraduate days, though I remember my peers complaining about Scheme in one of the senior-level computer science courses.

Some of the talks on Groovy and Grails seem interesting, too. The Ruby on Rails movement has certainly sparked some innovation in the Web Development community, and I like seeing those ideas cross-ported into the technologies I have more of an affinity for, such as Java and ColdFusion. Having recently built a somewhat painful full-scale Java application, there may be something useful here.

Uncategorized

Eolas Nightmare Coming to an End?

After two years of patent-induced pain, Microsoft will be removing the Eolas “fix” from IE in April of next year.

At that point, users should no longer be forced to click on embedded active content (such as Flash, Java, Quicktime, or Windows Media) to interact with it after April ’08. Consequently, we will not be required forced to write out our object tags with JavaScript.

I can only hope this will come to pass! This one change was a major setback to Web Standards and Web Accessibility efforts.

Uncategorized

Unit Testing and Subversion – Where should I put the test classes?

I’m starting a strong push to institute Unit Testing in a relatively new project; I figure it will be easier to really get into the habits in a new project from the start, rather than trying to steer some of our ancient existing projects in that direction right away. But I’ve hit a snag… where should I keep the test classes?

We’ve been using Subversion to manage our project files since shortly after I started here… getting us into source control was one of my first imperatives. So our code is laid out nicely in folders:


Project A
|____ src
|____ lib
|____ docs
|____ db

Project B
|____ src
|____ lib
|____ docs
|____ db

In the src folder, I have things organized in packages like


src/edu.psu.ist.project-a.component-a
src/edu.psu.ist.project-a.component-b

So where do I put the test cases? I could put them in a test package at the root of the project:


src/edu.psu.ist.project-a.test.component-a
src/edu.psu.ist.project-a.test.component-b

But what I’m really leaning toward is mirroring the main folder structure of the package in a test package in the root of the repository, at the same level as the src folder:


src/edu.psu.ist.project-a.component-a
src/edu.psu.ist.project-a.component-b
test/testComponent-a
test/testComponent-b

My thinking is that the classes in the test package would not get deployed with my actual project code, so they shouldn’t be in the real source package tree. But I’m still not sure.

Uncategorized