Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Start a free Basic trial
to watch this video
What is a framework, what is MVC, & why do we need one?
-
0:00
Simply learning a framework is not enough on its own, It is best for us, in learning
-
0:05
and in practice, to understand why we should
-
0:08
be using a framework and how it helps us.
-
0:11
So what is a framework?
-
0:13
Let's start with a simple definition, a software framework is a
-
0:16
universal, reusable platform to develop
-
0:18
soft wire application product and solution.
-
0:24
Key words here to keep in
-
0:25
mind are Universal, Reusable, and Develop solutions.
-
0:31
Now we need to understand what all framework should help us accomplish.
-
0:34
These following four items, from the Wikipedia page on
-
0:38
software frameworks, are considered the distinguishing features of a framework.
-
0:43
Inversion of control, In a framework, unlike
-
0:46
libraries or normal user applications, the overall
-
0:49
program's flow of control is not dictated by the caller, but yet by the framework.
-
0:55
Default behaviour, a framework has the
-
0:58
default behavior, this default behavior must
-
1:01
be some kind of useful behavior, and not a series of no ops.
-
1:06
Extensibility, a framework can be extended by the user, usually by selective
-
1:11
over writing or specialized by user code, to provide specific functionality.
-
1:17
Non-modifiable framework code, the framework code in general is
-
1:22
not supposed to be modified, while accepting user implemented extensions.
-
1:27
In other words, users can extend the codes framework but should not modify it's code.
-
1:32
Aside from these four, Lorbel provides us with many
-
1:35
more useful features, and does a good job of
-
1:38
giving us a method of implementing, separation of concerns
-
1:41
through the use of MVC, or Model View Controller.
-
1:45
Briefly MVC is thus, a model which contains
-
1:48
our business logic and interaction with our application's data.
-
1:53
A view which presents the user visual data, and a method
-
1:56
of which to interact with our application as well as receive feedback.
-
2:01
A controller which accepts view, or user and
-
2:04
model input and then translates the interactions between them.
-
2:07
How the three components interact are quite important,
-
2:10
and represents the design side of the MVZ architecture.
-
2:13
You may or may not understand what the full power of
-
2:16
this system is, but in time it will become second nature.
-
2:21
Here are the Wikipedia descriptions of that design, to give us
-
2:24
a base understanding of how the process of our data moves.
-
2:28
A controller can send commands to the model to
-
2:30
update the model's state, such as editing a document.
-
2:34
It can also send commands to it's associated view, to change
-
2:37
the view's presentation of the model such as, scrolling through a document.
-
2:41
A model notifies it's associated views and controllers, when
-
2:45
there's been a change in it's state, this notification allows
-
2:48
the views to produce updated output, and the controllers
-
2:52
will be able to change the available set of commands.
-
2:55
In some cases, an MVC implementation might be instead passive, so that
-
3:00
other components must pull the model for updates rather than being notified.
-
3:05
A view, requests information from the model, that
-
3:08
it needs in generating output representation to the user.
-
3:12
Perhaps you're thinking, wow that's a lot to take in, if so, you're in
-
3:16
good company I felt this exact thing on my first lesson, immediately after that
-
3:21
fought my next wasn't denial why in the world do we need all this,
-
3:26
t's for sure a common question, one that I hope to answer in this course.
You need to sign up for Treehouse in order to download course files.
Sign up