MDriven Movie Theatre Part 1
No edit summary
(Adding page to Category:TOC because it contains a TOC.)
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<html>
<html>
<h4>  
<h4>
Normally, it is to much work just get in a position, where you can actually start doing the cool stuff that requested of you. But with MDriven we try to minimize it. It's always a lot of details, when managing information more than anyone really care to think about, but MDriven keeps track of it all to make you efficient. As everyone can relate to the theatre that run shows, in this session of MDriven we learn how to create movie theater example to show the abilities of JavaScript and Angular things.
  In most cases, it is too much work to get into a position where you can start doing the cool stuff that is requested of
In this patriticular video would like to show you how to do a seat reservation actions.</h4>
  you. With MDriven, however, we minimize that wasted time. It always requires significant detail to manage more information than anyone can
  care to think about, but MDriven keeps track of it all to make you efficient. As everyone can relate, the movie theater runs shows. In this session of MDriven, we learn how to create a movie theater example to show the abilities of JavaScript
  and Angular. This particular video will show you how to do seat reservation actions.</h4>
</h4>


<p>
<p class="warn">
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now you can pick any topic to be instructed without watching the whole video.</em>
  <em>To make your experience smooth, we set the main tags mentioned in the video to the right bar menu of this mini-player. Choose an interesting subtitle on the list and immediately get to the exact theme navigation item place in the video. Now you can pick any topic to be instructed on without watching the whole video.</em>
<style type="text/css">
p {
opacity: 0.7;
text-align: justify;
width: 90%
}
</style>
</p>
</p>


<style>
<br>
#video12 {
<div class="video">
   position: relative;
   <div class="video__wrapper">
   height: 500px;
    <iframe src="https://www.youtube.com/embed/CJ7pCIHSo0U?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe>
   width:560px;
   </div>
  padding-bottom: 10px;
   <div class="video__navigation">
}
    <span class="navigation-item" data-video="CJ7pCIHSo0U" data-start="35" tabindex="0"> Setting the Movie Theatre Diagram </span>
#video12 iframe {
    <span class="navigation-item"  data-video="CJ7pCIHSo0U" data-start="100" tabindex="0"> Adding Show Seats and Seat Request State Machine </span>
  position: absolute;
    <span class="navigation-item" data-video="CJ7pCIHSo0U" data-start="193" tabindex="0"> Organizing diagrams with colors </span>
  min-height: auto;
    <span class="navigation-item" data-video="CJ7pCIHSo0U" data-start="310" tabindex="0"> Creating "Manage" View Models </span>
  min-width: auto;
     <span class="navigation-item" data-video="CJ7pCIHSo0U" data-start="485" tabindex="0"> Uploading and Running the example application</span>
}
     <span class="navigation-item" data-video="CJ7pCIHSo0U" data-start="595" tabindex="0"> Adding movie image to the ViewModel</span>
#video12 div {
     <span class="navigation-item" data-video="CJ7pCIHSo0U" data-start="714" tabindex="0"> Adding a method to create show seats </span>
  position: absolute;
     <span class="navigation-item" data-video="CJ7pCIHSo0U" data-start="859" tabindex="0"> Organizing Seat Request </span>
  top: 0;
    <span class="navigation-item" data-video="CJ7pCIHSo0U" data-start="1018" tabindex="0"> Setting the ability to browse the shows </span>
  left:760px;
    <span class="navigation-item" data-video="CJ7pCIHSo0U" data-start="1090" tabindex="0">Server-side ViewModel action </span>
  width: 260px;
   </div>
  height: 100%;
</div>
  padding-left: 10px;
  overflow-y: auto;
}
span {
     font-size: 18;
     display:block;
  padding: 2px 10px 0px 10px;
     padding-bottom: 0.5;
     padding-top: 0.5;
  opacity: 0.7;
}
span:hover {
  color: #0000FF;
  cursor: pointer;
}
span:focus {
   color: blue;
</style>


<div id="video12">
<iframe width="740" height="500" src="https://www.youtube.com/embed/OWzc8Jty0s8?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe>
  <div>
    <span data-video="OWzc8Jty0s8" data-start="30" tabindex="0"> Setting the Movie Theatre Diagram </span>
    <ul> <span data-video="OWzc8Jty0s8" data-start="95" tabindex="0"> Adding Show Seats and Seat Request State Machine  </span>
    <span data-video="OWzc8Jty0s8" data-start="188" tabindex="0"> Organizing diagrams with colors </span>
    <span data-video="OWzc8Jty0s8" data-start="305" tabindex="0"> Creating "Manage" View Models </span> </ul>
    <span data-video="OWzc8Jty0s8" data-start="480" tabindex="0"> Uploading and Running the example application</span>
    <span data-video="OWzc8Jty0s8" data-start="590" tabindex="0"> Adding movie image to the View Model</span>
    <span data-video="OWzc8Jty0s8" data-start="709" tabindex="0"> Adding a method to create show seats </span>
    <span data-video="OWzc8Jty0s8" data-start="854" tabindex="0"> Organizing Seat Request </span>
    <span data-video="OWzc8Jty0s8" data-start="1013" tabindex="0"> Setting the ability to browse the shows </span>
    <span data-video="OWzc8Jty0s8" data-start="1085" tabindex="0">Server side View Model action </span> 
</div> 
</div>


<script>
var IMG = document.querySelectorAll('#video12 span'),
    IFRAME = document.querySelector('#video12 iframe');
for (var i = 0; i < IMG.length; i++) {
  IMG[i].onclick = function() {
    IFRAME.src = 'http://www.youtube.com/embed/' + this.dataset.video + '?rel=0&autoplay=1';
    if(this.dataset.end) IFRAME.src = IFRAME.src.replace(/([\s\S]*)/g, '$1&end=' + this.dataset.end);
    if(this.dataset.start) IFRAME.src = IFRAME.src.replace(/([\s\S]*)/g, '$1&start=' + this.dataset.start);
    this.style.backgroundColor='rgba(0,0,0,.2)';
  }
}
</script>
</html>
</html>


====== Setting the Movie Theatre Diagram ======
=== '''Setting the Movie Theatre Diagram''' ===
The seat reservation problem is quite common and of course we need the seats, which are part of the theatre, but also available for a specific show.  That one has multiple seats and the seat has multiple shows as well. We are going to add a state machine to the ticket order show seat stating if it's free or not, we also need a user that actually gonna reserve the tickets. To be able to process the seat request on the server, we are going to model a state diagram for it. I want to do it on the server to make sure that we don't get any over bookings or two people reserve the same seat. One of the state's request processes will actually going to be executed on the server and as a result could be granted or declined.  
The seat reservation problem is quite common and of course, we need the seats, which are part of the theatre, but also available for a specific show.  This one has multiple seats and the seat is usable for multiple shows as well. We are going to add a state machine to the ticket order to show the seat, stating whether it is free or not. We also need a user that is going to reserve the tickets. To be able to process the seating request on the server, we are going to model a state diagram for it. I want to do it on the server to ensure that we don't overbook or have two people reserve the same seat. One of the state's request processes will be executed on the server and as a result, can be granted or declined.[[File:Movie theatre.png|border|right|frameless|450x450px|link=http://wiki.mdriven.net/index.php/File:Movie_theatre.png]]
[[File:Movie theatre.png|border|right|frameless|450x450px]]
 
====== Organizing model with colors ======
We are going to make the server executed request red, so we know that's special. In the situations when we  have to manage the information like this, usually need all the data organized by coloring it. When we color it, it's more of if they belong together or if they have the same life span. So theater and seats are quite stationary, but show and show seats are not as stationary as theater and seat. Movies and seat request are something different from the other two aspects. So try to keep this theme, when setting colors to the model, it helps the eye to know what goes together and how  things match up.
 
====== Theatre management View Models ======
To get start the application we need to add a new diagram to detailed definitions of theaters, shows and movies
 
Normally, it is to much work just get in a position, where you can actually start doing the cool stuff that requested of you, but with MDriven we try to minimize it. It's always a lot of details, when managing information more than anyone really care to think about, but MDriven keeps track of it all to  make you efficient. View Models, of
course, there is a few, quite a few simple  View Models
 
that needs to be in place, to manage
the basic data, that we need to have and also
 
the actions to bring those View Models up,
need to manage theaters and need
 
to be able to create a theater
and name it and things like that
 
the shows of course, need to manage those, as well
so in the end I wanted to be a
small application,
 
where there is a basic data that we need is managed by the
generated View Model UI, but the things
 
that actually gonna meet the user in the
end, should be, we should spend a little
 
more time on that and do that by
hand, so to speak
 
of course, whenever you start a new project
you go through a process of learning the
 
data you need and at least for me it's
always, that I think it's not a big
 
problem in the beginning and as I start
to work on it and and fold it out for
 
myself it always tend to be a lot more
things, that came to mind from the start
 
of course this is both good and bad, I
need to do this, to to be in a
 
position to actually deliver, what the
client wants the problem is I probably
 
didn't explain thoroughly enough to the
client, how much work it would be,
 
luckily, when I have driven as my tool,
it's still manageable just go through the motions
 
and do these things, ok
here I found something when I
 
submitted it to the server, it said, it was
an SQL error I had attribute called row
 
and that was apparently reserved word
 
in sql server, so I changed that
attribute and submitted it, so now
 
I'm running my application and register
as a new user and starting out my UI
 
creating a theater 1
 
I'm gonna call it rigoletto that's one here in
Stockholm, I'm gonna call another one Sergel,
that's another one in Stockholm
 
and manage movies, I need to create some movies
Die Hard, of course, always die hard,the martian
 
saw this yesterday was really good, I recommend it,
anyway
 
alright, so we have theaters and movies
and what about shows, ok, we gonna can set up
 
shows for martian today and another one
for die hard for today, on the Rigoletto
theater
 
We didn't see the movie image, when we
create the show, I wanna see the image
 
make that readonly
 
uploading the model again, this is really
the loop that I go through, when I develop
 
over and over
 
back and forth between running the
application and changing the model
 
of course, I could be smarter and think
ahead a lot and do all the things
 
that I need up front, that's not me, I don't know
if it's you, it's ok if it's you, you can do it
 
that way, it's a mix I guess
some things is quite hard to see, unless
 
you're up close actually suffering from
the lack of definition or the lack of data
 
create some seats as well and of course
this is boring as hell,
 
but it's done once per theater, these are the seats
that define, what's possible for the
 
future just do two rows with four seats
in each, alright, so that's the show seat
 
that we need to create now, I'm gonna add a method on
show to create a show seats
 
gonna grab all the seats from the
theater and collect over those for the
 
collection I'm gonna follow self from seat,
gonna add each seat from the theater and
 
that will create a show seat for me
 
ok, so now I have the method I need to
call that method and the ViewModel
 
that managed shows I guess
 
method is there, no problem, ok name it to
create shows seats, I guess I should have
 
called that ticket, but rush into write and
I'm gonnna show the show seats, if there are any
 
By the way I'm using a new microphone,
that I bought just for these
occasions, so I hope you appreciate the sound
 
and I'm going to show the state and the row
the state is remember if it's free or not
 
so upload model and head back to
application
 
manage the show, create show seats,
then we have our seats,and the seats are free, right
 
I created both for the Martian and
for Die Hard
 
now for the seats seat request, let's create
another diagram to detail things there
 
We have the SysUser of course, the logged in
user, user buys couple of tickets
 
show seats, could be many, of course and we
have the state machine, what I want to do
 
now is buy ticket view  and this is actually
the one that we are gonna replace later on
 
but we're not there yet, we need to
figure out, what data it contains first and
 
this is really one of the great things
being able to declaratively just move ahead
 
to get all data out there to see
if our thoughts are clear, if we are done
 
with a model or not, it's much better to
find out limitations in our model
 
at this stage, then later on
when we have loads of runtime check
 
JavaScript in the browser somewhere, so thinking this
through isn't that hard by ticket we need
 
to see the time the tickets are for the
theater and the movie, so I know where to
 
go, what to see and when to be there,
that's important information
 
for the guy buying the tickets, I'm going to add a movie
image as well, just because I can
 
let's listall the seats, let's link object and
we follow the inner links to seat row
 
so, now we list of all the available
seats, free or not, we don't really care
 
at this point we show all seats
 
gonna do another View Model just to browse
the shows, so that we get a way in to get to the buy ticket
 
just as before going through
the motions finding simple expressions
 
to show me what I need
 
adding an action to bring this View Model up and
 
varifying that, I can select seats and
clear them and then I can submit requests
 
submit requests, what should
happen then, that's the servier side action


I have been talking about, so
=== '''Organizing Model With Colors''' ===
new diagram for this, the seat request
We are going to make the server-executed request red, so we know it is special.  In situations where we have to manage information like this, we usually need all the data organized by coloring it.  When we color it, it identifies them as belonging together or having the same life span. The theater and seats are quite stationary but the shows and show seats are not as stationary. Movies and seat requests are different from the other two aspects. Try to keep this theme; when setting colors to the model, it helps the eye to know what goes together and how things match up.


we are going to create a new ViewModel servers
=== '''Theatre Management View Models''' ===
I'd check requests and we gonna make
To start the application, we need to add a new diagram with detailed definitions of theaters, shows, and movies.


available for server-side execute
Normally, it is too much work to get into a position where you can start doing the cool stuff that is requested of you. With MDriven, however, we try to minimize it. It always requires significant detail to manage more information than anyone can care to think about, but MDriven keeps track of it all to make you efficient.
sear request all instances, where state is


request process every five seconds, every
There are quite a few simple ViewModels that need to be in place to manage the basic data and the actions to bring those ViewModels up. At this point, we should manage theater shows and be able to create new ones. In the end, I wanted to make a small application with the needed basic data, managed by the generated ViewModel UI. We have to spend a little more time on the things that tend to be manageable by the end-user, and do that "by hand."
five seconds this will execute and


execute what, all the actions in the View Model
Whenever you start a new project, you go through a process of learning the data you need. It always turns out to be a lot more than what came to mind from the start. We ought to undergo this to meet the client's demands. The problem is that we probably didn't explain to the client thoroughly how much work it would be. Luckily, with '''MDriven''' as my tool, it is still manageable to go through the motions and do these things.
take the seats in this case, what it does


is check if all the seats are free
=== '''Creating UI''' ===
Having the application uploaded and running as a newly registered user, we can start out our UI. Creating movie theatres called "Rigoletto" and  "Sergel", we have to manage movies like ''Die Hard'' and ''The Martian'', for example. We have to go set up shows for ''The Martian'' and ''Die Hard'' for today at the Rigoletto theatre. We also have to set an image for each movie and create some seats for the show. This is the loop to proceed through while developing - between running the application and changing the model  - but it is done once for every theatre. These are the seats that define, what is possible for the future - two rows with four seats in each. Now, we need to create tickets and show seats by adding a method to the show.


it sets the state to sold and this is all gonna pen out
At the Action Editor Body CreateShowSeats:
like this, I find a show I want to see
self.Theatre.Seat ->collect(s|self.Seat.Add(s))
Take all the seats from the theatre and compile those for the collection. I'm going to follow self from seat and add each one from the theatre and that will create the show seat (ticket) for me. So now we have the method that manages shows: Create Shows Seats. We need to show the state (if it's free or not) and the row.


find seats I want to use, of course there's
=== '''Seat Request''' ===
no multiselect I was forget and I add the tickets
Let's create another diagram to detail the request process. We have the SysUser, the logged-in user, who buys a couple of tickets (show seats) and we have the state machine. We need to create a buy ticket ViewModel that we will replace later. First, we have to figure out what data it contains; this is one of the great deals - being able to declaratively move ahead to get all the information out there to see - if our thoughts are clear and whether we are done with a model or not. It is better to find the limitations in our model at this stage than later when we have loads of runtime checking JavaScript in the browser somewhere. Thinking this through, we need to see the time the tickets are for, which theater and movie, so I know where to go, what to watch, and when to be there.


these are the ones I want, then I tell the system I'm
=== '''Setting the Ability to Browse Shows''' ===
done selecting and the process server side
Add another ViewModel to browse the shows such that we get a way to buy tickets. Just as before, go through the motions:


to avoid collisions and it
→  Find simple expressions to show what we need
says you got tickets


tickets have been updated to sold and my name is on them,great
→ Add an action to bring this ViewModel up and verify that.
that's the server side view model action for you


so this is the data that we
After choosing the seats, we submit requests. What should happen next? The '''server-side action''' I have been talking about. A new diagram and view model "Server Side Check Requests". We are going to make this available for server-side execute.
gonna replace with a new view
SeatRequest.Allinstances ->select(sr|sr.State="RequestProcess")
Every five seconds, this will execute all the actions in the ViewModel - take the seats - in this case, check if all the seats are free and set the state to sold.


getting rather late and this video has
Now we can find a show we want to see, find seats to use, and tell the system when we are done. The system processes server-side to avoid collisions and responds that we bought the tickets and our name is on them.
run for 20 minutes thank you very much


for following this, so far and I'll be
[[Category:MDriven Designer]]
back with a take on the view that
[[Category:MDriven Turnkey]]
[[Category:AngularJS]]
[[Category:UI]]
[[Category:Example]]
{{Edited|July|12|2024}}


just is in a better way than just
[[Category:TOC]]
lists and checkboxes, ok thank you very much
till next time

Latest revision as of 13:47, 26 March 2024

In most cases, it is too much work to get into a position where you can start doing the cool stuff that is requested of you. With MDriven, however, we minimize that wasted time. It always requires significant detail to manage more information than anyone can care to think about, but MDriven keeps track of it all to make you efficient. As everyone can relate, the movie theater runs shows. In this session of MDriven, we learn how to create a movie theater example to show the abilities of JavaScript and Angular. This particular video will show you how to do seat reservation actions.

To make your experience smooth, we set the main tags mentioned in the video to the right bar menu of this mini-player. Choose an interesting subtitle on the list and immediately get to the exact theme navigation item place in the video. Now you can pick any topic to be instructed on without watching the whole video.


Setting the Movie Theatre Diagram Adding Show Seats and Seat Request State Machine Organizing diagrams with colors Creating "Manage" View Models Uploading and Running the example application Adding movie image to the ViewModel Adding a method to create show seats Organizing Seat Request Setting the ability to browse the shows Server-side ViewModel action

Setting the Movie Theatre Diagram

The seat reservation problem is quite common and of course, we need the seats, which are part of the theatre, but also available for a specific show. This one has multiple seats and the seat is usable for multiple shows as well. We are going to add a state machine to the ticket order to show the seat, stating whether it is free or not. We also need a user that is going to reserve the tickets. To be able to process the seating request on the server, we are going to model a state diagram for it. I want to do it on the server to ensure that we don't overbook or have two people reserve the same seat. One of the state's request processes will be executed on the server and as a result, can be granted or declined.

Movie theatre.png

Organizing Model With Colors

We are going to make the server-executed request red, so we know it is special. In situations where we have to manage information like this, we usually need all the data organized by coloring it. When we color it, it identifies them as belonging together or having the same life span. The theater and seats are quite stationary but the shows and show seats are not as stationary. Movies and seat requests are different from the other two aspects. Try to keep this theme; when setting colors to the model, it helps the eye to know what goes together and how things match up.

Theatre Management View Models

To start the application, we need to add a new diagram with detailed definitions of theaters, shows, and movies.

Normally, it is too much work to get into a position where you can start doing the cool stuff that is requested of you. With MDriven, however, we try to minimize it. It always requires significant detail to manage more information than anyone can care to think about, but MDriven keeps track of it all to make you efficient.

There are quite a few simple ViewModels that need to be in place to manage the basic data and the actions to bring those ViewModels up. At this point, we should manage theater shows and be able to create new ones. In the end, I wanted to make a small application with the needed basic data, managed by the generated ViewModel UI. We have to spend a little more time on the things that tend to be manageable by the end-user, and do that "by hand."

Whenever you start a new project, you go through a process of learning the data you need. It always turns out to be a lot more than what came to mind from the start. We ought to undergo this to meet the client's demands. The problem is that we probably didn't explain to the client thoroughly how much work it would be. Luckily, with MDriven as my tool, it is still manageable to go through the motions and do these things.

Creating UI

Having the application uploaded and running as a newly registered user, we can start out our UI. Creating movie theatres called "Rigoletto" and "Sergel", we have to manage movies like Die Hard and The Martian, for example. We have to go set up shows for The Martian and Die Hard for today at the Rigoletto theatre. We also have to set an image for each movie and create some seats for the show. This is the loop to proceed through while developing - between running the application and changing the model - but it is done once for every theatre. These are the seats that define, what is possible for the future - two rows with four seats in each. Now, we need to create tickets and show seats by adding a method to the show.

At the Action Editor Body CreateShowSeats:

self.Theatre.Seat ->collect(s|self.Seat.Add(s))

Take all the seats from the theatre and compile those for the collection. I'm going to follow self from seat and add each one from the theatre and that will create the show seat (ticket) for me. So now we have the method that manages shows: Create Shows Seats. We need to show the state (if it's free or not) and the row.

Seat Request

Let's create another diagram to detail the request process. We have the SysUser, the logged-in user, who buys a couple of tickets (show seats) and we have the state machine. We need to create a buy ticket ViewModel that we will replace later. First, we have to figure out what data it contains; this is one of the great deals - being able to declaratively move ahead to get all the information out there to see - if our thoughts are clear and whether we are done with a model or not. It is better to find the limitations in our model at this stage than later when we have loads of runtime checking JavaScript in the browser somewhere. Thinking this through, we need to see the time the tickets are for, which theater and movie, so I know where to go, what to watch, and when to be there.

Setting the Ability to Browse Shows

Add another ViewModel to browse the shows such that we get a way to buy tickets. Just as before, go through the motions:

→ Find simple expressions to show what we need

→ Add an action to bring this ViewModel up and verify that.

After choosing the seats, we submit requests. What should happen next? The server-side action I have been talking about. A new diagram and view model "Server Side Check Requests". We are going to make this available for server-side execute.

SeatRequest.Allinstances ->select(sr|sr.State="RequestProcess")

Every five seconds, this will execute all the actions in the ViewModel - take the seats - in this case, check if all the seats are free and set the state to sold.

Now we can find a show we want to see, find seats to use, and tell the system when we are done. The system processes server-side to avoid collisions and responds that we bought the tickets and our name is on them.

This page was edited 44 days ago on 03/26/2024. What links here