saranya
saranya

Reputation: 1

EXTJS4 MVC structure

I am a beginner with Extjs 4 MVC and wondering if all the different models needed for different MVC applications could be in one global directory and each MVC application references the global directory for the models they needed so that I need not write a model for new application if I have already used that model for previous applications(reuse). I am concerned that it might be a violation for MVC structure. I was trying to check if asp.net MVC could do that(even though the programming languages are different, basic idea behind MVC structure is same everywhere) and found some supporting forums. Just wanted to know if I am thinking in right direction or should just keep going with applications having the models in their own application directory

Upvotes: 0

Views: 282

Answers (1)

sha
sha

Reputation: 17860

It might be tricky. There are couple reasons:

  • If you follow ExtJs MVC pattern you need to name your classes (and files) according to their rules: MyApp.model.MyModel1 for example. So for the other app you have it actually will be different name.
  • Usually all *.js files should be located under same directory (app\model etc)

The other question I have - how much functionality do you have in the model classes? Usually it's just list of fields for the record with probably some virtual, calculable fields, validators... Not much of a code scope to get huge benefit from reusing it.

Just my thoughts. I probably would not do this in my projects.

Upvotes: 1

Related Questions