« first day (702 days earlier)      last day (4262 days later) » 

Sam
4:25 PM
hi
 
 
2 hours later…
6:21 PM
hi
 
Sam
Nick Fury
@Nick you finished with your python?
 
@Sam uhh, didn't finish the code clean up yet
 
Sam
cool
specific to Linux?
 
nope shouldn't be
 
Sam
6:39 PM
gonna post it on your github when done?
 
@Sam probably
 
Sam
okay.....I'll probably take a look at it
 
6:51 PM
lol the PHP chatroom, leaving you with more questions then you previously had
 
Sam
lol.....actually, yes, more questions
but also, more clarity
 
lol
 
Sam
I've pored over many answers on SO concerning MVC; it's as if everyone's just doing it the way they want
 
the biggest problem with MVC is the name
 
Sam
but out of those, I'm extracting the needed information
what's up with the name?
 
6:55 PM
web applications commonly uses Model2, which is based on MVC
however, most people refer to Model2 as MVC
 
Sam
Model2?
 
it's not entirely false, but it's not entirely true either
 
Sam
but it's not different from MVC; it simply didn't focus on a controller
 
MVC, the paradigm: Model-View-Controller, enough said
MVC, the design pattern: the Model notifies the view that its state has changed and the view updates itself
Model2, the design pattern: the Controller asks the Model if it changed, and selects a view to render the Model data in
there's a slight difference in each component's responsibility between the two
 
Sam
7:03 PM
so, how does a View notify the Controller?
 
it doesn't?
 
Sam
@Nick I asked how. I understand how the notification occurs if the notified object uses a static class
however, if it's not static, it means that the notified object, Controller must somehow be passed to the Model
 
not sure I'm following you here
 
Sam
we understand that the Model must notify the Controller about the state change, correct?
 
the Model notifies the controllers and the views, yeah
 
Sam
7:12 PM
ok...how?
is the Controller injected into the Model?
unless another class/interface is created in which the controller is injected, I don't understand how the Controller will receive the notification from the Model without injecting it into the Model class
 
@Sam: well yeah, it's the Observer pattern
The Model (the subject) is told that the Controller (the observer) requires to be notified on state change
 
Sam
7:30 PM
that means that the controller must be added to the observer list right before the processing starts, and removed from the observer list when the processing is complete
 
@Sam: well you don't remove it no
you want the controller to know when the model changes, so there's no point removing it from the observers
we're talking tradional MVC btw, where the application is generally persistent, e.g.: a desktop app
 
Sam
actually, I'm talking about the web
but yeah
I realized that it doesn't need to be removed
 
in the web you can't really do that, because most of the time it's not persistent
 
Sam
once the page is refreshed, it'll automatically disappear
 
that's where Model2 comes in
 
Sam
7:35 PM
unless it's persisted
 
in classic MVC, the Controller modifies the Model, and the Model updates the view
in Model2 (or web MVC if you like), the Controller (sort of) updates the Model and the View
although you can have classic MVC in JavaScript per example
 
Sam
okay
 
the main problem when applying MVC to the web is that the Controller and Model are normally server-side, and the View is somewhat client-side (the browser output), so the Model has no way of telling the View that it changed
 
Sam
so, in a traditional MVC, the model knows of the view's existence?
 
@Sam: yes, absolutely
 
Sam
7:39 PM
but what happens if you have multiple views? you can't inject multiple views into a Model
can you?
 
yes, of course (in classic MVC)
per example, a Word Processor: the Controller receives input from your keyword telling you entered the letter "a". It tells the Model about it. The Model modifies the memory area where your text is stored, and tells the View. the View updates itself from the changed Model state, displaying the newly typed "a" letter on your screen
 
Sam
okay
 
it's circular, the Wikipedia entry contains a diagram that explains it pretty well:
 
Sam
that's on a desktop, right?
 
classic MVC, yeah
 
Sam
7:45 PM
thanks
 
Model 2 is more like Controller -> Model -> Controller -> View, the Controller calls the Model, the Model returns to the Controller; then the Controller calls the View
something you usually see in web apps
 
Sam
cool
I learn more everyday
 
yeah
if you plan on developing desktop apps with Python, you should definitely know about classic MVC :P
 
Sam
that's one of the reasons I come here
oh yeah
I'm actually studying Python exclusively for the desktop
or for native mobile functions
currently working on Python and Java
@Nick what I meant earlier was that I know you would help if you can
 
@Sam lol ohh, makes sense. That was a delayed response :P
 
Sam
7:55 PM
lol....I needed to resolve the issue first
and now, I'm more enlightened
 
 
2 hours later…
9:49 PM
@Sam Yeah I was trying to follow to some degree
 
Sam
@Nick lol....did it end up helping?
 
I've never really studied patterns though, and have a very basic knowledge on MVC
 
Sam
yeah....I started converting all my work projects into MVC
which is why I needed to ensure I'm doing it right
 
converting how?
 
Sam
from procedural to OOP
 
9:51 PM
oh yeah, I've been doing that for sometime now
I was trying to do it with python
but I think im missing something about python oop
 
Sam
lol.....a little
first;
the class name and the file name cannot be the same
cause the filename is the module name
also, python doesn't use the new keyword to instantiate an object
 
10:25 PM
yeah but these are minor things
 
Sam
well, those are the mainframe behind OOP in python; I haven't done any interface stuff with it yet
so I cannot talk along that line
but I've used and created classes
 

« first day (702 days earlier)      last day (4262 days later) »