php - Best way to organize applications?.... (MVC design pattern) -


When creating applications, what is the best way to decide where you know which one Controller and model For example, I am building a place that is highly based on the place. Users can post different things, which will be visible to other users within a certain distance. In addition, each user will have their profile page that will show everything posted by that user, regardless of location.

So I have such a model

  class UserModel spreads to Betam {get_user ($ uid); Get_all_users (); Edit_user ($ new_data); Delete_user ($ uid); Add_user ($ new_user); Get_user_articles ($ uid); Get_user_reviews ($ uid); Get_user_foo ($ uid); } Class Article Models Basem {get_article ($ Help) Expands; Get_all_articles (); Add_article ($ new_article); Delete_article ($ help); } // Similar to the review modal, and other model class local models have basem {get_local_articles ($ zip_code, $ range); Get_local_reviews ($ zip_code, $ range); Get_local_foo ($ zip_code, $ range); } // Keeps all location related functions  

As you can see, I tempted everything working with user id (user id is required) in user modal It's all about handling the location (a zip code is needed) in the local model, and then everyone else has its own model.

I was wondering what is the best way to know what happens like thumb rules for such things?

Well, you already have 80% The battle is the next design you want if you end up with duplicated "elements" on many pages, then each element should be a scene. Otherwise each page should have a view. Or some combination of two

Once you have the pages defined and you know the data flow of the app, which remains the controller so far.

This can be practical for a controller in a small app. Or for really complex apps, you can have many controllers - though not more than one on each "page".

Just keep in mind - the model should look agnostic (you can reverse the UI without affecting the model). Such ideas should be blind where the data comes from or where it is happening - everything is filtered through the controller.

See previous answers to my like reply:


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -