Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing structure and some english sentence. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ pharo-ui
Pharo*
mustache
pillar
pharo
pharo
*.DS_Store
*.DS_store
94 changes: 56 additions & 38 deletions Chapters/GettingStarted.pillar
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
!!Getting started

!!! Installation

Expand All @@ -13,9 +12,9 @@ Metacello new
load.
]]]

Note that pre-built 64 bits images are available at *https://github.com/Afibre/QCMagritte/releases*.

Note that pre-built 64 bits images are available
at *https://github.com/Afibre/QCMagritte/releases*.
!!! Starting the web server

Start the Zinc web server on port ==8080==:

Expand All @@ -24,7 +23,7 @@ ZnZincServerAdaptor startOn: 8080
]]]

Then point your browser to *http://localhost:8080/*. It should display the
QCMagritte tutorial as in picture *@QCMagritteTutorial*
QCMagritte tutorial as in Figure *@QCMagritteTutorial*

+The QCMagritte tutorial>file://figures/qcmagritte_tutorial.png|width=70|label=QCMagritteTutorial+

Expand All @@ -34,13 +33,14 @@ QCMagritte tutorial as in picture *@QCMagritteTutorial*
We provide a summary of the QCMagritte tutorial below. We will focus here on the
minimum to go to the next chapter.


The creation of a QCMagritte application requires to subclass ==QCBootstrapApplication==:

[[[
QCBootstrapApplication subclass: #ToDoApplication
instanceVariableNames: ''
classVariableNames: ''
category: 'ToDo-Web'
package: 'ToDo-Web'
]]]


Expand All @@ -54,15 +54,14 @@ QCBootstrapApplication requires to define ==#title== that answers the title of
the application:

[[[
ToDoApplication>>title
ToDoApplication >> title
^ 'What to do ?'
]]]

+ToDo application>file://figures/qcmagritte_todo.png|width=70|label=ToDoApplication+

Now the page at *http://localhost:8080/ToDo* should display the ToDo application
as shown in screenshot *@ToDoApplication*.

as shown in Figure *@ToDoApplication*.


!!! Model definition
Expand All @@ -71,65 +70,81 @@ QCMagritte applications are model driven. That means we will put some effort in
describing models handled by the application. Then we expect QCMagritte to
generate a nice web interface to administrate these models.

In a QCBootstrapApplication subclass we have to declare the entry point, the model
In a QCBootstrapApplication subclass, we have to declare the entry point, the model
that acts as the root of all objects, datas that will be manipulated through the
web interface. Here the model will be an instance of a
==QCBootstrapApplicationModel== subclass:
web interface.

Here the model will be an instance of a ==QCBootstrapApplicationModel== subclass:

[[[
QCBootstrapApplicationModel subclass: #TodoListModel
instanceVariableNames: ''
classVariableNames: ''
category: 'ToDo-Model'
package: 'ToDo-Model'
]]]

Then we link this model to our application by overriding
==ToDoApplication>>model==:

[[[
ToDoApplication>>model
^TodoListModel default
ToDoApplication >> model
^ TodoListModel default
]]]


!!!! ToDo items

For ToDoApplication, we need some ==ToDo items== that have a ==title==, a ==description==
For the ToDoApplication, we need some ==ToDo== items that have a ==title==, a ==description==
and a ==completion== status. Let's declare this class as a subclass of ==QCObject==:

[[[
QCObject subclass: #TodoItem
instanceVariableNames: 'title description completed'
classVariableNames:''
category:'ToDo-Model'
package:'ToDo-Model'
]]]

TodoItem>>title
[[[
TodoItem >> title
^title
]]]

TodoItem>>description
[[[
TodoItem >> description
^description
]]]

TodoItem>>completed
[[[
TodoItem >> completed
^completed ifNil: [ false ]

TodoItem>>title: aString
]]]

[[[
TodoItem >> title: aString
title := aString
]]]

TodoItem>>description: aString
[[[
TodoItem >> description: aString
^description := aString
]]]

TodoItem>>completed: aBoolean
[[[
TodoItem >> completed: aBoolean
completed := aBoolean
]]]


Now we can describe properly or ToDo items variables using Magritte. First,
==title== is a required string:
!!! Describing items with Magritte

Now we describe properly our ToDo item variables using Magritte.

First, ==title== is a required string:

[[[
TodoItem>>descriptionTitle
TodoItem >> descriptionTitle
<magritteDescription>
^MAStringDescription new
^ MAStringDescription new
accessor: #title;
label: 'Title';
priority: 100;
Expand All @@ -141,9 +156,9 @@ TodoItem>>descriptionTitle
Then comes ==description== as a long string:

[[[
TodoItem>>descriptionDescription
TodoItem >> descriptionDescription
<magritteDescription>
^MAMemoDescription new
^ MAMemoDescription new
accessor: #description;
label: 'Description';
priority: 200;
Expand All @@ -153,17 +168,17 @@ TodoItem>>descriptionDescription
Finally there's the completion status as a boolean:

[[[
TodoItem>>descriptionCompleted
TodoItem >> descriptionCompleted
<magritteDescription>
^MABooleanDescription new
^ MABooleanDescription new
accessor: #completed;
label: 'Completed';
priority: 300;
yourself
]]]


!!!! Putting all together
!!! Putting all together

Finally, we need a way to store created Todo items. We will talk about Glorp
persistence in the next chapter. For now, let's use an
Expand All @@ -174,21 +189,24 @@ as follow:
QCBootstrapApplicationModel subclass: #TodoListModel
instanceVariableNames: 'todoItems'
classVariableNames: ''
category: 'Tutorial-Model'

package: 'Tutorial-Model'
]]]

TodoListModel>>todoItems
[[[
TodoListModel >> todoItems
^todoItems ifNil: [ todoItems := OrderedCollection new ]
]]]

TodoListModel>>todoItems: aCollection
[[[
TodoListModel >> todoItems: aCollection
todoItems := aCollection
]]]

Then describe this variable using Magritte description
==MAToMaManyRelationDescription==:

[[[
TodoListModel>>descriptionTodoItems
TodoListModel >> descriptionTodoItems
<magritteDescription>
^MAToManyRelationDescription new
label: 'Todo';
Expand All @@ -199,6 +217,6 @@ TodoListModel>>descriptionTodoItems
]]]

Go back to your web browser, you should be able to create / update / delete some
items (see *@ToDoWithModel*)
items (see Figure *@ToDoWithModel*)

+ToDo application front page>file://figures/qcmagritte_todo_with_model.png|width=70|label=ToDoWithModel+
4 changes: 2 additions & 2 deletions Chapters/IntroducingGoombas.pillar
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
!!Introducing Goombas
!!! Introducing Goombas

Setting up QCMagritte and Seaside is tedious. We also want easy database configuration. You may also need to have access to several databases from a Pharo image.

The Goombas project aims at providing a web application framework with QCMagritte and Glorp persistence. It also includes a wizard that will generate core classes to get started with.
The Goombas project aims at providing a web application framework with QCMagritte and Glorp persistence. It also includes a wizard that generates core classes to get started with.

The project is hosted at *https://github.com/Afibre/Goombas*.

Expand Down
11 changes: 5 additions & 6 deletions booklet.pillar
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
We want to write web applications. We need to test with a prototype. Often this prototype evolve into application in production. Iteratively, while adopting new testers then new users, we discover new usages, new needs, new ideas. And we need to refactor.
The goal of this project is to support web application development. We need to test with a prototype. Often this prototype evolves into application in production. Iteratively, while adopting new testers then new users, we discover new usages, new needs, new ideas. And we need to refactor.

This refactoring process imply often an evolution of domain models, objects and their interactions. Developpers have to adapt the user interface to these interactions. The complexity of developping responsive web user interfaces using HTML templating or canvas may be a slowdown for these early phases.
This refactoring process often implies the evolution of domain models, objects and their interactions. Developpers have to adapt the user interface to these interactions. The complexity of developping responsive web user interfaces using HTML templating or canvas may be a slowdown for these early phases.

In enterprise we may also face constraints like using relationnal databases to integrate existing architectures.

This booklet try to bring insight into aggregating dynamic tools that helps dealing with these problems:
This booklet brings insight into aggregating dynamic tools that help dealing with these problems:
- Pharo${cite:PHAR16}$ is a live development environment that provides immediate feedback.
- Seaside${cite:SEAS18}$ is an open source framework for developing dynamic web applications.
- Magritte${cite:RENG06}$ is a dynamic meta-description framework that enables generation of dynamic user interfaces.
- QCMagritte${cite:QCMAGR}$ provides reusable components for developping responsive web applications based on Seaside and Magritte.
- GLORP${cite:GLORP17}$ allows to persist objects into relational databases like MySQL

- GLORP${cite:GLORP17}$ allows one to persist objects into relational databases like MySQL

${inputFile:Chapters/GettingStarted.pillar}$
${inputFile:Chapters/Persistence.pillar}$
%${inputFile:Chapters/Persistence.pillar}$
${inputFile:Chapters/IntroducingGoombas.pillar}$


Expand Down