Skip to content

Commit

Permalink
plouf
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Jun 23, 2012
1 parent 488a905 commit e7c68e1
Showing 1 changed file with 0 additions and 60 deletions.
60 changes: 0 additions & 60 deletions DBXTalk/DBXTalk.tex
Expand Up @@ -289,66 +289,6 @@ \section{Glorp}



\section{Phoseydon}
\sd{now that I started I'm not sure that I want to have poseidon in this chapter}
\sd{Magritte and DBXTalk together}

Phoseydon is a framework to describe applications. Its main goal is to gather all the information about your application, so you can have better understanding, make better decisions and build lots of things on top of that information with really very little work.

\subsection{So, What's an application?}

An application is a set of configurations, libraries, frameworks and code. Right now, we focus on code. Why is so important the code? Because in mature applications, you often have:

\begin{itemize}
\item Classes
\item Some way of persistence, usually a RDBMS
\item Some way to communicate your classes with that RDBMS (an ORM)
Probably, you communicate your application with other applications, using Rest or SOAP \item Web services.
\end{itemize}

Every piece of code you write for those components (or the ones you want) are related. And sometimes they are very related. So related that there are lots of ugly duplications. Every field on a class is usually mapped as a column in a table, and sent in some way through the network to a mobile device application.

That duplication is there because you are looking the same conceptual model in different ways: Json, Xml, Smalltalk, Java, SQL...

An application is just that: One way to rule them all, to have the information in only one place, and from there control every other component. That's why it's called Phoseydon. It's Pharo's God ruling over an app and everything it uses.

\subsection{Example}

Applications can be created in some ways. The objective now is to create an application from a script.
\begin{code}{}
myApp := DBXApplication named: 'FirstApp'.
\end{code}

All classes in Pharo are organized in categories, and that is the role of an application's name.

\paragraph{Entities}

An application describes entities, which will be the source for our classes, ORM mappings, Seaside forms...

Let's create our first entity: a warrior. Warriors will have a health, a strength, a name.

\begin{code}{}
warriorEntity := myApp entityNamed: #Warrior.
warriorEntity hasString: #nickname. "We don't use name here because some databases may complain"
warriorEntity hasInteger: #strength.
warriorEntity hasInteger: #health.
\end{code}

Ok, that did nothing! But we just wrote a lot of information! From that information, we can create a class:

\begin{code}
myApp createClasses.
\end{code}
Look at the FirstApp category in your System browser, and you'll realize that you have a new class, with accessors already created!

The created class can be edited: you can write methods on it, add instance variables. The only limitations by now, if you want to continue being Phoseydon compliant, is that:

You can't alter the autogenerated methods
You can't alter the inheritance of that class

\paragraph{Extra Entities properties}

\paragraph{Entity Attribute's properties}



Expand Down

0 comments on commit e7c68e1

Please sign in to comment.