AppTrain Users Guide (Word Doc) - RubyForge

jockeyropeInternet and Web Development

Feb 2, 2013 (3 years and 10 months ago)

110 views




Accelerated Application Development with App
Train on
Ruby on Rails





This article contains your personalized fortune. I'm getting a reading on your
future right now... get ready for your life to change ... You are going to love
AppTrain. After spen
ding 20 minutes and creating a few simple web pages
that store their information in a database, you'll be amazed and want to know
more.


Eventually you'll realize that AppTrain is just a simple Web front end for
creating applications that run on the Rails

framework. You'll then seek a
relationship on a deeper level. Then , you're going to love Rails. Rails is a
brilliant framework that will give you the opportunity to develop well
structured web applications in the coolest and the hottest language ar
ound.
Ruby. And of course, you'll love Ruby.






Step 1: Designing the Petstore App


Let's start with some concepts that represent items for sale in a petstore.

The
diagram below shows three distinct concepts in the
petstore;
cat
egory,
product,
and

i
tem
.


This diagram that captures what data we need to collect for our petstore app
.
In software des
ign, we call concepts that will be represented by software
classes
. So this diagram is a class diagram. Each box in the diagram
represents a separate class.

The top portion of the box is the class name. The
bottom portion contains
attributes

that each item in that class will contain.





Petstore Class Diagram


Category

name


1


|



|


\
/


*

Product

name:
text

description: multi
-
lined text


1


|


|


\
/


*

Item

n
ame: text

item code: whole number

des
c
r
iption: multi
-
lined text

price: decimal number

cost: decimal number

available_on: Date

image: File Upload



If you've worked with databases before, You'll be happy to know that Rails
maps each class to a table, and
each attribute in that class is a column in that
table.


Just to keep your head in the game, AppTrain maps classes to Forms, and
attributes to fields in that form.


Also notice the arrows between classes . These signify
relationships
between the classes.

So from the diagram, we know that a Category has many
Products, and a Product belongs to a category.



App
Train

Rails

Database

Petstore eg.

form

class

table

cat
egory

field

attr
ibute

column

name

combo
-
box

rel
ationship

foreign_key

Product belongs to a
ca
t
egory



Step 2: Creating an App


All right, it's 2006 already. No need for any software installation, The
network is the computer right?
1


Take a trip in you browser to
http://www.apptrain.com/app






Enter a name for you new App in the lonely text area. Your own name is fine.
For this tutorial I'm using 'petstore' . Then click 'New App'







1


For on
-
site development, get your own copy of AppTrain running:
http://rubyforge.org/docman/view.php/1056/240/quick
start.html




Nice work! You've created a space fo
r your App. Now it's time to create a few
Forms.






Step 3: Creating Forms


a)

In the Text Field labeled 'name' type
category
.

b)

Now go down to the data fields section, and type
name

in the 'name' field.

c)

Then click 'Create'.







Awesome, Now cl
ick 'New Form' and name this form
product
.


In addition to the name field that we added to
category, product
also
contains a description field. So click the '+' button, and type description in the
new 'name' field that appears. Then click the 'Type' combo
box next to
description that says 'text'. Change it to say 'multi
-
lined text box'.


Now hold on a sec ... don't hit 'Create' just yet!




Step 3a: Adding a relationship.


Hit the plus sign once more. Then click the Type combo box again. Notice that
it ha
s 'Category' as an option. Select that. This new form will now reference
'Category'.


Now you're ready, and your screen should look like the one above. Hit 'Create'.


.







Step 4: Adding Data



a)

Click on the word '
category
'

The white screen mean
s that you've left AppTrain, and are now viewing your
new Form.





b)

Click 'New Category'.

c)

In the name field enter something like 'Dogs', and hit 'create'


Click 'New Category' again and add something like 'Fish'


d)
Now hit the back button a few tim
es, until you're back on the blue “
Editing
petstore app”

screen, and click 'product', then new product.


Notice the combo
-
box at the botom of the screen. It is automatically
populated with data we entered in 'category' form.


e) Enter a
product

like, 'D
og food', or 'Ceramic Castle' and assign it to a
Category.








Step 5: Additional Datatypes


Notice how selecting different datatypes on the 'new form' screen changes the
way data is entered on the form?


Lets look at the Item class:



Item

name: t
ext

item code: whole number

des
c
r
iption: multi
-
lined text

price: decimal number

cost: decimal number

available_on: Date

image: File Upload




Click the back button a few times (sorry about all that but this is only an Alpha
release!) and get back to the p
ale blue AppTrain screen. It should say “Editing
petstore app” at the top.


a)
Click 'New Form' and enter Item as the name.

b)
Add datafields and make sure their 'type' corresponds to the types on the
class above.

c)

When your screen looks something like
the one on the next page, hit
'Create'








The resulting Form should look something like this:









Step 6: Agile Development


In almost no time and with absolutely no code, you've created an
administrative application for your online petstore.



Welcome to the world of Agile development:
http://agilemanifesto.org
.


You'll find that Accelerated development with tools like Rails and AppTrain.
leads to much greater collaboration with customers, which re
sults in better
software.



Step 7: Learn Rails


AppTrain only scratches the surface of The Rails Framework. I highly
recommend a copy of “Agile Web Development with Rails” to get rolling.


http://www.pragmaticprogrammer.com/titles/rails/index.html


And to get a handle on the Ruby language, there's the PickAxe, aka.
“Programming Ruby”;

http://www.pragmaticprogr
ammer.com/titles/ruby/index.html


I know that these are both from the same publisher, but The Pragmatic
Programmers have been instrumental in making programming fun again for
lots of folks, including myself.


Well, if you made it this far, back to your f
ortune.. The future looks bright!
Welcome aboard AppTrain.