Results 1 to 5 of 5

Thread: MVC and runtime

  1. #1
    Sencha User
    Join Date
    Dec 2007
    Posts
    118
    Answers
    1

    Default Answered: MVC and runtime

    First of all, I must admit I still did not get my hands deeply on the 4.x MVC.

    Anyway, being a long time sencha user (2.x and 3.x) I must say that I don't really like it for as much as I've seen. I believe it's a nice try to impose a standard coding in JS, while, imho, JavaScript is cool because everyone has it's own style.

    That said, I think I am missing a nice way to achieve something I've always used with sencha 3.x.

    Usually my applications rely on user logins.
    So actually, the first thing I was doing (in almost every app) was to show a login panel, which handled the authentication, and only that.

    Because not every user is equal, I used to create my GUI with respect of the user roles (think of admins, users, guests...) and showing different parts of the application - AFTER THE USER DID AUTHENTICATE.

    Furthermore, I used to completely hide from the browser unused code and loading (and overloading) the mainApplication with the code I really needed.

    I know this might look a bit like security by obscurity, and in fact it is, but it also allowed my app to have some default functions names that behaved differently from user to user.
    Imagine again:
    - a user creates an item -> the app checks if the price is valid
    - an admin creates an item -> the app allows any type of price

    this could be done via the same "saveItem()" function, because there were 2 different versions of the function being served. One for users, one for admins.

    Anyway, with the "forced" MVC I now need to define my models, views and controllers at the beginning of the app (when the user is still not authenticated, and, maybe, it's not even a valid user!) so I am no longer able to distinguish between roles.

    That is VERY bad.

    So I am asking: is there a way to add/remove models, views and controllers at runtime?

    I see no "addModel()" function ... and so on.

    Do you think there's a good way to achieve that?

    I really would like to use the proposed MVC... as long as it complies with my needs.

    TIA,
    manuxio

  2. Does this post help?
    http://www.sencha.com/blog/deftjs-lo...ency-injection

    Regards,
    Scott.

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    Anyway, with the "forced" MVC I now need to define my models
    You are not forced to use MVC. It is an option that you can choose to adopt, or not.

    Regards,
    Scott.

  4. #3
    Sencha User
    Join Date
    Dec 2007
    Posts
    118
    Answers
    1

    Default

    That is an option.

    Thou, as a former sencha-designer paying customer who is now evaluating sencha architect, I am trying to get deeply into the new proposed development model.

    Sorry Scott, but I don't think your answer is really acceptable.

    A much more interesting approach and answer would involve Deft JS which, somehow, provides a reasonable way for problems like mine.

    An even better approach would be pointing at a way to add models, views and controllers at runtime, which actually does not look that impossible.

    Again, Scott, your answer is absolutely pointless, especially as I am long time programmer who is well trained in resolving problems, instead of circumventing them.

  5. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    Does this post help?
    http://www.sencha.com/blog/deftjs-lo...ency-injection

    Regards,
    Scott.

  6. #5
    Sencha User
    Join Date
    Dec 2007
    Posts
    118
    Answers
    1

    Default

    Absolutely yes, that's why I mentioned DEFT JS.

    Still I think Deft is a great project that provides much more than I need.

    I'll keep investigating a possible patch to add models/views/controllers at runtime.

    I doubt it's going to be too hard.

    M

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •